Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Science

Using Minesweeper to Solve NP 217

Blue Leader writes "Boston.com is reporting that the answer to one of math's most vexing problems lies in Minesweeper. Figure it out, and render modern encryption useless." Its a discussion of NP/P, as well as an excuse to play minesweeper. Personally, I kinda prefer mahjongg or tetris tho ;)
This discussion has been archived. No new comments can be posted.

Minesweeper: Stronger Than Encryption?

Comments Filter:
  • NP means that a solution to a problem can be checked in polynomial time, making it possible to bruteforce the solution.
    Barely -- the number of cases to check goes up as an exponential of the size of the problem (else the problem would surely be in P).
    NP complete means that there is no deterministic algorithm to find such solution in polynomial time.
    No --- if a problem X is NP complete, then X is in P only if every other NP problem is also in P. If P=NP then every NP-complete problem would have a deterministic algorithm to find a solution in polynomial time.
    Factoring numbers is approximately O(n^0.5) divides; simply divide the number n that you want to factor by all primes less than or equal to sqrt(n).
    But n represents the length of the input. If we work with base 2 then there are sqrt(2^n)=2^(n/2) divisors to check, working in base 10 there are sqrt(10^n)=10^(n/2) divisors. i.e. factoring the brute force way is O((2^n)^0.5) not O(n^0.5) and thus is not a polynomial time algorithm.
    John
  • by jayhawk88 ( 160512 ) <jayhawk88@gmail.com> on Wednesday November 01, 2000 @10:16AM (#657130)
    I find it very hard to believe that Minesweeper could be won every time, at least on the Expert level, or similar "big" boards. Mostly I think this because it can be really unpredictable.

    Consider: Minesweeper (at least the Windows version) seems to give you the first "click" free. In all my playing, I've never hit a bomb on the first click. Presumably the bomb locations are randomly located after this first click.

    Now, sometimes on that first click, you get a "2" or "3", with no other spaces uncovered. What then? It comes down to luck, basically. You have no way of knowing for sure which of the 8 squares surrounding your numbers has mines, so you just have to click one and hope. Alternatively, you could click on a totally different area of the board. The odds of you not hitting a bomb are probably better if you do this, but in my experience you end up hitting a bomb enough times to make "winning almost every time" impossible.

    Even throughout a game, you usually cannot avoid coming to these "decision points", where you are unable to logically deduce the locations of bombs, and are forced to make a blind pick.
  • by xyzzy ( 10685 ) on Wednesday November 01, 2000 @10:16AM (#657131) Homepage
    It's worth pointing out that the Boston.com does gloss over some fairly important mathematics.

    All that Kaye has done is show that Minesweeper is NP complete. He has not yet found a polynomial-time solution to it, which is necessary to prove that P=NP -- in a nutshell, he just shows that Minesweeper falls into an equivalence class that holds a hell of a lot of other algorithms.

    And EVEN IF HE FINDS the polynomial solution to Minesweeper, that STILL doesn't say anything about RSA (or any other "hard" algorithm), other than that it can be solved in polynomial time SOMEHOW.

    The only reason people focus on this conjecture is they hope that proving P=NP and solving some algorithm will give them some magic insight into speeding up some other algorithm that's equivalently hard, rather than working on the algorithm directly. Or, disproving P=NP once and for all, and ensuring the computational assumptions that make people pick algorithms like RSA.
  • I've been trying to find out if I am the fastest Minesweeper player in the world (a dubious honor at best). My best time on Expert level is 84 seconds. Obviously I can't prove that since no one was there, but can anyone report a lower time?

    Ben
  • FREE WITH the operating system.

    So yes it is free.


    Just like the prizes in the cereal box is free, right?

    It's not really free, you're paying for it by buying the product that it's bundled with.
  • Not sure if you are just a troll or what, but, have you ever heard of a LINKED LIST?
  • Great minds and all that.

    If you reduce the minesweep board to a single pair of squares that has a single mine in one or the other then the game would be won or loss with a single click...

    This is the equivilant of flipping a coin.

    So esentially the article is saying that if you can guess correctly heads or tail with every flip of any coin that you would win $1,000,000.

    I am thinking that if you could guess that well that you could win significantly more than that amount of money.

  • Some of our students are very bright, but let's not always see the same hands.
  • by Anonymous Coward
    ..but still understandable to most.
    http://www.claymath.org/prize_problems/million-d ollar-minesweeper.htm
  • Please don't confuse NP with NP-complete. You are describing NP-complete problems. Plus, the reductions are in polynomial time and log space.

    Why is this such a big deal anyway? I'd bet that the only new thing coming out of this is another approximation algorithm, which is nothing new.

    Does anyone know the proof or reduction to the venerable 3-SAT for Minesweeper?

  • I'm new to this P / NP thing, so please don't flame me too bad if I'm a complete retard.

    Can you give me another example of a problem that is NP? Factoring a number is definetly a P problem. The algorithm for factoring a number into two pieces is easily done in less than N^(1/2) steps. Doesn't this make it by definition a P solution?

    Can someone explain this to me on a slightly lower level?

    Thanks,
    Captain_Frisk
  • So, write a program that can decode Minesweeper for any size board, and you will join the pantheon of mathematical greats, alongside Euler and Pythagoras.

    Decode it? Does that just mean solve it?

    I mean, given a minesweeper board of any size, there could be lots of potential solutions. If this is just a matter of writing a program to find a solution...i.e. unconver a square (the first one is never a mine), and go from there, looking at each surrounding square and the ones near that, etc, etc, etc...in other words, write a program to do what the player is trying to do...well...I don't think that is possible. There are probably lots of cases where such a program would work, but there have been so many times that I've, for instance, come down to a point where there are 2 squares left, 1 mine left, and EITHER ONE of them could be the mine. At that point, it's just a guess. There have been a few times where that foiled my attempt to beat my best time of 60 seconds for expert mode. Since a program cannot truly guess the correct answer every time, then this is not possible. If the program was written with knowledge of the algorithms used to place mines, or somehow actually knew where to look, well, it might be possible then, but it wouldn't be a guess then...that would be cheating.

    "It is well that war is so terrible, lest we grow too fond of it."
  • That's totally wrong. You may have just gotten lucky with your first picks. I find that about 20% of the time, my first click will find a mine, and end the game right there.

    -
  • My own time is more like 250 seconds, but my conclusions are the same. There will be no bomb found on the initial move with M$ and some other versions. Only a very few games can be solved with pure logic. It helps if the initial move uncovers a sizeable space with several bombs clearly indicated. Midgame may force one or more guesses, and end game may force a 50 percent, or less probable guess, on four or more spaces.

    On the bright side, a cheat of the "easter egg" type does exist. I did not copy or remember it, and forgot the URL in a few minutes.
  • Since the program could definitively tell whether or not a move was safe, it could detect when a player was *GUESSING*. And so we could hack the program to always reveal a mine in such cases, driving the game weenies insane. :-)

    *gasp*

    You ... you .. you BASTARD!

    ;-)


    ---
  • The number N is defined as the size of the information, so factoring by trial division takes at most 10^(N/2), if you're using decimal notation.
    -----------
  • So you are right, a proof that P=NP doesn't necessarily tell you how to solve any NP-complete problems in polynomial time

    Actually you can from the get go. NP-complete is closed under transitivity, so if you find a P solution of an NP-complete problem, you are pretty much done since the composition of two polynomial time reductions is itself polynomial! So, the proof of P=NP could definitely provide a direct solution, just compose the sequence of known reductions.

  • Since I only have a Master of Technology qualification, and the United States doesn't recognize it, apparently (maybe I'm wrong, I don't know...)

  • Hence the easiest way to ensure you always win:
    100-square board, 99 mines.

    Chris Mattern
  • by WolfWithoutAClause ( 162946 ) on Wednesday November 01, 2000 @10:17AM (#657148) Homepage
    ...was included with windows to give you something to favourably compare the 'bomb' rate to.

    Comparisons:

    Minesweeper:

    - often explodes on the first click
    - randomly explodes later on
    - game is over quite quickly
    - you have to press the reset button to restart

    Windows:

    - often explodes on the first click
    - randomly explodes later on
    - game is over quite quickly
    - you have to press the reset button to restart

    Its the same program!

    Therefore- the Stability of Windows is NP complete! QED!

  • Who's right?

    Funnily enough, they turn out to be aspects of the same thing.

    To solve minesweeper for any size board, you have to place where you think the mines are, then determine if the board is consistent. If it is, you got the mine placement correct. If it isn't, the mines are in the wrong place. This is all explained in the article.
    ---
  • MCSE: Minesweeper Consultant and Solitaire Expert.

  • Proving the conjecture false would mean that modern encryption technology, the foundation of electronic commerce, would be open to easy attack.

    The article was cool except for this. Every single technology article has to be related to "e-commerce". Commerce this, commerce that. This has nothing to do with freaking COMMERCE! I'm sick of it. Take your stupid money and your stupid analysts and your STUPID EXECUTIVES and get them out of here!

    </rant>

  • No.

    You'll notice that they speak about board "consistency". Basically, give me a board with a bunch of numbers on it and all other cells marked X. I'll tell you whether there exists a layout of mines (in the Xs, of course) so that your numbers are correct. This proof basically states that the best we can do is to enumerate all possible layouts and check them in turn.

    say there are n Xs on the board. If you can come up with an algorithm that runs in O(n^k) time (k some finite integer) or prove that it is impossible to do faster than O(k^n) then you win a million dollars.

    They're not asking you to play the game. mutter mutter. Reading comprehension. mutter mutter.
  • I do not know why so few people realize that the difference between P and NP has nothing to do with what is actually computable in practice. If you have a polynomial problem where the computationnal complexity is a polynomial of degree 100, no amount of computing power will help. On the other hand, there is no reason why there cannot be practically efficient algorithms for NP problems.

    While it is amusing that minesweeper is NP-complete, at least superficially, the problem of minesweeper consistency certainly seems no easier than the travelling salesman problem.

  • what about you starting in an area that is completely surrounded by mines?


    XXXXX
    X434X
    X303X
    X434X
    XXXXX


    You click on the 0 to start (numbers may be wrong, sorry). the Xs represent mines. To clear the rest of the board, you have to blindly guess on a square outside your cleared area.

    That sounds "unsolvable" to me. So you need blind luck.

    NB I realise that this is not the what the article is about.
  • In other news, researchers have shown that solving the Travelling Salesman Problem would be equivalent to cracking the P/NP conundrum.

    "This is a problem that has me vexed for a long time" said Harvard Professor of Business, Prof Crack C. Pot. "I hadn't realized that solving this would crack the great P/NP challenge."

    "I must admit I haven't thought of it that way before," says Mary Dense Airhead, a travel agent from New York. "I mean doesn't looking through all the routes solve this Travelling Salesman Problem? What is the problem?"

    "This definitely a challenging problem," says Joe Smith, a mechanic from New Orleans. "Now I'll redouble my efforts into trying to solve it - I didn't know I could be famous if I tried!"

    "Well I don't know," says the famed Computer Scientist from Stanford, Donald Knuth. "Personally, I have always found SAT just as challenging."

    It is beyond the scope of this brief news digest to explain what SAT is. Presumably, this is too hard to explain and too esoteric. Why don't you try the Travelling Salesman Problem folks? We could all try a shot at that. After all, it's much easier!

  • Ever wondered why you never hit a mine on the first click in minesweeper? The board is generated when you click the first square, and thus, with your implementation, you'd always win.
  • by Otto ( 17870 ) on Wednesday November 01, 2000 @10:19AM (#657157) Homepage Journal
    The author of this paper has a web page here [bham.ac.uk]:

    He also has a page specifically about this Minesweeper business here [bham.ac.uk].

    I like the other paper proving that minesweeper, with a little variation, on an infinite board, is Turing-complete. Fun! :)

    ---
  • No, I have hit mines on the first click before.
  • The October 2000 issue of Discover Magazine had a more thorough article on this. For details go there.

    I checked their website, but couldn't find the article online.

  • you fucking dullard
  • by mingux ( 243286 ) on Wednesday November 01, 2000 @10:21AM (#657161)
    As with almost any mass media article about mathematics, this article is full of errors that nitpicky people like me feel the need to point out. First of all, some basic info you may be lacking. The basic P vs. NP problem is most simply stated as "P = NP?" P stands for Polynomial time, and NP stands for Nondeterministic Polynomial time, as in you can solve the problem is p(n) steps, where p is a polynomial and n is the size of the input file. Beyond that, some heinous mistakes they made: 1. P is a subset of NP, not a distinct set. Thus all P problems are NP (obviously, if you read the definition). 2. Internet encryption (at least RSA) is NOT KNOWN TO BE EVEN NP-COMPLETE. This is something I think a lot of people don't realize, and I have talked to many mathematicians who think that factorization will eventually be shown to be in P and thus RSA and all other such encryption schemes will collapse. All it takes is one brilliant hacker... 3. The answer has to do with determining consistency, which is very, very different from solving the game in a game theoretical sense. And some slightly more nitpicky issues: 1. NP-Complete problems are those problems whose solutions can be polynomial time transformed to solutions to _any_ other problem. That is why if you find a solution to the minesweeper problem, NP-Complete will cease to exist and P=NP. 2. No serious mathematician believes that P=NP. Anyone who wants to know more should read Sipser's book "Introduction to the Theory of Computation" which I highly recommend.
  • I tried to find more information, but there doesn't seem to be much on the net. Professor Stewart doesn't have anything on his homepage and Harvard has no further details.

    The best I could dig up was his e-mail address: hins@maths.warwick.ac.uk [mailto]. The really curious might want to e-mail him.

    -m

  • That is exactly what I did :)
  • It's difficult to express how I felt when I saw the birds working out the details of moving around and adjusting. Now presumably the birds were not sitting in any particular order ... they were just sitting. So the question becomes: how do we (as humans) build a device that can take arbitrary things and just stick them somewhere without having to find out the details of specifically where it goes, or if there is room. I think that's what I was really getting at -- not so much about how to improve sorting, but how to improve read-write access.

    Another brain-bender: is it possible to know the size of a set S without counting it or counting the elements as they are added to the set?

    anacron.
  • MineSweeper is not open-source so we'll never have the solutoin ;-(

    --
    Density Altitude Not Available
    --
  • A completely blank board is a consistent Minesweeper configuration, as is a completely covered board.

    The subject of the article is not about solving Minesweeper. It's more like debugging Minesweeper. Given a minesweeper board, can you find evidence of a flaw in the Minesweeper program? If the upper left corner of your minesweeper board looked like this:

    1 1
    1 1

    ...then you'd know that there was a bug in Minesweeper. If you wrote a program that would analyze arbitrary Minesweeper boards to look for inconsistencies in them, and if your program ran in polynomial time, then you'd be famous and possibly rich.
  • If it's free, I should be able to download it for free and distribute it freely. So don't say it's free unless you can provide a working link.
  • Factoring numbers is NOT in NP-complete. It is an NP-hard problem. It's one of those NP problems whose "certificate" is not linear in the size of the input.
  • to the Millennium Prize Problems page [claymath.org]
    to Ian Stewart's article on the problem. [claymath.org]
    to Stephen Cook's mathematical description [claymath.org] of the problem (in .pdf format)
    to Richard Kaye's Minesweeper Page [bham.ac.uk]
  • by Anonymous Coward
    Unless I'm misremembering my Algorithms class, the kind of factoring technique needed to break public key encryption has never been proven to be NP complete. It may reside solely in P.
  • by Dominic_Mazzoni ( 125164 ) on Wednesday November 01, 2000 @11:42AM (#657171) Homepage

    What do you mean, you can't prove it? Either P=NP, or P!=NP. If you discover a polynomial-time algorithm to solve a problem which is NP-complete, and you can PROVE it always works and never takes more than polynomial time, then P=NP. Furthermore, the proof that such problem is NP-complete would give you a way to solve any NP problem in polynomial time, so it would be true in practice, not only in theory. This article just says that Minesweeper is NP-complete, which is not a major result.

  • by Imran Ghory ( 200764 ) on Wednesday November 01, 2000 @11:42AM (#657172) Homepage

    More details of the maths involved can be found at The ClayMath Institute's webpage [claymath.org] and some related papers at R.W.Kaye's webpage [bham.ac.uk]
  • If you can come up with a polynomial time method that will work 75% of the time you have just broken the crypto system.

    Does that mean that Rabin's probabilistic primality test has kill crypto already? ;)

  • Compare this to

    • Kill -9 With a Doom Shotgun [slashdot.org]
      Posted by CmdrTaco on Wednesday October 20, 1999 at 11:02AM EST
      from the now-that-is-cool dept.

    Yeah, they're both funny. But not very.

  • Heh, I never could grok Freecell till that one week of 'Advanced NT Server Administration' class way back when.
  • That Bill Gates will try to claim responsibility for this.
  • The solution lies in minesweeper.... and no real details..

    It could just as easily lie in Freecell.

    --Mike--
  • What, how can you call that a troll? When reading it, I was thinking that I wished I had mod points so I could moderate it up... obviously you didn't understand the point of it. Linked lists do not do what he asked... they do allow you to insert things into the middle of a list, but they do not change the memory locations of any of the other nodes. He wants to be able to insert something into a specific place in memory, and have anything currently in that place be shifted. Presumably that would allow you to have the advantages of linked lists but be rid of most of the disadvantages - it could behave like a resizable array.

    There's an idea. An analog memory system that allows for overlaps of data points without data corruption. Build me that and I'll solve your NP vs P problem. That summarizes the original point, and I don't know how you could think a linked list is the solution. Maybe you didn't finish reading his post? In the future, please don't bash something that you don't understand. It's disrespectful and doesn't help anyone.
  • by taniwha ( 70410 ) on Wednesday November 01, 2000 @10:01AM (#657184) Homepage Journal
    and the issue isn't about PLAYing minesweeper - but deciding whether a particular position is self-consistant - a whole different thing
  • I see now... Minesweeper is the enemy of encryption. This just goes to show that Windows really is a security risk. (As if we needed more proof of that...)
    --
  • A much more detailed story is found at The Clay Mathematics Institute Website [claymath.org]

  • by namespan ( 225296 ) <namespan@elitema[ ]org ['il.' in gap]> on Wednesday November 01, 2000 @10:23AM (#657189) Journal
    I've always thought that one of the problems with math -- as taught at the secondary level -- was that you didn't actually learn any abstract math skills (well, you might, but you're not taught them). Just more algebraic manipulation, or, if you're luck, the foundations of calc.

    I think games and optimization problems, though, could provide a fertile and interesting framework for teaching real mathematical thinking. Minesweeper. Knight's Tours. John Conway's games. Nim. Dominoes. Any small, discrete system with definable rules can get you thinking mathematically, though most people probably just play with heuristics....
  • by Zachary Kessin ( 1372 ) <zkessin@gmail.com> on Wednesday November 01, 2000 @10:25AM (#657191) Homepage Journal
    NP complete problems are not very useful for crypto. It turns out that for many NP complete problems you can find a much faster solution that will work some of the time. All NP says is that in the *WORST* case senario it will be expontential time to solve. If you can come up with a polynomial time method that will work 75% of the time you have just broken the crypto system.

    The Cure of the ills of Democracy is more Democracy.

  • A bit tangential, but it may amuse some: My Minesweeper [defenestrators.org]

    Ted

  • Contrary to popular belief, minesweeper is not that difficult of a game to solve, but only after you have found your first mine. Up until that point, you HAVE to guess. the game, however, does not draw the board until after your first move, as your first move will ALWAYS be safe. However, unless your first move hits a spot that has no mines surrounding it, your next move will HAVE to be a lucky guess. However, once you have reached a certain point, like after successfully rooting out about 5 mines, the solution becomes pretty much a linear problem based upon the number of grids on the board.

    There are a few "traps" however. Ones I have learned to avoid by always cleaning out the corners first on a large board. If I die, I want it to happen in the first few seconds and not on the last grid I'm trying to clear.

    Encryption, as far as I've been able to deduce, does not allow for this strategy. While I know that it might take 2^56/2 average brute force comparisons to extract a DES key, there is no plateau I know of, say at 2^10 comparisons where I can safely say that the problem becomes a linear problem rather than an exponential one.

    Take for instance a 10x10 minesweeper board. If I simply wanted to brute force out a solution, I have 2^100 possibilities (yes, this makes encryption look tame by comparison). However, we can break this problem down significantly without even knowing any tricks. Take a board. Guess at a grid. If the grid is clear, we go onto the next one, if the grid is occupied by a mine, we will know this instantly as well. This problem still has 2^100 possibilities IF the game restarts each time you die and you get a fresh board. HOWEVER, if the board remains the same, you have only 200 possibilities total and you will have the board complete. I can't do this with encryption. I can't guess at each bit of a key indifidualally to determine if it is right or wrong. If I could, then DES could be solved with no more than 112 instructions. And even 128 bit encryption would take no more than 256 iterations.

    But minesweeper isn't that difficult. There are very few boards (especially on the 10x10 grid) that can't be solved with a predicable algorithm. While it is not possible to know with certainty if EACH grid location is definitely a mine or definitely not a mine, you are about 99% likely to know at least ONE of them at any one time, after the initial 2-3 guesses. This is better than we have for encryption, but still falls short of the rule as we need to be 100% sure for ANY board.

    Encryption does not suffer. Even if for an encryption scheme with 2^N possibilities, I would be able to determine an absolute solution in less than 2^(N/10) possibilities, for DES this would be about 32 possibilities, the problem can be made more complex simply by increasing the bitsize of the key. A key with 1024 bits would, with this method, require 2^102 possibilities which is still out of the range of today's computers, or even tomorrow's.

    -Restil
  • I see now... Minesweeper is the enemy of encryption

    So does this mean that Minesweeper is illegal under the DMCA? ;)

    =================================
  • by q000921 ( 235076 ) on Wednesday November 01, 2000 @12:20PM (#657207)
    • Solving the minesweeper consistency problem is not sufficient for playing minesweeper optimally (and it may not even be necessary).

    • There are lots and lots of games that are NP complete. It's a fun but elementary exercise for undergraduate CS majors to think about these. Sometimes, that contributes a useful insight to the N=NP question, but usually, it does not.

    • Proving that "minesweeper consistency" is NP complete probably doesn't make it any easier to establish P=NP or P!=NP; there are lots of NP complete problems, some of them much better suited to an attack on this problem.

    • Cryptographic methods, and RSA in particular, often rely on factoring, not NP completeness.

    • So, write a program that can decode Minesweeper for any size board, and you will join the pantheon of mathematical greats -- Actually, it's easy to write a program that does this. The question is whether it runs in polynomial time in the worst case.

    • NP completeness has lost much of its lustre since its discovery. Many NP complete problems have good, practical solutions, and many known polynomial time problems lack good, fast solutions. These days, randomized complexity and circuit complexity are probably of more practical interest, and there are lots of more interesting, outstanding problems there.

    Besides P = NP for N = 1 (:-).


  • Okay, so there's a journal article which discusses a problem contained within Minesweeper. In order for this to be interesting, he would have had to prove the problem NP-complete and provide a polynomial time solution for it. As far as we know he did neither. The gist of the article is, "There's a theoretical problem in Minesweeper, and gosh, isn't the P=?NP question interesting?"
    Furthermore, even if a proof that P==NP were handed down by God encryption wouldn't become useless. Most of the fundamental problems in encryption are not provably NP-complete.
  • Like many people, I play minesweeper obsessively. But thanks to Pat for an amazing x-mas present one year, I found something more challenging than the same board over and over again. If you like Minesweeper, and are on a Windows machine, check out Professional Minesweeper [cnet.com]. They have 18 different boards, with support for English, Finnish and Croatian languages.

    It's Very challenging. I do it as a hobby, and currently have some amazing scores [granzeau.com] for it. Currently, I have a low of 107 for the regular level, with an 82 on my favorite level, crossed squares. It took me approx 4 months of solid play to get the 149 on Diamond, it's REALLY hard.

    You can find the author, Bojan Urosevic [mailto]'s original web site [dizzy.hr]. It's shareware, but I highly recommend you purchase it because it's such a great game.

    --
    Gonzo Granzeau

  • This article is mainly publicity - no realbreakthrough - which is okay if you want to inform the public about P vs. NP problems. Unfortunately, to the average reader of the article it would appear that there has been a new development just because someone has shown minesweeper to be equivalent to other known NP problems. The key to proving P=NP or P!=NP does not lie in the game minesweeper anymore than it lies in any of the many other known NP problems. The only real news here is that a problem stated in terms familiar to minesweeper players is an NP problem. Ho hum.
  • by Code Archeologist ( 128429 ) on Wednesday November 01, 2000 @10:28AM (#657218)
    It works like this. Minesweeper seems logical from the start. but your mind is actually haviong to make some intuitive jumps at critical points. Such as when you have three blocks and you know that teo of them have mines with in them. it takes an intuitive jump to come at the problem from another direction and try to solve one of the three blocks from a different edge. Straight Boolean logic chokes on this because there are not enough known values and to many unknown variables. Free Cell on the other hand can be solved easily by a computer simnply by using the brute force method. Because all of the components of the puzzle are layed out before it and it can plan each of its moves in advance... much like how a computer plays chess. it is figuring out how to get the computer to make these intuitive leaps that seperates a P from a NP problem.
  • Actually, any NP problem can be reduced in polynomial time to any NP-complete problem. Solving any NP-complete problem in polynomial time proves that every problem in NP is in P.
  • by jck2000 ( 157192 ) on Wednesday November 01, 2000 @12:37PM (#657224)
    In looking through old floppies the other day, I came across the attached very-pseudo-code "Solution for Minesweeper", which I put together a number of years ago. I think I got half way into coding it and then abandoned it for some other pointless problem with bad O() attributes.

    The basic idea is, given the current displayed numbers and the number of remaining mines, generate all possible patterns of mines in the adjacent undisplayed squares and then figure out the probability that each undisplayed square has a mine. I am not sure I follow what I was doing, but I thought some might find it amusing.

    *************

    SOLUTION FOR MINESWEEPER

    1. Read in minefield and translate into a code where each square is assigned a number between 0 and 10, with 0 through 8 representing the displayed number of adjacent mines, 9 representing an unknown square and 10 representing a displayed mine.

    2. Iterate through each square in minefield (indexes: [x][y]). If such square has a value of 0 through 8, save value of square in nNetAdjMines and test adjacent squares for "unknowns" (indexes: [c][r]). If an unknown is detected, (i) increment nAdjUnk, (ii) increment AdjUnkTable[c][r] and (iii) add a [c][r] node to pointer in KnownTable[x][y]. If a mine is detected, decrement nNetAdjMines. If nNetAdjMines>nAdjUnk, an error has occurred. If nNetAdjMines==nAdjUnk, then all unknowns for square [x][y] are mines; in such case, add [x][y] to minelist, and, after processing the entire minefield, reveal all mines on minelist and go to step 1.

    3. Count all known, non-mine elements of KnownTable (nAK). Create array of nAK pointer elements (KnownArray). For each known, non-mine element of KnownTable, set a pointer in KnownArray to such element.

    4. Count all non-zero elements of AdjUnkTable (nAU). Create array of nAU integers (AdjUnkArray). For each non-zero element of AdjUnkTable, reset the pointers in the linked list of each element of KnownArray to point to the corresponding element of AdjUnkArray.

    5. Place each possible binary pattern of mines/non-mines in AdjUnkArray. If more mines are used than available, junk pattern right off the bat.

    6. Test each such pattern by checking whether, for each element of KnownArray, the sum of the dereferenced pointers on the linked list equals nNetAdjMine. If it does, then call FinalArray(x,y,nMines), which, for a [x][y] square, increments a counter of an element in an array (CountArray) which indicates, for a given number of mines contained in AdjUnk squares (nMines), the number of patterns in which [x][y] would contain a mine.

    7. For each KnownArray element, a "Factor" (equal to the number of different patterns that could be made by placing totMines-nMines mines in the non-adjacent unknowns) is applied to each CountArray element to account for the relative numbers of occurrences of the different nMines. The Factored counts are added for each CountArray element for such KnownArray member and the totals are divided by the total number of all possible patterns.

    8. The relative probabilities that each unknown is a mine is displayed and/or the least probably unknown is selected. All unknowns having a 0% chance of being a mine are selected and all unknowns having a 100% chance are flagged as mines.

  • Goldbach's Conjecture is a veritable forest of discovery. Once I write up my proof for it, I plan to move on to Reimann's Hype and P=NP. ;-)

    Ya see, GC has puzzled mathematicians for 258 years because it's easy to "see" relationships immediately, but each of them is difficult to prove. Once proof is offered, it will be easy to verify, much easier than Fermat's 150pg proof, just like P=NP solutions are quickly verified.

    GC lends well to P=NP, because finding composite numbers (non-prime) is a classic example of one of those tasks that requires checking through every permutation. Minesweeper is a pattern-matching exercise that is not far from finding which prime patterns (twins, quartets) are workable and which are invalidated by congruencies (modulas) of other primes.

    On my way to solving GC, I think I accidentally proved both the Hardy-Littlewood conjectures, and thus disproved the disproof against them! :-D

  • And EVEN IF HE FINDS the polynomial solution to Minesweeper, that STILL doesn't say anything about RSA (or any other "hard" algorithm), other than that it can be solved in polynomial time SOMEHOW.

    Correction, The finding of a polytime algortim for ANY NP-complete problem will give a polytime algorithem for any problem in NP. How big a polinomial is up for grabs. Factoring (which is is what one needs to break RSA) is in NP I've never worked out what the polynmial is, but likely its like say n^3 (turning machines are slow). That is to recover say one bit of a factor, (maybe more). Then you have to sya runit into say SAT give as formula that's approximatly n^6 long, then say run your sat very fast sat program(n^2) giving you a running time fo n^12 for one bit, now repeat for many bits say 1/2 n approximatly give a alogrithm with a running time of n^13 which is slow but still polynomial. Thus goverment, and other determend people will be able to break your RSA key fairly quitly. (i.e. in a few months as opposed to years or the heat death of the universe.)

    Now suppose someone make a more effiece various of the algorithm with some understanding.....

  • by b0z ( 191086 ) on Wednesday November 01, 2000 @10:57AM (#657240) Homepage Journal
    MSCE = Minesweeper Competent Solitaire Expert. I have sat through some of the classes (NT 4.0 Core, MS-SQL Server 7.0 Admin, etc) and yes, I have become a minesweeper and solitaire expert. So, we have plenty of people such as myself that have had training in these complex programs, since we had to do something while the instructor blabbered on about some corny jokes to try to liven up the classes. I'm not MCSE certified, but I am pretty damn good when it comes to solitaire and minesweeper. I have been improving on my freecell skills, and I have already mastered the pinball game that comes with NT. WOOHOO!
  • Consider the following situation, against the top edge of the board:
    --------
    01?10
    13?31
    1***1
    12321

    In my experience, this usually happens around the edge of the board, but there are times when it will happen smack dab in the middle as well.
  • by Surt ( 22457 ) on Wednesday November 01, 2000 @11:00AM (#657242) Homepage Journal
    Unfortunately, this is not the minesweeper solving problem. It is the minesweeper consistency solving problem. 2 correct examples of the consistency problem:

    X = MINE
    O = COVERED EMPTY
    NUMBER = BOARD CLUE

    1 X
    X X

    The correct analysis of this board would be 'inconsistent'.

    2 X
    X O

    The correct analysis of this board would be consistent.

    The minesweeper consistency problem is a matter of checking the board and being able to declare whether or not the board is correct in all of its details.

    The challenge is to construct a program which will process all generalized minesweeper boards and declare them correct/incorrect (accurately) in P. IF you can write such a program, then NP=P.
  • by Otto ( 17870 ) on Wednesday November 01, 2000 @11:00AM (#657243) Homepage Journal
    RSA is only NP, or at least nobody's proven it to be NP-Complete yet.

    Any NP-Complete problem can be transformed into any other NP-Complete problem via a polynomial time transformation. Thus, solving one solves all. I have no idea how to do it, it's over my head. But it can be done.

    Anyway, more to the point, this isn't about Minesweeper, it's a problem called the "MineSweeper Consistentcy Problem" and it's important to remember that. Essentially, the MCP is: given a half finished minesweeper board, is it consistent? That is, is it a valid board within the rules of the game? It is possible to get this board through normal play?

    That's a bit of a different beast than just playing the game, guys.

    ---
  • Arg! Do you realize what you've just done?

    This is just like the time a co-worker asked me to determine what the set of all points equidistant from a point and a line in 3 space is. Hours of work were lost (because you can't stop with a point and a line, no, you've got to do point-plane, line-plane, and then think about 4 space). All.... CPU Cycles... being... consumed ... Must... resist... attractive... problem...

    Plus, now Slashdot is simply going to lose everybody who makes quality posts. They'll be too busy writing their own java apps for "programmer's mineswepper" (no I'm not going to give you the URL). Slashdot will become a banal wasteland of first posts, trolls, and karma whores....

    (oh, wait...)
  • Actually, the best known factoring algorithm is NP. For an integer of size n, e^(.5(sqrt(ln n))(sqrt(ln(ln n))))) steps are required to factor it. This is the best algorithm (Garret, Number Theory, 2000). I could not explain it for the life of me, so please do not ask.

    Here's a more easily understood NP prob - the traveling salesman. The salesman wants to visit n cities one time each. Find the shortest route.

    There are n! routes (n choices for first stop, n-1 choices for the second, .... = n(n-1)(n-2)... = n!)

    This expression, n! is greater than n^k, k is an int. This assume n is big, which is the standard assumption.
  • Huh?

    Not so, unless I'm missing something. Take, for example, the 2-space equivalent of what he's talking about: the set of all points equidistant from a line and a point. This is a parabola. A point and a line qualify as subspaces of a plane, but a parabola ain't a single point (ever, I think).

    In three space, the point-line thing becomes a parabolic cylinder, and so does the line-plane (I think). The point-plane is a parabolic dish, like you'd use for a satellite receiver. Four space... sigh. No idea.
  • I thought of a similar problem recently while driving along. There was a bunch of birds sitting on a telephone wire. It was pretty much a whole flock. A new bird would come along and sit on the wire, and if there wasn't room where he wanted to sit, he sat anyway -- the birds around him would shift appropriately, but it all happened so well.

    Extrapolate: Take the birds on a wire problem and turn it into a sorting problem. Given n things, put them in order. The problem with comptuters is that everything is digital. It wouldn't be possible to move the elements of a semi-sorted list down a little -- you always have to shift them by some number of spaces.

    I think the NP problem could be more easily solved if there was some analog way to do things like sort a list. Think of it ... you want to put something in a particular location, you just place it there, and the "things" around it shift a little

    The birds on the wire closest to the new bird have to shift the most .. the birds on the end of the wire don't have to shift at all. I want to be able to sort lists the same way --- it'd be much faster. Sure there's a physical limit to the number of birds that can be on the wire ... but remember that they can overlap a bit.

    There's an idea. An analog memory system that allows for overlaps of data points without data corruption. Build me that and I'll solve your NP vs P problem.

    anacron.
  • There is a large class of problems which require exponential time to solve optimally in the worst case, but can be solved near-optimally for most cases in far less time. Linear programming is one such problem, and the TSP is another. There was a lot of hype about neural nets solving the TSP rapidly back in the mid 1980s, and it was bogus.

    As a practical matter, solving the TSP is really easy.

    • 1. Link all the nodes into some random order.
    • 2. Pick two different links at random, cutting the chain into three chains.
    • 3. Try all the possible ways the three chains can be reassembled. Keep the one with the shortest distance.
    • 4. Repeat steps 2..3 until no improvement has been observed for a while.
    This algorithm was developed at Bell Labs in the 1960s. It usually converges on the optimal solution quite quickly. Since the discovery of that algorithm, other semi-random algorithms have been discovered for related problems. This has made a big dent in some useful classes of tough problems.
  • Right, ok, go ahead: show how minesweeper is equivalent to factoring large numbers :-)

    I submit to you that knowing that a path exists out there and actually finding it is a hard task in and of itself. As I said, all you've proved is that the solution DOES exist.
  • by RaveX ( 30152 ) on Wednesday November 01, 2000 @10:37AM (#657261)
    This is fundamentally insolvable.

    Consider a game board of any size, but in the upper-left hand corner, there sit four boxes:

    [][]
    [][]

    If row 1, column 2; row 2 column 1; and row 2, column 2 are all mines, the four boxes look like this:

    []##
    ####

    No data is known about row 1, column 1. Therefore, 2 possible solutions exist.

    Extrapolate this, assuming similar situations on a game board consisting of billions of rows and columns, and an astronomical number of possible solutions begin to emerge.

    Which, of course, is the whole problem with encryption. There are just too many possible answers (depending on key strength, etc).

    In short, yes, maybe minesweeper does have something to do with encryption. However, it won't be offering solutions any time soon.

    --M McCormick, Northwestern University
    ---sig---
  • by e_lehman ( 143896 ) on Wednesday November 01, 2000 @10:37AM (#657263)

    When I was an undergraduate, I wrote a program that would detect whether a particular move in Minesweeper was safe. It used a recursive search, and couldn't detect safe moves in certain late-game situations where the mine count was relevant, but its play was otherwise perfect.

    Since the program could definitively tell whether or not a move was safe, it could detect when a player was *GUESSING*. And so we could hack the program to always reveal a mine in such cases, driving the game weenies insane. :-)

    Okay, we never built the search into the game, but we did hack Tetris in a few irritating ways... (As I understand it, Tetris is a lost game anyway: with probability 1, if you play long enough, you will lose, no matter your speed or strategy.)

  • If you read the details, you don't have to solve minesweeper, you have to be able to check if the board is self consistent or not.

    Ie:

    2 MINE
    MINE BLANK

    is a self consistent board while:

    2 BLANK
    BLANK BLANK

    is not.
  • So, write a program that can decode Minesweeper for any size board, and you will join the pantheon of mathematical greats, alongside Euler and Pythagoras.

    And, of course, there is that million-dollar prize. One question, though: wouldn't this be as simple as modifying basic human behavior? Would the first square be random (the only real option you have)? From there, solving the game is relatively easy, and a computer would be able to do it in a heartbeat.

  • You are right, but the original poster is also right.

    You see, even if you could solve all the Minesweeper problems (which I seriously doubt you can without guessing), it is not the same as the Minesweeper Consistency problem.

    This is a math question folks. So the math geeks all should be careful, just like the original article should have but did not, by giving a false impression that solving minesweeper is solving P=NP.

    There is nothing new here folks. We just found a new NP Complete problem. How does that help us towards the P=NP puzzle? Nothing!

  • by kfg ( 145172 ) on Wednesday November 01, 2000 @11:04AM (#657271)
    Please note that if a solution to the minesweeper problem IS found that it demonstrates only that SOME solution will can be found for all NP problems.

    It will not only NOT mean that the solution to all NP problems has been found, but it will NOT mean that a solution to any * particular* NP problem, other than minesweeper, has been found.

    It will simply mean that a solution to any NP problem is * theortically findable.*

    Finding the solutions to an *actual* NP problem is left as an exercise to the student, or FBI.

    If NP problems do, in fact, prove to be solvable it will have an enormous impact on mainstream encryption of data transmission because such depends on having a *single,* or at least very small group, of encryption methods shared jointly by all.

    Crack it once and you're into the whole system.

    That be bad.

    For the 'nefarious' types it won't have much impact at all, because such will be using multiple layers of multiple encryption techniques. The encrypted data will itself be hidden in non obvious places, like embeded in a minor .gif on a website or embeded in something as inocuous as a laundry list, and when decoded will be in 'code' anyway, such as " The eagle flies at midnight,' for which an actual key code is inherently neccessary.

    To sum up, if the NP problem is solvable electronic money transfers and your e-mail are inherently insecure, but terrorists, at least the smart ones, still will be.

    That won't stop the FBI from playing the terrorist card to snoop YOUR e-mail though.
  • I went to a talk on Kaye's work this evening at Harvard. The fact that Minesweeper boards can be used to make Turing machines is why Minesweeper consistency is an NP problem. One can define logic circuits in Minesweeper that function as complex concatenations of Boolean gates. Since solving the output of such a machine is an NP problem, so is solving the consistency of a Minesweeper board. Minesweeper logic gates are fascinating:

    Here's a representation of a wire in Minesweeper:

    . . . 111111111111111111111 . . .
    . . . xy1xy1xy1xy1xy1xy1xy1 . . .
    . . . 111111111111111111111 . . .

    Basically, if you place a mine under either the x or the y spot at one end of the wire, the rules of Minesweeper force a mine to appear under _each_ x or y all along the wire -- in other words, a binary digit propagating along the wire! The paper also describes how to make NOT and AND gates, and from such components computers can be built.

    Chris

  • So.... does this mean all I have to do to break any encryption is type "XYZZY<shift>"?
  • That is, unless the worst case scenarios are easy to identify, in which case, you'd only pick those keys.
    --
  • Ummm...I confused. Say there is 1 mine hidden on a 10x10 grid. To start I have absolutely zero information about where that mine is. Therefore I must guess at the location. Therefore, 1/100th of the time, I will be wrong on the first guess. Therefore it is impossible to "solve" the game, because you cannot say "You will always win if you start by making move x..." See what I mean? For any "solution" you provide, couldn't I in theory hit a mine on my first attempt and thus not win?

    Isn't it? What am I missing?

  • Actually, a large set of NP problems become immediately solvable, because people have developed linear time translations between the problems. So if you can solve minesweeper consistency, you can just translate whichever NP problem you are interested in into minesweeper consistency (very fast) and then solve minesweeper consistency, and translate the solution back.
  • Yes. Pages 94-95 of the October issue of Scientific American has a very good article about Mindsweeper and P vs. NP. unfortunatly the article is not available online at sciam.com
  • Just to test, I just fired up minesweeper and started clicking. On about my 20th try, my first click was a bomb.

    Sorry.

  • Dumb question, but couldn't a really, really, really fast monkey with a calculator theoretically take a 1000 bit number and start at 1 and work his way up, checking if each is a factor? If he was fast enough, he could do it in a second.

    -Erik
  • They described (with pictures) how this Minesweeper thing works, something about OR gates ... possible and impossible configurations ... much more informative than boston.com's article. However, I don't have the magazine ...
  • The first square chosen MUST be random. There are no clues as to what may lie under the first square clicked. This implies that there is always *some* chance that even an otherwise perfect algorythm may fail.

    IMHO this implies that the analogy of minesweeper to P vs NP is a very good choice.

  • by unDees ( 116113 ) on Wednesday November 01, 2000 @10:12AM (#657319)
    Just think--MCSE certification will finally be worth something ("SSL? What's that? I just know I click on the little happy face icon and get a brand new life.").

    And those who get caught screwing around on company time can tell their bosses, "I was just evaluating our encryption strategy."

  • As an occasional player (I don't find it addictive at all!), I have to say the most important move is the first move, and that the second move always involves guesswork also. If the first move uncovers a "1," I try a second move on an adjacent square (which has a 7 in 8 chance of not blowing up). If I haven't uncovered a "1," I usually click on a second random square, hoping for a "1."

    Sometimes after the second or third move the game becomes completely soluble by logic alone, but sometimes the configuration is such that yet another random move is necessary quite late in (more than halfway into) the game. That's why I don't believe Minesweeper is in principle soluble through logic.

    On the other hand, I find Freecell fascinating, and keep trying to work out algorithms to solve each game first time through. There's a principle similar to the Hippocratic oath ("first, do no harm") which seems to work pretty well! It translates roughly into, "Can I see how to get back to the same number of free cells after this move?"

    Wasn't there, in _Cryptonomicron_, a very careful and thorough explanation of the problem of (algorithmic) solubility/non-solubility? I found that explanation (which wasn't exactly exploring P/NP) very useful.

  • Just a second... maybe that's the point! Any encryption can be broken with sufficient random clicking. :-)

    Well, yes. This is called brute force. Of course most of the time it's easy to think of brute force being a sequential trial of everything in the keyspace, but it doesn't have to be (although that guarantees you try every key only once).

    Suffecient would be the trick. :)

  • by xonix7 ( 227592 ) on Wednesday November 01, 2000 @11:18AM (#657331) Homepage

    The simple truth of the problem is that there is no one answer to it...

    Not many people have a firm grasp of what this problem is really all about. Sure, you'll study it in your B.Sc or B.Tech...but really, even graduates fail to grasp some key concepts, although they study the tougher concepts....basically, this is how it goes:

    P is the set of problems that can be solved in deterministic polynomial time. That means for a problem with inputs of size N, there must be some way to solve the problem in F(N) steps for some polynomial F. F can be any polynomial, even N to the 10 millionth power.

    NP is the set of problems you can solve in non-deterministic polynomial time. That means for a problem with inputs of size N, there must be some way to solve the problem in F(N) steps for some polynomial F just as before. In NP, however, the student is allowed to make lucky guesses, though it must prove the solution is correct. The standard format for a program in NP is: Guess the answer. Verify that the answer is correct in polynomial time. For example, factoring is in NP. Suppose you have a number A that you want to break into two factors. The NP program is: Guess factors P and Q. Multiply P times Q and verify that the results is A. This takes only two non-deterministic steps so the problem is in NP. Therefore, considering the differences between the two and the estimation involved, how is it possible to prove something like this?

    You can't "prove this". You can't disprove it either, but that's not the point - minesweeper is not going to help you with this.

  • Uh, why would it be NP ?

    The complexity of checking a board of x columns by y rows is 8*x*y (8 because you need to check the 8 adjacent positions for every position). And I can see some algorithms faster than that by using rolling sums...

    Or am I missing something here ?

  • damn that should have read "...the analogy of minesweeper to P vs NP is a *not* very good choice."

    Sorry 'bout that.

  • by VSarkiss ( 173815 ) on Wednesday November 01, 2000 @10:15AM (#657343)
    Proving the conjecture false would mean that modern encryption technology, the foundation of electronic commerce, would be open to easy attack.

    Wrong. It would do nothing of the kind. Proving Riemann's Zeta hypothesis would do that.

    Even if you proved prime factorization of large numbers can be done in polynomial time, you would need an algorithm that accomplished it in a reasonable amount of time (seconds). An algorithm that had time complexity O(n^100) would still be polynomial, but useless in practice.

Avoid strange women and temporary variables.

Working...