B4J Question Mines Game Helper

Francisco Gonzalez 1962

Member
Licensed User
Hello, I want to build a program to help me when I'm stuck playing mines games.

I like playing a free version of the mines game called Clever Mines (https://sourceforge.net/projects/miny/) with triangle/square cells and several difficulty levels:

Clever%20Mines%2020200318.png



Here I'm stuck and to go ahead I want to have a program to help me by capturing the screen area of the game as a picture and then letting me click in the cells that I want to analyze adding the boolean unknowns symbols like this:

Clever%20Mines%2020200318%20id.png




Once I'm finished entering unknowns, the program should prompt me to enter the equations to be solved and insert them in a list:
EQ01: a+b+c+h+i+j+k=3
EQ02: a+b+c+d+e+i+k=3
EQ03: c+d+e+k=2
EQ04: c+d+e+f=2
EQ05: e+f=1
EQ06: g+h+j+l=1
EQ07: g+h+i+j+k+l=2
EQ08: j+k=1
EQ09: j+l+m+n=2
EQ10: j+k+l+n=2
EQ11: l+n=1
EQ12: l+m+n+o=2
EQ13: m+n+o+q=2
EQ14: p+q+r+s=2
EQ15: q+r=1
EQ16: r+s=1

And the inequation with the maximum number of mines still not found:

Clever%20Mines%2020200318%20remains.png

EQ17: a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s<=8


When all equations are entered the program should loop 2 ^ (Number of unknowns) to find the unknown values that solve all the equations:

idx____a b c d e f g h i j k l m n o p q r s
--------------------------------------------
189204 0 0 1 0 1 0 0 0 1 1 0 0 0 1 1 1 0 1 0
334885 1 0 1 0 0 1 0 0 0 0 1 1 1 0 0 0 1 0 1
334886 0 1 1 0 0 1 0 0 0 0 1 1 1 0 0 0 1 0 1




And finding the unknowns that only present one value:

idx____a b c d e f g h i j k l m n o p q r s
--------------------------------------------
189204 0 0 1 0 1 0 0 0 1 1 0 0 0 1 1 1 0 1 0
334885 1 0 1 0 0 1 0 0 0 0 1 1 1 0 0 0 1 0 1
334886 0 1 1 0 0 1 0 0 0 0 1 1 1 0 0 0 1 0 1


All the solutions show that c cell hides a mine (c=1) and d, g and h cells are empty (d=0, g=0, h=0).

So I mark c cell and click on d, g and h cells in the game:

Clever%20Mines%2020200318%20after%201.png


And I go ahead until I finish the game:

Clever%20Mines%2020200318%20end.png


I'm thinking in a program GUI similar to this mockup:

mockup2.png


I'll try using B4J to complete this idea and I'll post advances and problems here.
If you have comments, please post in the thread, my knowledge of B4J is quite small and probably I'm biting too much...

Cheers

Francisco
 
Last edited:
Top