• Create Account

Posted 12 April 2013 - 11:10 AM

I'm saying it doesn't matter which order you remove safe squares, since you always remove just 1 each time unless you get lucky and remove one with no neighbouring mines... unless you look for squares to remove which may have no neighbouring mines first.

What you do want to do is look at the cases with least number of safe or unsafe squares first though (so all 2's with 3 unopened neighbours before 2's with 4 unopened neighbours), you need a method to flag a set of squares as having a mine and then evaluate the board to see if it causes a contradiction. You need to try all combinations of flagged squares and if you don't find a contradiction look somewhere else.

To generate the set of possible mined squares you need to generate combinations (e.g. I have 3 squares to check and 2 mines, possibilities are {1, 2}, {1, 3}, {2, 3}), you need to know about combinations and permutations to do that...

Posted 12 April 2013 - 11:05 AM

I'm saying it doesn't matter which order you remove safe squares, since you always remove just 1 each time unless you get lucky and remove one with no neighbouring mines... unless you look for squares to remove which may have no neighbouring mines first.

What you do want to do is look at the cases with least number of safe or unsafe squares first though (so all 2's with 3 unopened neighbours before 2's with 4 unopened neighbours), you need a method to flag a set of squares as having a mine and then evaluate the board to see if it causes a contradiction. You need to try all combinations of flagged squares and if you don't find a contradiction look somewhere else.

To generate the set of possible mined squares you need to generate combinations (e.g. I have 3 squares to check and 2 mines, possibilities are {1, 2}, {1, 3}, {2, 3}), you need to know about combinations and permutations to do that... (EDIT: std::next_permutation will do the job in C++)

Posted 12 April 2013 - 11:01 AM

I'm saying it doesn't matter which order you remove safe squares, since you always remove just 1 each time unless you get lucky and remove one with no neighbouring mines... unless you look for squares to remove which may have no neighbouring mines first.

What you do want to do is look at the cases with least number of safe or unsafe squares first though (so all 2's with 3 unopened neighbours before 2's with 4 unopened neighbours), you need a method to flag a set of squares as having a mine and then evaluate the board to see if it causes a contradiction. You need to try all combinations of flagged squares and if you don't find a contradiction look somewhere else.

To generate the set of possible mined squares you need to generate combinations (e.g. I have 3 squares to check and 2 mines, possibilities are {1, 2}, {1, 3}, {2, 3}), you need to know about combinations and permutations to do that...

PARTNERS