Minesweeper
Click the flag checkbox to begin placing flags
🚩
⌛ 0:00
bombs left:
white
black
0
0
cell(0,0,u) cell(0,1,u) cell(0,2,u) cell(0,3,u) cell(0,4,u) cell(0,5,u) cell(0,6,u) cell(0,7,u) cell(0,8,u) cell(0,9,u) cell(0,10,u) cell(0,11,u) cell(0,12,u) cell(0,13,u) cell(0,14,u) cell(1,0,u) cell(1,1,u) cell(1,2,u) cell(1,3,u) cell(1,4,u) cell(1,5,u) cell(1,6,u) cell(1,7,u) cell(1,8,u) cell(1,9,u) cell(1,10,u) cell(1,11,u) cell(1,12,u) cell(1,13,u) cell(1,14,u) cell(2,0,u) cell(2,1,u) cell(2,2,u) cell(2,3,u) cell(2,4,u) cell(2,5,u) cell(2,6,u) cell(2,7,u) cell(2,8,u) cell(2,9,u) cell(2,10,u) cell(2,11,u) cell(2,12,u) cell(2,13,u) cell(2,14,u) cell(3,0,u) cell(3,1,u) cell(3,2,u) cell(3,3,u) cell(3,4,u) cell(3,5,u) cell(3,6,u) cell(3,7,u) cell(3,8,u) cell(3,9,u) cell(3,10,u) cell(3,11,u) cell(3,12,u) cell(3,13,u) cell(3,14,u) cell(4,0,u) cell(4,1,u) cell(4,2,u) cell(4,3,u) cell(4,4,u) cell(4,5,u) cell(4,6,u) cell(4,7,u) cell(4,8,u) cell(4,9,u) cell(4,10,u) cell(4,11,u) cell(4,12,u) cell(4,13,u) cell(4,14,u) cell(5,0,u) cell(5,1,u) cell(5,2,u) cell(5,3,u) cell(5,4,u) cell(5,5,u) cell(5,6,u) cell(5,7,u) cell(5,8,u) cell(5,9,u) cell(5,10,u) cell(5,11,u) cell(5,12,u) cell(5,13,u) cell(5,14,u) cell(6,0,u) cell(6,1,u) cell(6,2,u) cell(6,3,u) cell(6,4,u) cell(6,5,u) cell(6,6,u) cell(6,7,u) cell(6,8,u) cell(6,9,u) cell(6,10,u) cell(6,11,u) cell(6,12,u) cell(6,13,u) cell(6,14,u) cell(7,0,u) cell(7,1,u) cell(7,2,u) cell(7,3,u) cell(7,4,u) cell(7,5,u) cell(7,6,u) cell(7,7,u) cell(7,8,u) cell(7,9,u) cell(7,10,u) cell(7,11,u) cell(7,12,u) cell(7,13,u) cell(7,14,u) cell(8,0,u) cell(8,1,u) cell(8,2,u) cell(8,3,u) cell(8,4,u) cell(8,5,u) cell(8,6,u) cell(8,7,u) cell(8,8,u) cell(8,9,u) cell(8,10,u) cell(8,11,u) cell(8,12,u) cell(8,13,u) cell(8,14,u) cell(9,0,u) cell(9,1,u) cell(9,2,u) cell(9,3,u) cell(9,4,u) cell(9,5,u) cell(9,6,u) cell(9,7,u) cell(9,8,u) cell(9,9,u) cell(9,10,u) cell(9,11,u) cell(9,12,u) cell(9,13,u) cell(9,14,u) cell(10,0,u) cell(10,1,u) cell(10,2,u) cell(10,3,u) cell(10,4,u) cell(10,5,u) cell(10,6,u) cell(10,7,u) cell(10,8,u) cell(10,9,u) cell(10,10,u) cell(10,11,u) cell(10,12,u) cell(10,13,u) cell(10,14,u) cell(11,0,u) cell(11,1,u) cell(11,2,u) cell(11,3,u) cell(11,4,u) cell(11,5,u) cell(11,6,u) cell(11,7,u) cell(11,8,u) cell(11,9,u) cell(11,10,u) cell(11,11,u) cell(11,12,u) cell(11,13,u) cell(11,14,u) cell(12,0,u) cell(12,1,u) cell(12,2,u) cell(12,3,u) cell(12,4,u) cell(12,5,u) cell(12,6,u) cell(12,7,u) cell(12,8,u) cell(12,9,u) cell(12,10,u) cell(12,11,u) cell(12,12,u) cell(12,13,u) cell(12,14,u) cell(13,0,u) cell(13,1,u) cell(13,2,u) cell(13,3,u) cell(13,4,u) cell(13,5,u) cell(13,6,u) cell(13,7,u) cell(13,8,u) cell(13,9,u) cell(13,10,u) cell(13,11,u) cell(13,12,u) cell(13,13,u) cell(13,14,u) cell(14,0,u) cell(14,1,u) cell(14,2,u) cell(14,3,u) cell(14,4,u) cell(14,5,u) cell(14,6,u) cell(14,7,u) cell(14,8,u) cell(14,9,u) cell(14,10,u) cell(14,11,u) cell(14,12,u) cell(14,13,u) cell(14,14,u) started(0) flagOn(0) numClicked(0) seconds(345) won(0) theme("#fffff6","#dedede","#dedede") loadGame(0)
attribute(B, onclick, "modbutton(this)") :- board(B) attribute(mark(X,Y), onclick, "modbutton(this)") select(flag,Y) :: holds(flag,Y) & ~flagOn(0) & flagOn(1) deselect(flag,Y) :: ~holds(flag,Y) & ~flagOn(1) & flagOn(0) click(mark(X,Y)) :: flagOn(0) & ~started(0) & won(0) & inBounds(X,Y) & cell(X,Y,u) & evaluate(countofall(A,neighbor(A,X,Y,bomb)),B) & evaluate(countofall(C,neighbor(C,X,Y,flagBomb)),D) & evaluate(plus(B,D),T) & numClicked(G) & evaluate(plus(G,1),H) ==> markSquare(X,Y,u,T) & ~numClicked(G) & numClicked(H) & checkWin(H) click(mark(X,Y)) :: flagOn(0) & ~started(0) & won(0) & inBounds(X,Y) & cell(X,Y,bomb) ==> ~cell(X,Y,Q) & cell(X,Y,lost) & ~started(S) & started(0) & ~won(0) & won(-1) & colorBombs("#fc0f03") & style(mark(X,Y),"backgroundColor","#9e0909") markSquare(X,Y,Z,T) :: distinct(T,0) ==> ~cell(X,Y,Z) & cell(X,Y,T) & style(mark(X,Y),"font-family","garamond") & setFont(X,Y) markSquare(X,Y,Z,T) :: same(T,0) ==> style(mark(X,Y),"backgroundColor","#aaaaaa") & ~cell(X,Y,Z) & cell(X,Y,0) & setFont(X,Y) checkWin(H) :: started(1) & evaluate(H,71) ==> ~won(0) & won(1) & colorBombs("#41fc03") checkWin(H) :: started(2) & evaluate(H,149) ==> ~won(0) & won(1) & colorBombs("#41fc03") checkWin(H) :: started(3) & evaluate(H,190) ==> ~won(0) & won(1) & colorBombs("#41fc03") click(mark(X,Y)) :: flagOn(1) & ~started(0) & won(0) & inBounds(X,Y) & cell(X,Y,u) ==> ~cell(X,Y,u) & cell(X,Y,flag) & setFont(X,Y) click(mark(X,Y)) :: flagOn(1) & ~started(0) & won(0) & inBounds(X,Y) & cell(X,Y,bomb) ==> ~cell(X,Y,bomb) & cell(X,Y,flagBomb) & setFont(X,Y) click(mark(X,Y)) :: flagOn(1) & ~started(0) & won(0) & inBounds(X,Y) & cell(X,Y,flag) ==> ~cell(X,Y,flag) & cell(X,Y,u) & setFont(X,Y) click(mark(X,Y)) :: flagOn(1) & ~started(0) & won(0) & inBounds(X,Y) & cell(X,Y,flagBomb) ==> ~cell(X,Y,flagBomb) & cell(X,Y,bomb) & setFont(X,Y) click(easy) :: started(0) & same(S,3) & same(W,8) & getRandomNumbers(A,B,S,W) ==> setSize(1) & ~started(0) & started(1) & init(A,B,0,9,[],S,W) & restartColor & setPlayButtons click(medium) :: started(0) & same(S,1) & same(W,12) & getRandomNumbers(A,B,S,W) ==> setSize(2) & ~started(0) & started(2) & init(A,B,0,19,[],S,W) & restartColor & setPlayButtons click(hard) :: started(0) & same(S,0) & same(W,14) & getRandomNumbers(A,B,S,W) ==> setSize(3) & ~started(0) & started(3) & init(A,B,0,34,[],S,W) & restartColor & setPlayButtons click(restart) :: started(S) & seconds(T) & numClicked(G) ==> ~flagOn(1) & flagOn(0) & ~holds(flag,flag) & ~started(S) & started(0) & ~seconds(T) & seconds(0) & restart & setSize(2) & ~won(-1) & ~won(1) & won(0) & ~numClicked(G) & numClicked(0) & setStartButtons restart :: cell(X,Y,Z) & ~style(mark(X,Y),"backgroundColor",C) & theme(C1,C2,C3) ==> ~innerhtml(mark(X,Y),I) & innerhtml(mark(X,Y),"") & ~cell(X,Y,Z) & cell(X,Y,u) & changeColor(X,Y,C2,C3) restart :: cell(X,Y,Z) & style(mark(X,Y),"backgroundColor",C) & theme(C1,C2,C3) ==> ~innerhtml(mark(X,Y),I) & innerhtml(mark(X,Y),"") & ~cell(X,Y,Z) & cell(X,Y,u) & changeColor(X,Y,C2,C3) & ~style(mark(X,Y),"backgroundColor",C) restartColor :: cell(X,Y,Z) & ~style(mark(X,Y),"backgroundColor",C) & theme(C1,C2,C3) ==> ~innerhtml(mark(X,Y),I) & innerhtml(mark(X,Y),"") & changeColor(X,Y,C2,C3) restartColor :: cell(X,Y,Z) & style(mark(X,Y),"backgroundColor",C) & theme(C1,C2,C3) ==> ~innerhtml(mark(X,Y),I) & innerhtml(mark(X,Y),"") & changeColor(X,Y,C2,C3) & ~style(mark(X,Y),"backgroundColor",C) changeColor(X,Y,C1,C2) :: evaluate(quotient(plus(X,Y),2),K) & evaluate(floor(K),K) ==> style(mark(X,Y),"backgroundColor",C1) changeColor(X,Y,C1,C2) :: evaluate(quotient(plus(X,Y),2),K) & ~evaluate(floor(K),K) ==> style(mark(X,Y),"backgroundColor",C2) setPlayButtons :: style(easy,"opacity",U) & style(medium,"opacity",X) & style(hard,"opacity",Y) & style(hard,width,Z) & style(restart,"opacity",M) ==> ~style(easy,"opacity",1) & ~style(medium,"opacity",1) & ~style(hard,"opacity",1) & ~style(hard,width,Z) & ~style(restart,"opacity",0) & style(easy,"opacity",0) & style(medium,"opacity",0) & style(hard,"opacity",0) & style(hard,width,133) & style(restart,"opacity",1) setPlayButtons :: ~style(easy,"opacity",U) & ~style(medium,"opacity",X) & ~style(hard,"opacity",Y) & ~style(hard,width,Z) & ~style(restart,"opacity",M) ==> style(easy,"opacity",0) & style(medium,"opacity",0) & style(hard,"opacity",0) & style(hard,width,133) & style(restart,"opacity",1) setStartButtons :: style(easy,"opacity",U) & style(medium,"opacity",X) & style(hard,"opacity",Y) & style(hard,width,Z) & style(restart,"opacity",M) ==> ~style(easy,"opacity",0) & ~style(medium,"opacity",0) & ~style(hard,"opacity",0) & ~style(hard,width,Z) & ~style(restart,"opacity",1) & style(easy,"opacity",1) & style(medium,"opacity",1) & style(hard,"opacity",1) & style(hard,width,70) & style(restart,"opacity",0) setStartButtons :: ~style(easy,"opacity",U) & ~style(medium,"opacity",X) & ~style(hard,"opacity",Y) & ~style(hard,width,Z) & ~style(restart,"opacity",M) ==> style(easy,"opacity",1) & style(medium,"opacity",1) & style(hard,"opacity",1) & style(hard,width,70) & style(restart,"opacity",0) setSize(1) :: cell(X,Y,Z) & ~checkBounds(X,Y,3,11) & style(mark(X,Y),"width",W) & style(mark(X,Y),"height",H) ==> style(mark(X,Y),"width",0) & ~style(mark(X,Y),"width",W) & style(mark(X,Y),"height",0) & ~style(mark(X,Y),"height",H) & style(mark(X,Y),"opacity",0) & ~style(mark(X,Y),"opacity",1) setSize(1) :: cell(X,Y,Z) & checkBounds(X,Y,3,11) & style(mark(X,Y),"width",W) & style(mark(X,Y),"height",H) ==> style(mark(X,Y),"width",48) & ~style(mark(X,Y),"width",W) & style(mark(X,Y),"height",48) & ~style(mark(X,Y),"height",H) & style(mark(X,Y),"opacity",1) & ~style(mark(X,Y),"opacity",0) setSize(1) :: cell(X,Y,Z) & ~checkBounds(X,Y,3,11) & ~style(mark(X,Y),"width",W) & ~style(mark(X,Y),"height",H) ==> style(mark(X,Y),"width",0) & style(mark(X,Y),"height",0) & style(mark(X,Y),"opacity",0) & ~style(mark(X,Y),"opacity",1) setSize(1) :: cell(X,Y,Z) & checkBounds(X,Y,3,11) & ~style(mark(X,Y),"width",W) & ~style(mark(X,Y),"height",H) ==> style(mark(X,Y),"width",48) & style(mark(X,Y),"height",48) & style(mark(X,Y),"opacity",1) & ~style(mark(X,Y),"opacity",0) setSize(2) :: cell(X,Y,Z) & ~checkBounds(X,Y,1,13) & style(mark(X,Y),"width",W) & style(mark(X,Y),"height",H) ==> style(mark(X,Y),"width",0) & ~style(mark(X,Y),"width",W) & style(mark(X,Y),"height",0) & ~style(mark(X,Y),"height",H) & style(mark(X,Y),"opacity",0) & ~style(mark(X,Y),"opacity",1) setSize(2) :: cell(X,Y,Z) & checkBounds(X,Y,1,13) & style(mark(X,Y),"width",W) & style(mark(X,Y),"height",H) ==> ~style(mark(X,Y),"width",W) & style(mark(X,Y),"width",36) & ~style(mark(X,Y),"height",H) & style(mark(X,Y),"height",36) & style(mark(X,Y),"opacity",1) & ~style(mark(X,Y),"opacity",0) setSize(2) :: cell(X,Y,Z) & ~checkBounds(X,Y,1,13) & ~style(mark(X,Y),"width",W) & ~style(mark(X,Y),"height",H) ==> style(mark(X,Y),"width",0) & style(mark(X,Y),"height",0) & style(mark(X,Y),"opacity",0) & ~style(mark(X,Y),"opacity",1) setSize(2) :: cell(X,Y,Z) & checkBounds(X,Y,1,13) & ~style(mark(X,Y),"width",W) & ~style(mark(X,Y),"height",H) ==> style(mark(X,Y),"width",36) & style(mark(X,Y),"height",36) & style(mark(X,Y),"opacity",1) & ~style(mark(X,Y),"opacity",0) setSize(3) :: cell(X,Y,Z) & style(mark(X,Y),"width",W) & style(mark(X,Y),"height",H) ==> style(mark(X,Y),"width",33) & ~style(mark(X,Y),"width",W) & style(mark(X,Y),"height",33) & ~style(mark(X,Y),"height",H) & style(mark(X,Y),"opacity",1) & ~style(mark(X,Y),"opacity",0) setSize(3) :: cell(X,Y,Z) & ~style(mark(X,Y),"width",W) & ~style(mark(X,Y),"height",H) ==> style(mark(X,Y),"width",33) & style(mark(X,Y),"height",33) & ~style(mark(X,Y),"opacity",0) & style(mark(X,Y),"opacity",1) setFont(X,Y) :: started(1) ==> ~style(mark(X,Y),"font-size","20px") & ~style(mark(X,Y),"font-size","23px") & style(mark(X,Y),"font-size","25px") setFont(X,Y) :: started(2) ==> ~style(mark(X,Y),"font-size","25px") & ~style(mark(X,Y),"font-size","20px") & style(mark(X,Y),"font-size","23px") setFont(X,Y) :: started(3) ==> ~style(mark(X,Y),"font-size","23px") & ~style(mark(X,Y),"font-size","25px") & style(mark(X,Y),"font-size","20px") tick :: ~started(0) & seconds(T) & evaluate(plus(T,1),N) ==> ~seconds(T) & seconds(N) & setTime(N) & displayTime(N) setTime(T) :: math(T,M,S) & evaluate(max(S,9),9) & evaluate(stringappend("⌛",M,":0",S),X) ==> innerhtml(time,X) setTime(T) :: math(T,M,S) & evaluate(min(S,10),10) & evaluate(stringappend("⌛",M,":",S),X) ==> innerhtml(time,X) math(T,M,S) :- evaluate(floor(quotient(T,60)),M) & evaluate(minus(T,imul(M,60)),S) %% because why not... displayTime(X) :: seconds(T) & math(T,M,S) & evaluate(max(S,9),9) & evaluate(stringappend("⌛",M,":0",S),X) ==> innerhtml(time,X) displayTime(X) :: seconds(T) & math(T,M,S) & evaluate(min(S,10),10) & evaluate(stringappend("⌛",M,":",S),X) ==> innerhtml(time,X) colorBombs(C) :: cell(X,Y,bomb) ==> style(mark(X,Y),"backgroundColor",C) & setFont(X,Y) colorBombs(C) :: cell(X,Y,flagBomb) ==> style(mark(X,Y),"backgroundColor",C) & ~cell(X,Y,Q) & cell(X,Y,bomb) & setFont(X,Y) init(X,Y,N,W,L,F,S) :: evaluate(max(N,W),W) & evaluate(plus(N,1),M) & ~checkList(X,Y,L) & cell(X,Y,Z) & evaluate(append(L,[X,Y]),L2) & getRandomNumbers(A,B,F,S) ==> ~cell(X,Y,Z) & cell(X,Y,bomb) & init(A,B,M,W,L2,F,S) init(X,Y,N,W,L,F,S) :: evaluate(max(N,W),W) & checkList(X,Y,L) & getRandomNumbers(A,B,F,S) ==> init(A,B,N,W,L,F,S) getRandomNumbers(A,B,F,S) :- evaluate(plus(round(times(random(),S)),F),A) & evaluate(plus(round(times(random(),S)),F),B) neighbor(A,X,Y,T) :- same(A,1) & evaluate(plus(X,1),M) & cell(M,Y,T) neighbor(A,X,Y,T) :- same(A,2) & evaluate(plus(X,-1),M) & cell(M,Y,T) neighbor(A,X,Y,T) :- same(A,3) & evaluate(plus(Y,1),N) & cell(X,N,T) neighbor(A,X,Y,T) :- same(A,4) & evaluate(plus(Y,-1),N) & cell(X,N,T) neighbor(A,X,Y,T) :- same(A,5) & evaluate(plus(X,1),M) & evaluate(plus(Y,1),N) & cell(M,N,T) neighbor(A,X,Y,T) :- same(A,6) & evaluate(plus(X,-1),M) & evaluate(plus(Y,1),N) & cell(M,N,T) neighbor(A,X,Y,T) :- same(A,7) & evaluate(plus(X,1),M) & evaluate(plus(Y,-1),N) & cell(M,N,T) neighbor(A,X,Y,T) :- same(A,8) & evaluate(plus(X,-1),M) & evaluate(plus(Y,-1),N) & cell(M,N,T) checkZero(X,Y,L,R) :- ~checkList(X,Y,L) & inBounds(X,Y) & cell(X,Y,u) & evaluate(countofall(A,neighbor(A,X,Y,bomb)),0) & evaluate(plus(X,1),M1) & evaluate(plus(Y,1),N1) & evaluate(minus(X,1),M2) & evaluate(minus(Y,1),N2) & evaluate(append([X,Y],L),L2) & checkZero(M1,Y,L2,R1) & checkZero(X,N1,R1,R2) & checkZero(M2,Y,R2,R3) & checkZero(X,N2,R3,R) checkZero(X,Y,L,X!Y!L) :- ~checkList(X,Y,L) & inBounds(X,Y) & cell(X,Y,u) & evaluate(countofall(A,neighbor(A,X,Y,bomb)),D) & distinct(D,0) checkZero(X,Y,L,L) :- ~inBounds(X,Y) checkZero(X,Y,L,L) :- checkList(X,Y,L) checkZero(X,Y,L,L) :- ~cell(X,Y,u) checkList(X,Y,A!B!L) :- same(X,A) & same(Y,B) checkList(X,Y,A!B!L) :- checkList(X,Y,L) getBombs(R) :- evaluate(countofall([A,B],cell(A,B,bomb)),B) & evaluate(countofall([C,D],cell(C,D,flag)),F) & evaluate(minus(B,F),R) inBounds(A,B) :- started(0) & checkBounds(A,B,1,13) inBounds(A,B) :- started(1) & checkBounds(A,B,3,11) inBounds(A,B) :- started(2) & checkBounds(A,B,1,13) inBounds(A,B) :- started(3) getOuside(R) :- started(0) & same(R,56) getOuside(R) :- started(1) & same(R,144) getOuside(R) :- started(2) & same(R,56) getOuside(R) :- started(3) & same(R,0) checkBounds(A,B,MIN,MAX) :- evaluate(min(A,MIN),MIN) & evaluate(max(A,MAX),MAX) & evaluate(min(B,MIN),MIN) & evaluate(max(B,MAX),MAX) innerhtml(mark(A,B),X) :- cell(A,B,X) & distinct(X,bomb) & distinct(X,u) & distinct(X,0) & distinct(X,lost) innerhtml(mark(A,B),"🚩") :- cell(A,B,flag) & inBounds(A,B) innerhtml(mark(A,B),"🚩") :- cell(A,B,flagBomb) innerhtml(mark(A,B),"") :- cell(A,B,u) innerhtml(mark(A,B),"") :- cell(A,B,bomb) & won(0) innerhtml(mark(A,B),"💣") :- won(1) & cell(A,B,flagBomb) innerhtml(mark(A,B),"💣") :- cell(A,B,bomb) & ~won(0) innerhtml(instruct,X) :- won(0) & started(0) & evaluate("Choose a level of difficulty to begin",X) innerhtml(instruct,X) :- won(-1) & started(0) & evaluate("Click 'restart' to try again (maybe try an easier level?)",X) innerhtml(instruct,X) :- won(1) & started(0) & evaluate("Click 'restart' to play again",X) innerhtml(instruct,X) :- ~started(0) & evaluate("Click the flag checkbox to begin placing flags",X) innerhtml(bombs,X) :- won(0) & started(0) & evaluate("",X) innerhtml(bombs,X) :- won(0) & ~started(0) & getBombs(R) & evaluate(stringappend("Bombs left: ",R),X) innerhtml(bombs,X) :- won(1) & evaluate("You won!",X) innerhtml(bombs,X) :- won(-1) & evaluate("You lost ðŸ˜ðŸ’£",X) innerhtml(levelText,X) :- started(1) & evaluate("Easy Mode",X) innerhtml(levelText,X) :- started(2) & evaluate("Medium Mode",X) innerhtml(levelText,X) :- started(3) & evaluate("Hard Mode",X) innerhtml(levelText,"") :- started(0) select(pagecolor,X) :: theme(A,B,C) & same(X,white) & value(pagecolor,Y) & style(page,"backgroundColor",K) ==> ~value(pagecolor,Y) & value(pagecolor,X) & ~theme(A,B,C) & theme("#ffffff","#e3d4ff","#c3b1e6") & changeBackgrounds("#e3d4ff","#c3b1e6") & ~style(page,"backgroundColor",K) & style(page,"backgroundColor","#ffffff") select(pagecolor,X) :: theme(A,B,C) & same(X,white) & value(pagecolor,Y) & ~style(page,"backgroundColor",K) ==> ~value(pagecolor,Y) & value(pagecolor,X) & ~theme(A,B,C) & theme("#ffffff","#e3d4ff","#c3b1e6") & changeBackgrounds("#e3d4ff","#c3b1e6") & style(page,"backgroundColor","#ffffff") select(pagecolor,X) :: theme(A,B,C) & same(X,orange) & value(pagecolor,Y) & style(page,"backgroundColor",K) ==> ~value(pagecolor,Y) & value(pagecolor,X) & ~theme(A,B,C) & theme("#ff9b33","#b8cfd6","#d3e3e8") & changeBackgrounds("#b8cfd6","#d3e3e8") & ~style(page,"backgroundColor",K) & style(page,"backgroundColor","#ff9b33") select(pagecolor,X) :: theme(A,B,C) & same(X,orange) & value(pagecolor,Y) & ~style(page,"backgroundColor",K) ==> ~value(pagecolor,Y) & value(pagecolor,X) & ~theme(A,B,C) & theme("#ff9b33","#b8cfd6","#d3e3e8") & changeBackgrounds("#b8cfd6","#d3e3e8") & style(page,"backgroundColor","#ff9b33") select(pagecolor,X) :: theme(A,B,C) & same(X,blue) & value(pagecolor,Y) & style(page,"backgroundColor",K) ==> ~value(pagecolor,Y) & value(pagecolor,X) & ~theme(A,B,C) & theme("#4a83ed","#f5bc7f","#ffd8ad") & changeBackgrounds("#f5bc7f","#ffd8ad") & ~style(page,"backgroundColor",K) & style(page,"backgroundColor","#4a83ed") select(pagecolor,X) :: theme(A,B,C) & same(X,blue) & value(pagecolor,Y) & ~style(page,"backgroundColor",K) ==> ~value(pagecolor,Y) & value(pagecolor,X) & ~theme(A,B,C) & theme("#4a83ed","#f5bc7f","#ffd8ad") & changeBackgrounds("#f5bc7f","#ffd8ad") & style(page,"backgroundColor","#4a83ed") select(pagecolor,X) :: theme(A,B,C) & same(X,plain) & value(pagecolor,Y) & style(page,"backgroundColor",K) ==> ~value(pagecolor,Y) & value(pagecolor,X) & ~theme(A,B,C) & theme("#fffff6","#dedede","#dedede") & changeBackgrounds("#dedede","#dedede") & ~style(page,"backgroundColor",K) & style(page,"backgroundColor","#fffff6") select(pagecolor,X) :: theme(A,B,C) & same(X,plain) & value(pagecolor,Y) & ~style(page,"backgroundColor",K) ==> ~value(pagecolor,Y) & value(pagecolor,X) & ~theme(A,B,C) & theme("#fffff6","#dedede","#dedede") & changeBackgrounds("#dedede","#dedede") & style(page,"backgroundColor","#fffff6") value(pagecolor,plain) :- theme("#fffff6",Y,Z) value(pagecolor,white) :- theme("#ffffff",Y,Z) value(pagecolor,orange) :- theme("#ff9b33",Y,Z) value(pagecolor,blue) :- theme("#4a83ed",Y,Z) changeBackgrounds(C1,C2) :: cell(X,Y,Z) & distinct(Z,0) & won(0) & style(mark(X,Y),"backgroundColor",C) ==> changeColor(X,Y,C1,C2) & ~style(mark(X,Y),"backgroundColor",C) changeBackgrounds(C1,C2) :: cell(X,Y,Z) & distinct(Z,0) & ~won(0) & distinct(Z,bomb) & distinct(Z,flagBomb) & distinct(Z,lost) & style(mark(X,Y),"backgroundColor",C) ==> changeColor(X,Y,C1,C2) & ~style(mark(X,Y),"backgroundColor",C) changeBackgrounds(C1,C2) :: cell(X,Y,Z) & distinct(Z,0) & won(0) & ~style(mark(X,Y),"backgroundColor",C) ==> changeColor(X,Y,C1,C2) changeBackgrounds(C1,C2) :: cell(X,Y,Z) & distinct(Z,0) & ~won(0) & distinct(Z,bomb) & distinct(Z,flagBomb) & distinct(Z,lost) & ~style(mark(X,Y),"backgroundColor",C) ==> changeColor(X,Y,C1,C2) & ~style(mark(X,Y),"backgroundColor",C)