// doesn't work // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: packimports(3) // Source File Name: FourChss.java import java.applet.Applet; import java.awt.*; public class FourChss extends Applet { public FourChss() { } public boolean SomeInitialConditionForKeydown(){ System.out.println("Backup keys have been disabled"); return true; } public void SomethingElseForTotalBackBoard() { } public void SomethingElseForTotalSaveBoard() { } public void SomethingElseForUnBackBoard() { } public void SomethingElseForLoadSavedBoard() { } public boolean keyDown(Event e, int k) { if (humanizing==true){return false;} if (SomeInitialConditionForKeydown()==true){return true;} Graphics g=getGraphics(); oopsKey=getParameter("OOPS").charAt(0); saveKey=getParameter("SAVE").charAt(0); loadKey=getParameter("LOAD").charAt(0); if (k==oopsKey) { GameOver=false; UnBackBoard();TotalMaybeBoard(NowBoard, MaybeBoard); markingAPiece=true; whoseMove=who_backed; SayWhoIsHuman(g); whatpiecescanmove(g); TotalMaybeBoard(NowBoard, MaybeBoard); GenerateAttackersArrays(); CountAllThePieces(); DrawNowBoard(g); return true; } if (k==saveKey) { TotalSaveBoard();TotalMaybeBoard(NowBoard, MaybeBoard); who_saved=whoseMove; } if (k==loadKey) { GameOver=false; LoadSavedBoard();TotalMaybeBoard(NowBoard, MaybeBoard); markingAPiece=true; whoseMove=who_backed; SayWhoIsHuman(g); whatpiecescanmove(g); TotalMaybeBoard(NowBoard, MaybeBoard); GenerateAttackersArrays(); CountAllThePieces(); DrawNowBoard(g); return true; } System.out.println("kurwa"); return false; } public void TotalBackBoard(){back_turncounter=turncounter;back_fifty_move_rule=fifty_move_rule; for(xxx=0; xxx < 17; xxx++) for(yyy=0; yyy < 17; yyy++) { BackBoard.sq_[yyy][xxx].side_=NowBoard.sq_[yyy][xxx].side_; BackBoard.sq_[yyy][xxx].piece_=NowBoard.sq_[yyy][xxx].piece_; SomethingElseForTotalBackBoard(); } } public void TotalSaveBoard(){saved_fifty_move_rule=fifty_move_rule;saved_turncounter=turncounter; for(xxx=0; xxx < 17; xxx++) for(yyy=0; yyy < 17; yyy++) { SaveBoard.sq_[yyy][xxx].side_=NowBoard.sq_[yyy][xxx].side_; SaveBoard.sq_[yyy][xxx].piece_=NowBoard.sq_[yyy][xxx].piece_; SomethingElseForTotalSaveBoard(); } } public void UnBackBoard(){turncounter=back_turncounter;fifty_move_rule=back_fifty_move_rule;ShowStatusNothing(); for(xxx=0; xxx < 17; xxx++) for(yyy=0; yyy < 17; yyy++) { NowBoard.sq_[yyy][xxx].side_=BackBoard.sq_[yyy][xxx].side_; NowBoard.sq_[yyy][xxx].piece_=BackBoard.sq_[yyy][xxx].piece_; SomethingElseForUnBackBoard(); } } public void LoadSavedBoard(){turncounter=saved_turncounter;fifty_move_rule=saved_fifty_move_rule;ShowStatusNothing(); for(xxx=0; xxx < 17; xxx++) for(yyy=0; yyy < 17; yyy++) { NowBoard.sq_[yyy][xxx].side_=SaveBoard.sq_[yyy][xxx].side_; NowBoard.sq_[yyy][xxx].piece_=SaveBoard.sq_[yyy][xxx].piece_; SomethingElseForLoadSavedBoard(); } } public void ShowStatusQ(String stringo){ if (turncounter==0){showStatus(stringo);return;} showStatus(stringo+" ["+turncounter+"]"); } public void CountAllThePieces(){} public boolean IsThisAGoodMove(){ if (goodmove10==moveCounter){return true;} if (goodmove9==moveCounter){return true;} if (goodmove8==moveCounter){return true;} if (goodmove7==moveCounter){return true;} if (goodmove6==moveCounter){return true;} if (goodmove5==moveCounter){return true;} if (goodmove4==moveCounter){return true;} if (goodmove3==moveCounter){return true;} if (goodmove2==moveCounter){return true;} if (goodmove1==moveCounter){return true;} return false; } public void TotalMaybeBoard(FourCB fourcb, FourCB fourcb1){ for(xxx=1; xxx < 17; xxx++) for(yyy=1; yyy < 17; yyy++) { MaybeBoard.sq_[yyy][xxx].side_=NowBoard.sq_[yyy][xxx].side_; MaybeBoard.sq_[yyy][xxx].piece_=NowBoard.sq_[yyy][xxx].piece_; } } public void NegateGMCounts(){GM1count=0;GM2count=0;GM3count=0;GM4count=0;GM5count=0;GM6count=0;GM7count=0;GM8count=0;GM9count=0;GM10count=0;} public void AssignGoodMove1(){GM1count++;if ((Math.random()*GM1count<1)|(GM1count==1)){goodmove1=moveCounter;}} public void AssignGoodMove2(){GM2count++;if ((Math.random()*GM2count<1)|(GM2count==1)){goodmove2=moveCounter;}} public void AssignGoodMove3(){GM3count++;if ((Math.random()*GM3count<1)|(GM3count==1)){goodmove3=moveCounter;}} public void AssignGoodMove4(){GM4count++;if ((Math.random()*GM4count<1)|(GM4count==1)){goodmove4=moveCounter;}} public void AssignGoodMove5(){GM5count++;if ((Math.random()*GM5count<1)|(GM5count==1)){goodmove5=moveCounter;}} public void AssignGoodMove6(){GM6count++;if ((Math.random()*GM6count<1)|(GM6count==1)){goodmove6=moveCounter;}} public void AssignGoodMove7(){GM7count++;if ((Math.random()*GM7count<1)|(GM7count==1)){goodmove7=moveCounter;}} public void AssignGoodMove8(){GM8count++;if ((Math.random()*GM8count<1)|(GM8count==1)){goodmove8=moveCounter;}} public void AssignGoodMove9(){GM9count++;if ((Math.random()*GM9count<1)|(GM9count==1)){goodmove9=moveCounter;}} public void AssignGoodMove10(){GM10count++;if ((Math.random()*GM10count<1)|(GM10count==1)){goodmove10=moveCounter;}} public void start(){ if (NowBoard==null){init();repaint();ShowStatusQ("Applet Re-Started");} } public void AddAnAttacker() { if((xatt==catt) & (yatt==datt)) return; if((catt > 16) | (datt > 16) | (catt < 1) | (datt < 1)) { return; } else { Attackers[datt][catt][satt]=Attackers[datt][catt][satt] + 1; if (StrongestAttacker[datt][catt][satt]NowBoard.sq_[yatt][xatt].strength()) | (WeakestAttacker[datt][catt][satt]==0)) {WeakestAttacker[datt][catt][satt]=NowBoard.sq_[yatt][xatt].strength();} return; } } public boolean AmIUnderAttack(int i, int j, int k) { cc=j + 1; dd=i; while(cc < 17) if(MaybeBoard.sq_[dd][cc].side_==k) { cc=40; } else { if(IsEnemyRook(dd, cc)) return true; if(MaybeBoard.sq_[dd][cc].piece_ !=0) cc=40; cc++; } cc=j - 1; dd=i; while(cc > 0) if(MaybeBoard.sq_[dd][cc].side_==k) { cc=-1; } else { if(IsEnemyRook(dd, cc)) return true; if(MaybeBoard.sq_[dd][cc].piece_ !=0) cc=-1; cc--; } cc=j; for(dd=i + 1; dd < 17;) if(MaybeBoard.sq_[dd][cc].side_==k) { dd=40; } else { if(IsEnemyRook(dd, cc)) return true; if(MaybeBoard.sq_[dd][cc].piece_ !=0) dd=40; dd++; } cc=j; for(dd=i - 1; dd > 0;) if(MaybeBoard.sq_[dd][cc].side_==k) { dd=-1; } else { if(IsEnemyRook(dd, cc)) return true; if(MaybeBoard.sq_[dd][cc].piece_ !=0) dd=-1; dd--; } cc=j + 1; for(dd=i + 1; (cc < 17) & (dd < 17);) if(MaybeBoard.sq_[dd][cc].side_==k) { cc=40; } else { if(IsEnemyBishop(dd, cc)) return true; if(MaybeBoard.sq_[dd][cc].piece_ !=0) cc=40; cc++; dd++; } cc=j + 1; for(dd=i - 1; (cc < 17) & (dd > 0);) if(MaybeBoard.sq_[dd][cc].side_==k) { cc=40; } else { if(IsEnemyBishop(dd, cc)) return true; if(MaybeBoard.sq_[dd][cc].piece_ !=0) cc=40; cc++; dd--; } cc=j - 1; for(dd=i + 1; (cc > 0) & (dd < 17);) if(MaybeBoard.sq_[dd][cc].side_==k) { cc=-1; } else { if(IsEnemyBishop(dd, cc)) return true; if(MaybeBoard.sq_[dd][cc].piece_ !=0) cc=-1; cc--; dd++; } cc=j - 1; for(dd=i - 1; (cc > 0) & (dd > 0);) if(MaybeBoard.sq_[dd][cc].side_==k) { cc=-1; } else { if(IsEnemyBishop(dd, cc)) return true; if(MaybeBoard.sq_[dd][cc].piece_ !=0) cc=-1; cc--; dd--; } cc=j - 1; dd=i - 1; if(IsEnemyKing(dd, cc, k)) return true; cc=j - 1; dd=i; if(IsEnemyKing(dd, cc, k)) return true; cc=j - 1; dd=i + 1; if(IsEnemyKing(dd, cc, k)) return true; cc=j; dd=i - 1; if(IsEnemyKing(dd, cc, k)) return true; cc=j; dd=i + 1; if(IsEnemyKing(dd, cc, k)) return true; cc=j + 1; dd=i - 1; if(IsEnemyKing(dd, cc, k)) return true; cc=j + 1; dd=i; if(IsEnemyKing(dd, cc, k)) return true; cc=j + 1; dd=i + 1; if(IsEnemyKing(dd, cc, k)) return true; cc=j - 2; dd=i - 1; if(IsEnemyKnight(dd, cc, k)) return true; cc=j - 2; dd=i + 1; if(IsEnemyKnight(dd, cc, k)) return true; cc=j + 2; dd=i - 1; if(IsEnemyKnight(dd, cc, k)) return true; cc=j + 2; dd=i + 1; if(IsEnemyKnight(dd, cc, k)) return true; cc=j - 1; dd=i - 2; if(IsEnemyKnight(dd, cc, k)) return true; cc=j - 1; dd=i + 2; if(IsEnemyKnight(dd, cc, k)) return true; cc=j + 1; dd=i - 2; if(IsEnemyKnight(dd, cc, k)) return true; cc=j + 1; dd=i + 2; if(IsEnemyKnight(dd, cc, k)) return true; cc=j + 1; dd=i - 1; if(IsEnemyPawn1(dd, cc, k)) return true; cc=j - 1; dd=i - 1; if(IsEnemyPawn1(dd, cc, k)) return true; cc=j - 1; dd=i + 1; if(IsEnemyPawn2(dd, cc, k)) return true; cc=j - 1; dd=i - 1; if(IsEnemyPawn2(dd, cc, k)) return true; cc=j + 1; dd=i + 1; if(IsEnemyPawn3(dd, cc, k)) return true; cc=j - 1; dd=i + 1; if(IsEnemyPawn3(dd, cc, k)) return true; cc=j + 1; dd=i + 1; if(IsEnemyPawn4(dd, cc, k)) return true; cc=j + 1; dd=i - 1; return IsEnemyPawn4(dd, cc, k); } public boolean AmIUnderSparrowAttack(int i, int j, int k) { cc=j + 1; dd=i; while(cc < 17) if(MaybeBoard.sq_[dd][cc].side_==k) { cc=40; } else { if(IsEnemyRook(dd, cc) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; if(MaybeBoard.sq_[dd][cc].piece_ !=0) cc=40; cc++; } cc=j - 1; dd=i; while(cc > 0) if(MaybeBoard.sq_[dd][cc].side_==k) { cc=-1; } else { if(IsEnemyRook(dd, cc) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; if(MaybeBoard.sq_[dd][cc].piece_ !=0) cc=-1; cc--; } cc=j; for(dd=i + 1; dd < 17;) if(MaybeBoard.sq_[dd][cc].side_==k) { dd=40; } else { if(IsEnemyRook(dd, cc) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; if(MaybeBoard.sq_[dd][cc].piece_ !=0) dd=40; dd++; } cc=j; for(dd=i - 1; dd > 0;) if(MaybeBoard.sq_[dd][cc].side_==k) { dd=-1; } else { if(IsEnemyRook(dd, cc) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; if(MaybeBoard.sq_[dd][cc].piece_ !=0) dd=-1; dd--; } cc=j + 1; for(dd=i + 1; (cc < 17) & (dd < 17);) if(MaybeBoard.sq_[dd][cc].side_==k) { cc=40; } else { if(IsEnemyBishop(dd, cc) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; if(MaybeBoard.sq_[dd][cc].piece_ !=0) cc=40; cc++; dd++; } cc=j + 1; for(dd=i - 1; (cc < 17) & (dd > 0);) if(MaybeBoard.sq_[dd][cc].side_==k) { cc=40; } else { if(IsEnemyBishop(dd, cc) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; if(MaybeBoard.sq_[dd][cc].piece_ !=0) cc=40; cc++; dd--; } cc=j - 1; for(dd=i + 1; (cc > 0) & (dd < 17);) if(MaybeBoard.sq_[dd][cc].side_==k) { cc=-1; } else { if(IsEnemyBishop(dd, cc) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; if(MaybeBoard.sq_[dd][cc].piece_ !=0) cc=-1; cc--; dd++; } cc=j - 1; for(dd=i - 1; (cc > 0) & (dd > 0);) if(MaybeBoard.sq_[dd][cc].side_==k) { cc=-1; } else { if(IsEnemyBishop(dd, cc) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; if(MaybeBoard.sq_[dd][cc].piece_ !=0) cc=-1; cc--; dd--; } cc=j - 1; dd=i - 1; if(IsEnemyKing(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j - 1; dd=i; if(IsEnemyKing(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j - 1; dd=i + 1; if(IsEnemyKing(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j; dd=i - 1; if(IsEnemyKing(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j; dd=i + 1; if(IsEnemyKing(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j + 1; dd=i - 1; if(IsEnemyKing(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j + 1; dd=i; if(IsEnemyKing(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j + 1; dd=i + 1; if(IsEnemyKing(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j - 2; dd=i - 1; if(IsEnemyKnight(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j - 2; dd=i + 1; if(IsEnemyKnight(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j + 2; dd=i - 1; if(IsEnemyKnight(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j + 2; dd=i + 1; if(IsEnemyKnight(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j - 1; dd=i - 2; if(IsEnemyKnight(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j - 1; dd=i + 2; if(IsEnemyKnight(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j + 1; dd=i - 2; if(IsEnemyKnight(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j + 1; dd=i + 2; if(IsEnemyKnight(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j + 1; dd=i - 1; if(IsEnemyPawn1(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j - 1; dd=i - 1; if(IsEnemyPawn1(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j - 1; dd=i + 1; if(IsEnemyPawn2(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j - 1; dd=i - 1; if(IsEnemyPawn2(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j + 1; dd=i + 1; if(IsEnemyPawn3(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j - 1; dd=i + 1; if(IsEnemyPawn3(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j + 1; dd=i + 1; if(IsEnemyPawn4(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j + 1; dd=i - 1; return IsEnemyPawn4(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength() && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength(); } public boolean AmIWorried(int i) { if((skipDtGM) | (depth > 1)) return false; if(i !=whoseMove) return false; for(xxx=1; xxx < 17; xxx++) for(yyy=1; yyy < 17; yyy++) if((MaybeBoard.sq_[yyy][xxx].side_==i) & (MaybeBoard.sq_[yyy][xxx].strength() > 1) & (MaybeBoard.sq_[yyy][xxx].strength() > NowBoard.sq_[d[depth]][c[depth]].strength()) && AmIUnderSparrowAttack(yyy, xxx, i)) return true; return false; } public void Archives() { } public boolean DidICheckOrStalemate(Graphics g, int i) { if(GameOver) return true; stringy=""; if((IsMySideInCheck(1)) | (whoseMove !=1)) stringy=stringy + "Check on White! "; if((IsMySideInCheck(2)) | (whoseMove !=2)) stringy=stringy + "Check on Blue! "; if((IsMySideInCheck(3)) | (whoseMove !=3)) stringy=stringy + "Check on Red! "; if((IsMySideInCheck(4)) | (whoseMove !=4)) stringy=stringy + "Check on Yellow! "; return stringy !=""; } public void DisplayRules(Graphics g) { LowRectangle(g); g.drawString("Because teh computer can change the pieces' color,", 5, 285); g.drawString("I chose this variant, in which the army of a", 5, 301); g.drawString("captured king becomes yours, over the others.", 5, 317); } public boolean DoesArchiveMatchNowBoard() { return false; } public void DrawMaybeBoard(Graphics g) { for(ee=1; ee < 17; ee++) for(ff=1; ff < 17; ff++) MaybeBoard.sq_[ff][ee].drawchsq2(g, 1); } public void drawballs(Graphics g, Chsq16 chsq16){ if (i_began_as[ff][ee]==1){chsq16.drawlittlewhiteball(g,308);} if (i_began_as[ff][ee]==1){chsq16.drawlittleredball(g,308);} if (i_began_as[ff][ee]==1){chsq16.drawlittleblueball(g,308);} if (i_began_as[ff][ee]==1){chsq16.drawlittleyellowball(g,308);} } public void DrawNowBoard(Graphics g) { for(ee=1; ee < 17; ee++) for(ff=1; ff < 17; ff++) { NowBoard.sq_[ff][ee].drawchsq(g, 1, icanmove[ff][ee]); drawballs(g,NowBoard.sq_[ff][ee]); } } public void DrawPromotionOptions(Graphics g) { g.setColor(niceblue); g.fillRect(0, 511, 300, 94); g.setColor(Color.black); g.setFont(f2); g.drawString("Choose: ", 5, 560); happySquare.side_=whoseMove; happySquare.rank_=-1; happySquare.file_=3; happySquare.piece_=9; happySquare.drawchsq(g, 11, false); happySquare.file_=4; happySquare.piece_=5; happySquare.drawchsq(g, 11, false); happySquare.file_=5; happySquare.piece_=4; happySquare.drawchsq(g, 11, false); happySquare.file_=6; happySquare.piece_=3; happySquare.drawchsq(g, 11, false); } public void GenerateAttackersArrays() { for(zatt=1; zatt < 5; zatt++) for(yatt=1; yatt < 17; yatt++) for(xatt=1; xatt < 17; xatt++) { Attackers[yatt][xatt][zatt]=0; StrongestAttacker[yatt][xatt][zatt]=0; WeakestAttacker[yatt][xatt][zatt]=0; } for(yatt=1; yatt < 17; yatt++) for(xatt=1; xatt < 17; xatt++) { satt=NowBoard.sq_[yatt][xatt].side_; patt=NowBoard.sq_[yatt][xatt].piece_; if((patt==5) | (patt==6) | (patt==9)) { catt=xatt; datt=yatt; for(; catt < 17; catt++) { AddAnAttacker(); if((catt !=xatt) & (NowBoard.sq_[datt][catt].side_ !=0)) catt=30; } catt=xatt; datt=yatt; for(; catt > 0; catt--) { AddAnAttacker(); if((catt !=xatt) & (NowBoard.sq_[datt][catt].side_ !=0)) catt=-20; } catt=xatt; for(datt=yatt; datt < 17; datt++) { AddAnAttacker(); if((datt !=yatt) & (NowBoard.sq_[datt][catt].side_ !=0)) datt=30; } catt=xatt; for(datt=yatt; datt > 0; datt--) { AddAnAttacker(); if((datt !=yatt) & (NowBoard.sq_[datt][catt].side_ !=0)) datt=-20; } } if((patt==4) | (patt==9)) { catt=xatt; for(datt=yatt; (catt < 17) & (datt < 17); datt++) { AddAnAttacker(); if((catt !=xatt) & (NowBoard.sq_[datt][catt].side_ !=0)) catt=30; catt++; } catt=xatt; for(datt=yatt; (catt > 0) & (datt < 17); datt++) { AddAnAttacker(); if((catt !=xatt) & (NowBoard.sq_[datt][catt].side_ !=0)) catt=-20; catt--; } catt=xatt; for(datt=yatt; (catt < 17) & (datt > 0); catt++) { AddAnAttacker(); if((datt !=yatt) & (NowBoard.sq_[datt][catt].side_ !=0)) catt=30; datt--; } catt=xatt; for(datt=yatt; (catt > 0) & (datt > 0); catt--) { AddAnAttacker(); if((datt !=yatt) & (NowBoard.sq_[datt][catt].side_ !=0)) catt=-20; datt--; } } if(patt==3) { catt=xatt + 1; datt=yatt + 2; AddAnAttacker(); catt=xatt + 1; datt=yatt - 2; AddAnAttacker(); catt=xatt - 1; datt=yatt + 2; AddAnAttacker(); catt=xatt - 1; datt=yatt - 2; AddAnAttacker(); catt=xatt + 2; datt=yatt + 1; AddAnAttacker(); catt=xatt + 2; datt=yatt - 1; AddAnAttacker(); catt=xatt - 2; datt=yatt + 1; AddAnAttacker(); catt=xatt - 2; datt=yatt - 1; AddAnAttacker(); } if(patt < 0) { catt=xatt + 1; datt=yatt + 1; AddAnAttacker(); catt=xatt + 1; datt=yatt - 1; AddAnAttacker(); catt=xatt - 1; datt=yatt + 1; AddAnAttacker(); catt=xatt - 1; datt=yatt - 1; AddAnAttacker(); catt=xatt; datt=yatt + 1; AddAnAttacker(); catt=xatt; datt=yatt - 1; AddAnAttacker(); catt=xatt + 1; datt=yatt; AddAnAttacker(); catt=xatt - 1; datt=yatt; AddAnAttacker(); } if((patt==1) | (patt==2)) { if(satt==1) { datt=yatt + 1; catt=xatt + 1; AddAnAttacker(); datt=yatt + 1; catt=xatt - 1; AddAnAttacker(); } if(satt==3) { datt=yatt - 1; catt=xatt + 1; AddAnAttacker(); datt=yatt - 1; catt=xatt - 1; AddAnAttacker(); } if(satt==2) { catt=xatt + 1; datt=yatt + 1; AddAnAttacker(); catt=xatt + 1; datt=yatt - 1; AddAnAttacker(); } if(satt==4) { catt=xatt - 1; datt=yatt + 1; AddAnAttacker(); catt=xatt - 1; datt=yatt - 1; AddAnAttacker(); } } } } public boolean HumanMoveAPiece(Graphics g, int i, int j) { ShowStatusNothing(); moveto_rank=i; moveto_file=j; if((mover_rank==moveto_rank) & (mover_file==moveto_file)) { markingAPiece=true; for(x=1; x < 17; x++) for(y=1; y < 17; y++) if((x > 4) & (x < 13) | (y > 4) & (y < 13)) { NowBoard.sq_[y][x].drawchsq(g, 1, icanmove[y][x]); drawballs(g,NowBoard.sq_[y][x]); } return false; } if(!IsMyMoveListed()) { ShowStatusQ("Not there!"); return false; } TotalBackBoard(); who_backed=whoseMove; NormalMove(g); TotalMaybeBoard(NowBoard,MaybeBoard);DidICheckOrStalemate(g, whoseMove); markingAPiece=true; for(x=1; x < 17; x++) for(y=1; y < 17; y++) { if((x > 4) & (x < 13) | (y > 4) & (y < 13)) { NowBoard.sq_[y][x].drawchsq(g, 1, icanmove[y][x]); drawballs(g,NowBoard.sq_[y][x]); } MaybeBoard.sq_[y][x].side_=NowBoard.sq_[y][x].side_; MaybeBoard.sq_[y][x].piece_=NowBoard.sq_[y][x].piece_; } return true; } public boolean IsEnemyBishop(int i, int j) { if((j > 16) | (j < 1) | (i > 16) | (i < 1)) return false; if(MaybeBoard.sq_[i][j].piece_==4) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_==9) { assailant_rank=i; assailant_file=j; return true; } else { return false; } } public boolean IsEnemyKing(int i, int j, int k) { if((j > 16) | (j < 1) | (i > 16) | (i < 1)) return false; if(MaybeBoard.sq_[i][j].side_==k) return false; if(MaybeBoard.sq_[i][j].piece_ < 0) { assailant_rank=i; assailant_file=j; return true; } else { return false; } } public boolean IsEnemyKnight(int i, int j, int k) { if((j > 16) | (j < 1) | (i > 16) | (i < 1)) return false; if(MaybeBoard.sq_[i][j].side_==k) return false; if(MaybeBoard.sq_[i][j].piece_==3) { assailant_rank=i; assailant_file=j; return true; } else { return false; } } public boolean IsEnemyPawn1(int i, int j, int k) { if((j > 16) | (j < 1) | (i > 16) | (i < 1)) return false; if(MaybeBoard.sq_[i][j].side_==k) return false; if(i_began_as[i][j] !=1) return false; if(MaybeBoard.sq_[i][j].piece_==1) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_==2) { assailant_rank=i; assailant_file=j; return true; } else { return false; } } public boolean IsEnemyPawn2(int i, int j, int k) { if((j > 16) | (j < 1) | (i > 16) | (i < 1)) return false; if(MaybeBoard.sq_[i][j].side_==k) return false; if(i_began_as[i][j] !=2) return false; if(MaybeBoard.sq_[i][j].piece_==1) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_==2) { assailant_rank=i; assailant_file=j; return true; } else { return false; } } public boolean IsEnemyPawn3(int i, int j, int k) { if((j > 16) | (j < 1) | (i > 16) | (i < 1)) return false; if(MaybeBoard.sq_[i][j].side_==k) return false; if(i_began_as[i][j]!=3) return false; if(MaybeBoard.sq_[i][j].piece_==1) return true; return MaybeBoard.sq_[i][j].piece_==2; } public boolean IsEnemyPawn4(int i, int j, int k) { if((j > 16) | (j < 1) | (i > 16) | (i < 1)) return false; if(MaybeBoard.sq_[i][j].side_==k) return false; if(i_began_as[i][j] !=4) return false; if(MaybeBoard.sq_[i][j].piece_==1) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_==2) { assailant_rank=i; assailant_file=j; return true; } else { return false; } } public boolean IsEnemyRook(int i, int j) { if((j > 16) | (j < 1) | (i > 16) | (i < 1)) return false; if(MaybeBoard.sq_[i][j].piece_==5) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_==6) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_==9) { assailant_rank=i; assailant_file=j; return true; } else { return false; } } public boolean IsMyMoveListed() { for(x=1; x <=moveCounter; x++) if((MaybeMoves[x].endingsquare_.rank_==moveto_rank) & (MaybeMoves[x].endingsquare_.file_==moveto_file)) return true; return false; } public boolean IsMySideInCheck(int i) { for(xxx=1; xxx < 17; xxx++) for(yyy=1; yyy < 17; yyy++) if((i==MaybeBoard.sq_[yyy][xxx].side_) & (MaybeBoard.sq_[yyy][xxx].piece_ < 0) && AmIUnderAttack(yyy, xxx, i)) return true; return false; } public boolean IsThisSideAbleToMove(Graphics g, int i) { moveCounter=0; for(xx=1; xx < 17; xx++) for(yy=1; yy < 17; yy++) { if(NowBoard.sq_[yy][xx].side_==i) findPieceMoves(g, NowBoard.sq_[yy][xx], NowBoard, MaybeBoard); if(moveCounter > 0) return true; } return false; } public void LowRectangle(Graphics g) { g.setColor(niceblue); g.fillRect(520, 31, 300, 374); g.fillRect(0, 0, 300, 29);g.setColor(Color.black);g.setFont(f1);NameThisChessVariant(g); g.setColor(Color.black); g.setFont(f1);NameThisChessVariant(g); g.setColor(Color.black); g.setFont(f1); } public boolean MachineMoves(Graphics g, int i) { NegateGMCounts();goodmove1=0; goodmove2=0; goodmove3=0; goodmove4=0; goodmove5=0; goodmove6=0; goodmove7=0; goodmove8=0; goodmove9=0; goodmove10=0; UnTwoThePawns(i); moveCounter=0; if(!opening_library()) { gametreecounter=0; if(how_deep_to_seek > 3) depth=1; bestvcom1=-5000; for(x_run[1]=1; x_run[1] < 17; x_run[1]++) for(y_run[1]=1; y_run[1] < 17; y_run[1]++) if(NowBoard.sq_[y_run[1]][x_run[1]].side_==i) findPieceMoves(g, NowBoard.sq_[y_run[1]][x_run[1]], NowBoard, MaybeBoard); depth=0; ShowStatusNothing(); ShowStatusNothing(); if(moveCounter==0) { System.out.println("No Moves");/*WhoIsHuman[1]=true;WhoIsHuman[2]=true;ShowStatusQ("No Moves");*/ return false; } x=1 + (int)Math.floor(Math.random() * (double)moveCounter); if(Attackers[MaybeMoves[x].endingsquare_.rank_][MaybeMoves[x].endingsquare_.file_][i % 4 + 1] + Attackers[MaybeMoves[x].endingsquare_.rank_][MaybeMoves[x].endingsquare_.file_][(1 + i) % 4 + 1] + Attackers[MaybeMoves[x].endingsquare_.rank_][MaybeMoves[x].endingsquare_.file_][(2 + i) % 4 + 1] > Attackers[MaybeMoves[x].endingsquare_.rank_][MaybeMoves[x].endingsquare_.file_][i]) x=1 + (int)Math.floor(Math.random() * (double)moveCounter); if(Attackers[MaybeMoves[x].endingsquare_.rank_][MaybeMoves[x].endingsquare_.file_][i % 4 + 1] + Attackers[MaybeMoves[x].endingsquare_.rank_][MaybeMoves[x].endingsquare_.file_][(1 + i) % 4 + 1] + Attackers[MaybeMoves[x].endingsquare_.rank_][MaybeMoves[x].endingsquare_.file_][(2 + i) % 4 + 1] > Attackers[MaybeMoves[x].endingsquare_.rank_][MaybeMoves[x].endingsquare_.file_][i]) x=1 + (int)Math.floor(Math.random() * (double)moveCounter); if(goodmove1 > 0) x=goodmove1; if(goodmove2 > 0) x=goodmove2; if(goodmove3 > 0) x=goodmove3; if(goodmove4 > 0) x=goodmove4; if(goodmove5 > 0) x=goodmove5; if(goodmove6 > 0) x=goodmove6; if(goodmove7 > 0) x=goodmove7; if(goodmove8 > 0) x=goodmove8; if(goodmove9 > 0) x=goodmove9; if(goodmove10 > 0) x=goodmove10; moveto_file=MaybeMoves[x].endingsquare_.file_; moveto_rank=MaybeMoves[x].endingsquare_.rank_; mover_file=MaybeMoves[x].startingsquare_.file_; mover_rank=MaybeMoves[x].startingsquare_.rank_; } NormalMove(g); NowBoard.sq_[mover_rank][mover_file].drawchsq(g, 1, false); NowBoard.sq_[moveto_rank][moveto_file].drawchsq(g, 1, false); drawballs(g,NowBoard.sq_[mover_rank][mover_file]); drawballs(g,NowBoard.sq_[moveto_rank][moveto_file]); MaybeBoard.sq_[mover_rank][mover_file].side_=NowBoard.sq_[mover_rank][mover_file].side_; MaybeBoard.sq_[moveto_rank][moveto_file].side_=NowBoard.sq_[moveto_rank][moveto_file].side_; MaybeBoard.sq_[mover_rank][mover_file].piece_=NowBoard.sq_[mover_rank][mover_file].piece_; MaybeBoard.sq_[moveto_rank][moveto_file].piece_=NowBoard.sq_[moveto_rank][moveto_file].piece_; TotalMaybeBoard(NowBoard,MaybeBoard);DidICheckOrStalemate(g, i); if(fifty_move_rule > 250) { fifty_move_rule=0; DrawNowBoard(g);ShowStatusQ("Fifty move rule!"); drawn_games++; GameOver=true; return false; } else { return true; } } public boolean MaybeAdd(Graphics g, Chsq16 chsq16, FourCB fourcb, FourCB fourcb1) { assailant_rank=0; assailant2_rank=0; assailant_file=0; assailant2_file=0; CheckSquare[depth]=false; SquatterOnCheckSquare[depth]=false; if((c[depth] < 1) | (c[depth] > 16) | (d[depth] < 1) | (d[depth] > 16)) return false; if(((c[depth] < 5) | (c[depth] > 12)) & ((d[depth] < 5) | (d[depth] > 12))) return false; if(NowBoard.sq_[d[depth]][c[depth]].side_==chsq16.side_) return false; alterMaybeBoard(g, chsq16, fourcb.sq_[d[depth]][c[depth]], fourcb, fourcb1); worried=AmIWorried(chsq16.side_); if(IsMySideInCheck(chsq16.side_)) { unalterMaybeBoard(g, chsq16, fourcb.sq_[d[depth]][c[depth]], fourcb, fourcb1); CheckSquare[depth]=true; if(NowBoard.sq_[d[depth]][c[depth]].piece_ !=0) SquatterOnCheckSquare[depth]=true; return false; } good_move=1; if((whoseMove !=1) & (IsMySideInCheck(1))) good_move +=5; if((whoseMove !=2) & (IsMySideInCheck(2))) good_move +=5; if((whoseMove !=3) & (IsMySideInCheck(3))) good_move +=5; if((whoseMove !=4) & (IsMySideInCheck(4))) good_move +=5; if((chsq16.piece_==1) | (chsq16.piece_==2) | (chsq16.piece_ < 0)) { if((NowBoard.sq_[d[depth]][c[depth]].piece_==3) | (NowBoard.sq_[d[depth]][c[depth]].piece_==4)) good_move +=15; if((NowBoard.sq_[d[depth]][c[depth]].piece_==5) | (NowBoard.sq_[d[depth]][c[depth]].piece_==6)) good_move +=25; if(NowBoard.sq_[d[depth]][c[depth]].piece_==9) good_move +=50; } if((chsq16.piece_==3) | (chsq16.piece_==4)) { if((NowBoard.sq_[d[depth]][c[depth]].piece_==5) | (NowBoard.sq_[d[depth]][c[depth]].piece_==6)) good_move +=15; if(NowBoard.sq_[d[depth]][c[depth]].piece_==9) good_move +=25; } if((chsq16.piece_==5) | (chsq16.piece_==6) && NowBoard.sq_[d[depth]][c[depth]].piece_==9) good_move +=20; if(chsq16.piece_==9 && ((whoseMove !=1) & (Attackers[chsq16.rank_][chsq16.file_][1] > 0) | (whoseMove !=2) & (Attackers[chsq16.rank_][chsq16.file_][2] > 0) | (whoseMove !=3) & (Attackers[chsq16.rank_][chsq16.file_][3] > 0) | (whoseMove !=4) & (Attackers[chsq16.rank_][chsq16.file_][4] > 0)) & (((whoseMove==1) | (Attackers[d[depth]][c[depth]][1]==0)) & ((whoseMove==2) | (Attackers[d[depth]][c[depth]][2]==0)) & ((whoseMove==3) | (Attackers[d[depth]][c[depth]][3]==0)) & ((whoseMove==4) | (Attackers[d[depth]][c[depth]][4]==0)))) good_move +=20; good_counter=1; if(moveCounter > 500) good_move=1; for(; good_counter <=good_move; good_counter++) { moveCounter++; if ((halt_if_king_taken==true)&(skipDtGM==false)&(depth<2)&(NowBoard.sq_[d[depth]][c[depth]].piece_<0)){goodmove10=moveCounter;System.out.print("King captured");WhoIsHuman[1]=true;WhoIsHuman[2]=true;} MaybeMoves[moveCounter].startingsquare_=chsq16; MaybeMoves[moveCounter].endingsquare_=fourcb.sq_[d[depth]][c[depth]]; } if((Attackers[d[depth]][c[depth]][chsq16.side_ % 4 + 1]==0) & (Attackers[d[depth]][c[depth]][(1 + chsq16.side_) % 4 + 1]==0) & (Attackers[d[depth]][c[depth]][(2 + chsq16.side_) % 4 + 1]==0) & (NowBoard.sq_[d[depth]][c[depth]].piece_==9) && Math.random() * 100D <98D) AssignGoodMove9(); if((chsq16.piece_ !=9) & (NowBoard.sq_[d[depth]][c[depth]].piece_==9) && (Math.random() * 100D < 98D && !worried)) AssignGoodMove9(); if((chsq16.piece_==9) & ((Attackers[chsq16.rank_][chsq16.file_][chsq16.side_ % 4 + 1] > 0) | (Attackers[chsq16.rank_][chsq16.file_][(1 + chsq16.side_) % 4 + 1] > 0) | (Attackers[chsq16.rank_][chsq16.file_][(2 + chsq16.side_) % 4 + 1] > 0)) & (Attackers[d[depth]][c[depth]][chsq16.side_ % 4 + 1] + Attackers[d[depth]][c[depth]][(1 + chsq16.side_) % 4 + 1] + Attackers[d[depth]][c[depth]][(2 + chsq16.side_) % 4 + 1]==0) && (Math.random() * 100D <98D && !worried)) {AssignGoodMove8();if (NowBoard.sq_[d[depth]][c[depth]].piece_!=0){AssignGoodMove9();}} if((Attackers[d[depth]][c[depth]][chsq16.side_ % 4 + 1]==0) & (Attackers[d[depth]][c[depth]][(1 + chsq16.side_) % 4 + 1]==0) & (Attackers[d[depth]][c[depth]][(2 + chsq16.side_) % 4 + 1]==0) & ((NowBoard.sq_[d[depth]][c[depth]].piece_==5) | (NowBoard.sq_[d[depth]][c[depth]].piece_==6)) && (Math.random() * 100D < 98D && !worried)) AssignGoodMove7(); if((chsq16.piece_ < 5) & ((NowBoard.sq_[d[depth]][c[depth]].piece_==5) | (NowBoard.sq_[d[depth]][c[depth]].piece_==6)) && (Math.random() * 100D < 98D && !worried)) AssignGoodMove6(); if(((chsq16.piece_==6) | (chsq16.piece_==5)) & ((Attackers[chsq16.rank_][chsq16.file_][chsq16.side_ % 4 + 1] > 0) | (Attackers[chsq16.rank_][chsq16.file_][(1 + chsq16.side_) % 4 + 1] > 0) | (Attackers[chsq16.rank_][chsq16.file_][(2 + chsq16.side_) % 4 + 1] > 0)) & (Attackers[d[depth]][c[depth]][chsq16.side_ % 4 + 1]==0) & (Attackers[d[depth]][c[depth]][(1 + chsq16.side_) % 4 + 1]==0) & (Attackers[d[depth]][c[depth]][(2 + chsq16.side_) % 4 + 1]==0) && (Math.random() * 100D < 98D && !worried)) {AssignGoodMove8();if (NowBoard.sq_[d[depth]][c[depth]].piece_!=0){AssignGoodMove9();}} if((Attackers[d[depth]][c[depth]][chsq16.side_ % 4 + 1]==0) & (Attackers[d[depth]][c[depth]][(1 + chsq16.side_) % 4 + 1]==0) & (Attackers[d[depth]][c[depth]][(2 + chsq16.side_) % 4 + 1]==0) & ((NowBoard.sq_[d[depth]][c[depth]].piece_==3) | (NowBoard.sq_[d[depth]][c[depth]].piece_==4)) && (Math.random() * 100D < 79D && !worried)) AssignGoodMove4(); if((chsq16.piece_ < 3) & ((NowBoard.sq_[d[depth]][c[depth]].piece_==3) | (NowBoard.sq_[d[depth]][c[depth]].piece_==4)) && (Math.random() * 100D < 76D && !worried)) AssignGoodMove3(); if((Attackers[d[depth]][c[depth]][chsq16.side_ % 4 + 1]==0) & (Attackers[d[depth]][c[depth]][(1 + chsq16.side_) % 4 + 1]==0) & (Attackers[d[depth]][c[depth]][(2 + chsq16.side_) % 4 + 1]==0) & ((IsMySideInCheck(chsq16.side_ % 4 + 1)) | (IsMySideInCheck((1 + chsq16.side_) % 4 + 1)) | (IsMySideInCheck((2 + chsq16.side_) % 4 + 1))) && (Math.random() * 100D < 74D && !worried)) AssignGoodMove2(); /* if ((StrongestAttacker[d[depth]][c[depth]][3-chsq16.side_]==0) &(NowBoard.sq_[d[depth]][c[depth]].piece_!=0) &(Math.random() * 100D < 98D)) { switch(NowBoard.sq_[d[depth]][c[depth]].strength()) { case 5:{AssignGoodMove9();break;} case 4:{AssignGoodMove7();break;} case 3:{AssignGoodMove5();break;} case 2:{AssignGoodMove3();break;} case 1:{AssignGoodMove2();break;} } } if ((StrongestAttacker[chsq16.rank_][chsq16.file_][3-chsq16.side_]>0) &(Attackers[chsq16.rank_][chsq16.file_][chsq16.side_]==0) &(StrongestAttacker[d[depth]][c[depth]][3-chsq16.side_]==0) &(Math.random() * 100D < 98D) ) { switch(chsq16.strength()){ case 5:{AssignGoodMove9();break;} case 4:{AssignGoodMove7();break;} case 3:{AssignGoodMove5();break;} case 2:{AssignGoodMove3();break;} case 1:{AssignGoodMove2();break;} } } */ if((fifty_move_rule > 4) & (chsq16.piece_==1) & (Math.random() * 100D < 10D) & (!worried) & (Attackers[d[depth]][c[depth]][(1 + chsq16.side_) % 4 + 1]==0)) AssignGoodMove1(); if((Attackers[d[depth]][c[depth]][chsq16.side_ % 4 + 1] + Attackers[d[depth]][c[depth]][(1 + chsq16.side_) % 4 + 1] + Attackers[d[depth]][c[depth]][(2 + chsq16.side_) % 4 + 1] < Attackers[d[depth]][c[depth]][chsq16.side_]) & (NowBoard.sq_[d[depth]][c[depth]].piece_ !=0) && (Math.random() * 100D < 71D && !worried && !worried)) AssignGoodMove1(); if((worried) & (IsThisAGoodMove()==false) & (moveCounter > 1) & (!WhoIsHuman[whoseMove])) moveCounter--; unalterMaybeBoard(g, chsq16, fourcb.sq_[d[depth]][c[depth]], fourcb, fourcb1); return NowBoard.sq_[d[depth]][c[depth]].side_==0; } public void MaybeCastleKingside(Graphics g, int i) { if(depth > 1) return; if(i==1) { if(NowBoard.sq_[1][12].piece_ !=6) return; if(NowBoard.sq_[1][11].piece_ !=0) return; if(NowBoard.sq_[1][10].piece_ !=0) return; if(AmIUnderAttack(NowBoard.sq_[1][9].rank_, NowBoard.sq_[1][9].file_, 1)) return; if(AmIUnderAttack(NowBoard.sq_[1][10].rank_, NowBoard.sq_[1][10].file_, 1)) return; if(AmIUnderAttack(NowBoard.sq_[1][11].rank_, NowBoard.sq_[1][11].file_, 1)) return; moveCounter++; if ((halt_if_king_taken==true)&(skipDtGM==false)&(depth<2)&(NowBoard.sq_[d[depth]][c[depth]].piece_<0)){goodmove10=moveCounter;System.out.print("King captured");WhoIsHuman[1]=true;WhoIsHuman[2]=true;} d[depth]=1; c[depth]=11; MaybeAdd(g, NowBoard.sq_[1][9], NowBoard, MaybeBoard); } if(i==3) { if(NowBoard.sq_[16][5].piece_ !=6) return; if(NowBoard.sq_[16][6].piece_ !=0) return; if(NowBoard.sq_[16][7].piece_ !=0) return; if(AmIUnderAttack(NowBoard.sq_[16][8].rank_, NowBoard.sq_[16][8].file_, 3)) return; if(AmIUnderAttack(NowBoard.sq_[16][7].rank_, NowBoard.sq_[16][7].file_, 3)) return; if(AmIUnderAttack(NowBoard.sq_[16][6].rank_, NowBoard.sq_[16][6].file_, 3)) return; moveCounter++; if ((halt_if_king_taken==true)&(skipDtGM==false)&(depth<2)&(NowBoard.sq_[d[depth]][c[depth]].piece_<0)){goodmove10=moveCounter;System.out.print("King captured");WhoIsHuman[1]=true;WhoIsHuman[2]=true;} d[depth]=16; c[depth]=6; MaybeAdd(g, NowBoard.sq_[16][8], NowBoard, MaybeBoard); } if(i==2) { if(NowBoard.sq_[12][1].piece_ !=6) return; if(NowBoard.sq_[11][1].piece_ !=0) return; if(NowBoard.sq_[10][1].piece_ !=0) return; if(AmIUnderAttack(NowBoard.sq_[9][1].rank_, NowBoard.sq_[9][1].file_, 2)) return; if(AmIUnderAttack(NowBoard.sq_[10][1].rank_, NowBoard.sq_[10][1].file_, 2)) return; if(AmIUnderAttack(NowBoard.sq_[11][1].rank_, NowBoard.sq_[11][1].file_, 2)) return; moveCounter++; if ((halt_if_king_taken==true)&(skipDtGM==false)&(depth<2)&(NowBoard.sq_[d[depth]][c[depth]].piece_<0)){goodmove10=moveCounter;System.out.print("King captured");WhoIsHuman[1]=true;WhoIsHuman[2]=true;} d[depth]=11; c[depth]=1; MaybeAdd(g, NowBoard.sq_[9][1], NowBoard, MaybeBoard); } if(i==4) { if(NowBoard.sq_[5][16].piece_ !=6) return; if(NowBoard.sq_[6][16].piece_ !=0) return; if(NowBoard.sq_[7][16].piece_ !=0) return; if(AmIUnderAttack(NowBoard.sq_[8][16].rank_, NowBoard.sq_[8][16].file_, 4)) return; if(AmIUnderAttack(NowBoard.sq_[7][16].rank_, NowBoard.sq_[7][16].file_, 4)) return; if(AmIUnderAttack(NowBoard.sq_[6][16].rank_, NowBoard.sq_[6][16].file_, 4)) return; moveCounter++; if ((halt_if_king_taken==true)&(skipDtGM==false)&(depth<2)&(NowBoard.sq_[d[depth]][c[depth]].piece_<0)){goodmove10=moveCounter;System.out.print("King captured");WhoIsHuman[1]=true;WhoIsHuman[2]=true;} d[depth]=6; c[depth]=16; MaybeAdd(g, NowBoard.sq_[8][16], NowBoard, MaybeBoard); } } public void MaybeCastleQueenside(Graphics g, int i) { if(depth > 1) return; if(i==1) { if(NowBoard.sq_[1][5].piece_ !=6) return; if(NowBoard.sq_[1][6].piece_ !=0) return; if(NowBoard.sq_[1][7].piece_ !=0) return; if(NowBoard.sq_[1][8].piece_ !=0) return; if(AmIUnderAttack(NowBoard.sq_[1][9].rank_, NowBoard.sq_[1][9].file_, 1)) return; if(AmIUnderAttack(NowBoard.sq_[1][8].rank_, NowBoard.sq_[1][8].file_, 1)) return; if(AmIUnderAttack(NowBoard.sq_[1][7].rank_, NowBoard.sq_[1][7].file_, 1)) return; moveCounter++; if ((halt_if_king_taken==true)&(skipDtGM==false)&(depth<2)&(NowBoard.sq_[d[depth]][c[depth]].piece_<0)){goodmove10=moveCounter;System.out.print("King captured");WhoIsHuman[1]=true;WhoIsHuman[2]=true;} d[depth]=1; c[depth]=7; MaybeAdd(g, NowBoard.sq_[1][9], NowBoard, MaybeBoard); } if(i==3) { if(NowBoard.sq_[16][12].piece_ !=6) return; if(NowBoard.sq_[16][11].piece_ !=0) return; if(NowBoard.sq_[16][10].piece_ !=0) return; if(NowBoard.sq_[16][9].piece_ !=0) return; if(AmIUnderAttack(NowBoard.sq_[16][8].rank_, NowBoard.sq_[16][8].file_, 3)) return; if(AmIUnderAttack(NowBoard.sq_[16][9].rank_, NowBoard.sq_[16][9].file_, 3)) return; if(AmIUnderAttack(NowBoard.sq_[16][10].rank_, NowBoard.sq_[16][10].file_, 3)) return; moveCounter++; if ((halt_if_king_taken==true)&(skipDtGM==false)&(depth<2)&(NowBoard.sq_[d[depth]][c[depth]].piece_<0)){goodmove10=moveCounter;System.out.print("King captured");WhoIsHuman[1]=true;WhoIsHuman[2]=true;} d[depth]=16; c[depth]=10; MaybeAdd(g, NowBoard.sq_[16][8], NowBoard, MaybeBoard); } if(i==2) { if(NowBoard.sq_[5][1].piece_ !=6) return; if(NowBoard.sq_[6][1].piece_ !=0) return; if(NowBoard.sq_[7][1].piece_ !=0) return; if(NowBoard.sq_[8][1].piece_ !=0) return; if(AmIUnderAttack(NowBoard.sq_[9][1].rank_, NowBoard.sq_[9][1].file_, 2)) return; if(AmIUnderAttack(NowBoard.sq_[8][1].rank_, NowBoard.sq_[8][1].file_, 2)) return; if(AmIUnderAttack(NowBoard.sq_[7][1].rank_, NowBoard.sq_[7][1].file_, 2)) return; moveCounter++; if ((halt_if_king_taken==true)&(skipDtGM==false)&(depth<2)&(NowBoard.sq_[d[depth]][c[depth]].piece_<0)){goodmove10=moveCounter;System.out.print("King captured");WhoIsHuman[1]=true;WhoIsHuman[2]=true;} d[depth]=7; c[depth]=1; MaybeAdd(g, NowBoard.sq_[9][1], NowBoard, MaybeBoard); } if(i==4) { if(NowBoard.sq_[12][16].piece_ !=6) return; if(NowBoard.sq_[11][16].piece_ !=0) return; if(NowBoard.sq_[10][16].piece_ !=0) return; if(NowBoard.sq_[9][16].piece_ !=0) return; if(AmIUnderAttack(NowBoard.sq_[8][16].rank_, NowBoard.sq_[8][16].file_, 4)) return; if(AmIUnderAttack(NowBoard.sq_[9][16].rank_, NowBoard.sq_[9][16].file_, 4)) return; if(AmIUnderAttack(NowBoard.sq_[10][16].rank_, NowBoard.sq_[10][16].file_, 4)) return; moveCounter++; if ((halt_if_king_taken==true)&(skipDtGM==false)&(depth<2)&(NowBoard.sq_[d[depth]][c[depth]].piece_<0)){goodmove10=moveCounter;System.out.print("King captured");WhoIsHuman[1]=true;WhoIsHuman[2]=true;} d[depth]=10; c[depth]=16; MaybeAdd(g, NowBoard.sq_[8][16], NowBoard, MaybeBoard); } } public void AssignVariantName(){ variant_name="Four-Way Chess"; } public void NameThisChessVariant(Graphics g) { g.drawString("Four-Way Chess", 5, 15); // g.drawString("About:", 240, 15); } public void NextPlayer(Graphics g) { whoseMove++; if(whoseMove==5) {whoseMove=1;turncounter++;} whatpiecescanmove(g); GenerateAttackersArrays(); while(ILost[whoseMove]) { whoseMove++; if(whoseMove==5) { whoseMove=1; whatpiecescanmove(g); } } if(WhoIsHuman[whoseMove]) markingAPiece=true; DrawNowBoard(g); } public void NormalMove(Graphics g) { //**System.out.println(""+NowBoard.sq_[mover_rank][mover_file].piece_+" "+mover_rank+""+mover_file+" "+moveto_rank+""+moveto_file); if(NowBoard.sq_[mover_rank][mover_file].piece_ < 0) { KingRank[whoseMove]=moveto_rank; KingFile[whoseMove]=moveto_file; } if(NowBoard.sq_[mover_rank][mover_file].piece_==1 && NowBoard.sq_[mover_rank][moveto_file].piece_==2) { NowBoard.sq_[mover_rank][moveto_file].piece_=0; NowBoard.sq_[mover_rank][moveto_file].side_=0; i_began_as[mover_rank][moveto_file]=0; ShowStatusQ("En Passant"); NowBoard.sq_[mover_rank][moveto_file].drawchsq(g, 1, false); drawballs(g,NowBoard.sq_[mover_rank][moveto_file]); MaybeBoard.sq_[mover_rank][moveto_file].side_=0; MaybeBoard.sq_[mover_rank][moveto_file].piece_=0; } if((NowBoard.sq_[moveto_rank][moveto_file].piece_ > 0) | (NowBoard.sq_[mover_rank][mover_file].piece_==1)) { fifty_move_rule=0; } else { fifty_move_rule++; if(fifty_move_rule > fifties_got_to) fifties_got_to=fifty_move_rule; } if(NowBoard.sq_[moveto_rank][moveto_file].piece_ < 0) { aaa=NowBoard.sq_[moveto_rank][moveto_file].side_; ILost[aaa]=true; if(aaa==1) ControlsSouth=whoseMove; if(aaa==2) ControlsWest=whoseMove; if(aaa==3) ControlsNorth=whoseMove; if(aaa==4) ControlsEast=whoseMove; for(ee=1; ee < 17; ee++) for(ff=1; ff < 17; ff++) if(NowBoard.sq_[ff][ee].side_==aaa) { NowBoard.sq_[ff][ee].side_=whoseMove; MaybeBoard.sq_[ff][ee].side_=whoseMove; NowBoard.sq_[ff][ee].drawchsq(g, 1, icanmove[ff][ee]); drawballs(g,NowBoard.sq_[ff][ee]); } if((ILost[2]) & (ILost[3]) & (ILost[4])) { ShowStatusQ("White wins!"); GameOver=true; wins[1]++; return; } if((ILost[1]) & (ILost[3]) & (ILost[4])) { ShowStatusQ("Blue wins!"); GameOver=true; wins[2]++; return; } if((ILost[1]) & (ILost[2]) & (ILost[4])) { ShowStatusQ("Red wins!"); GameOver=true; wins[3]++; return; } if((ILost[1]) & (ILost[2]) & (ILost[3])) { ShowStatusQ("Gold wins!"); GameOver=true; wins[4]++; return; } } NowBoard.sq_[moveto_rank][moveto_file].side_=NowBoard.sq_[mover_rank][mover_file].side_; NowBoard.sq_[moveto_rank][moveto_file].piece_=NowBoard.sq_[mover_rank][mover_file].piece_; i_began_as[moveto_rank][moveto_file]=i_began_as[mover_rank][mover_file]; i_began_as[mover_rank][mover_file]=0; if(NowBoard.sq_[moveto_rank][moveto_file].piece_==-2) { if((moveto_rank==1) & (moveto_file==11)) { NowBoard.sq_[1][12].piece_=0; NowBoard.sq_[1][12].side_=0; NowBoard.sq_[1][10].piece_=5; NowBoard.sq_[1][10].side_=1; NowBoard.sq_[1][12].drawchsq(g, 1, false); NowBoard.sq_[1][10].drawchsq(g, 1, false); ShowStatusQ("Castling King Side"); } if((moveto_rank==11) & (moveto_file==1)) { NowBoard.sq_[12][1].piece_=0; NowBoard.sq_[12][1].side_=0; NowBoard.sq_[10][1].piece_=5; NowBoard.sq_[10][1].side_=2; NowBoard.sq_[12][1].drawchsq(g, 1, false); NowBoard.sq_[10][1].drawchsq(g, 1, false); ShowStatusQ("Castling King Side"); } if((moveto_rank==16) & (moveto_file==6)) { NowBoard.sq_[16][5].piece_=0; NowBoard.sq_[16][5].side_=0; NowBoard.sq_[16][7].piece_=5; NowBoard.sq_[16][7].side_=3; NowBoard.sq_[16][5].drawchsq(g, 1, false); NowBoard.sq_[16][7].drawchsq(g, 1, false); ShowStatusQ("Castling King Side"); } if((moveto_rank==6) & (moveto_file==16)) { NowBoard.sq_[5][16].piece_=0; NowBoard.sq_[5][16].side_=0; NowBoard.sq_[7][16].piece_=5; NowBoard.sq_[7][16].side_=4; NowBoard.sq_[5][16].drawchsq(g, 1, false); NowBoard.sq_[7][16].drawchsq(g, 1, false); ShowStatusQ("Castling King Side"); } if((moveto_rank==1) & (moveto_file==7)) { NowBoard.sq_[1][5].piece_=0; NowBoard.sq_[1][5].side_=0; NowBoard.sq_[1][8].piece_=5; NowBoard.sq_[1][8].side_=1; NowBoard.sq_[1][5].drawchsq(g, 1, false); NowBoard.sq_[1][8].drawchsq(g, 1, false); ShowStatusQ("Castling Queen Side"); } if((moveto_rank==7) & (moveto_file==1)) { NowBoard.sq_[5][1].piece_=0; NowBoard.sq_[5][1].side_=0; NowBoard.sq_[8][1].piece_=5; NowBoard.sq_[8][1].side_=2; NowBoard.sq_[5][1].drawchsq(g, 1, false); NowBoard.sq_[8][1].drawchsq(g, 1, false); ShowStatusQ("Castling Queen Side"); } if((moveto_rank==16) & (moveto_file==10)) { NowBoard.sq_[16][12].piece_=0; NowBoard.sq_[16][12].side_=0; NowBoard.sq_[16][9].piece_=5; NowBoard.sq_[16][9].side_=3; NowBoard.sq_[16][12].drawchsq(g, 1, false); NowBoard.sq_[16][9].drawchsq(g, 1, false); ShowStatusQ("Castling Queen Side"); } if((moveto_rank==10) & (moveto_file==16)) { NowBoard.sq_[12][16].piece_=0; NowBoard.sq_[12][16].side_=0; NowBoard.sq_[9][16].piece_=5; NowBoard.sq_[9][16].side_=4; NowBoard.sq_[12][16].drawchsq(g, 1, false); NowBoard.sq_[9][16].drawchsq(g, 1, false); ShowStatusQ("Castling Queen Side"); } NowBoard.sq_[moveto_rank][moveto_file].piece_=-1; } if(NowBoard.sq_[moveto_rank][moveto_file].piece_==6) NowBoard.sq_[moveto_rank][moveto_file].piece_=5; if(NowBoard.sq_[moveto_rank][moveto_file].piece_==1) { if(moveto_rank==1 && ControlsSouth !=whoseMove) { NowBoard.sq_[moveto_rank][moveto_file].piece_=9; MaybeBoard.sq_[moveto_rank][moveto_file].piece_=9; NowBoard.sq_[moveto_rank][moveto_file].drawchsq(g, 1, false); drawballs(g,NowBoard.sq_[moveto_rank][moveto_file]); } if(moveto_file==1 && ControlsWest !=whoseMove) { NowBoard.sq_[moveto_rank][moveto_file].piece_=9; MaybeBoard.sq_[moveto_rank][moveto_file].piece_=9; NowBoard.sq_[moveto_rank][moveto_file].drawchsq(g, 1, false); drawballs(g,NowBoard.sq_[moveto_rank][moveto_file]); } if(moveto_rank==16 && ControlsNorth !=whoseMove) { NowBoard.sq_[moveto_rank][moveto_file].piece_=9; MaybeBoard.sq_[moveto_rank][moveto_file].piece_=9; NowBoard.sq_[moveto_rank][moveto_file].drawchsq(g, 1, false); drawballs(g,NowBoard.sq_[moveto_rank][moveto_file]); } if(moveto_file==16 && ControlsEast !=whoseMove) { NowBoard.sq_[moveto_rank][moveto_file].piece_=9; MaybeBoard.sq_[moveto_rank][moveto_file].piece_=9; NowBoard.sq_[moveto_rank][moveto_file].drawchsq(g, 1, false); drawballs(g,NowBoard.sq_[moveto_rank][moveto_file]); } } NowBoard.sq_[mover_rank][mover_file].side_=0; NowBoard.sq_[mover_rank][mover_file].piece_=0; for(xxx=1; xxx < 17; xxx++) for(yyy=1; yyy < 17; yyy++) { MaybeBoard.sq_[yyy][xxx].side_=NowBoard.sq_[yyy][xxx].side_; MaybeBoard.sq_[yyy][xxx].piece_=NowBoard.sq_[yyy][xxx].piece_; } ShowStatusNothing(); Archives(); inquire_about_terms(); if (WhoIsHuman[whoseMove]==true){SayWhoIsHuman(g);} } public void SayWhoIsHuman(Graphics g) { g.setColor(niceblue); g.fillRect(520, 31, 300, 374); g.setColor(Color.black); g.setFont(f1); g.drawString("White:", 530, 50); g.drawString("Blue:", 530, 70); g.drawString("Red:", 530, 90); g.drawString("Gold", 530, 110); g.drawString("Computer", 640, 50); g.drawString("Computer", 640, 70); g.drawString("Computer", 640, 90); g.drawString("Computer", 640, 110); g.drawString("Human", 580, 50); g.drawString("Human", 580, 70); g.drawString("Human", 580, 90); g.drawString("Human", 580, 110); variant_name="Four-Way Chess"; g.setFont(f1);NameThisChessVariant(g); g.drawString("White " + wins[1] + " Blue " + wins[2] + " Red " + wins[3] + " Gold " + wins[4] + " Drawn " + drawn_games, 300, 15); g.setFont(f3); g.drawString("Programming by Ed (www.pathguy.com)", 560, 510); g.setFont(f2); if(humanizing) g.drawString("OKAY", 560, 180); g.setFont(f1); g.drawString("This is one of many possible", 560, 220); g.drawString(" four-way chess games.", 560, 240); g.drawString("Capture an enemy king, and", 560, 260); g.drawString(" his army becomes yours.", 560, 280); g.drawString("Pawn promote on the first rank", 560, 300); g.drawString(" of any enemy, always to a queen.", 560, 320); g.drawString("If no move is available, pass the turn;", 560, 340); g.drawString(" you must click twice to do so.", 560, 360); g.drawString("There is no en passant capturing.", 560, 380); g.setColor(Color.white); if(WhoIsHuman[1]) { g.drawRect(576, 36, 48, 18); g.drawRect(577, 37, 46, 16); } if(!WhoIsHuman[1]) { g.drawRect(637, 36, 61, 18); g.drawRect(638, 37, 59, 16); } g.setColor(Color.blue); if(WhoIsHuman[2]) { g.drawRect(576, 56, 48, 18); g.drawRect(577, 57, 46, 16); } if(!WhoIsHuman[2]) { g.drawRect(637, 56, 61, 18); g.drawRect(638, 57, 59, 16); } g.setColor(Color.red); if(WhoIsHuman[3]) { g.drawRect(576, 76, 48, 18); g.drawRect(577, 77, 46, 16); } if(!WhoIsHuman[3]) { g.drawRect(637, 76, 61, 18); g.drawRect(638, 77, 59, 16); } g.setColor(Color.yellow); if(WhoIsHuman[4]) { g.drawRect(576, 96, 48, 18); g.drawRect(577, 97, 46, 16); } if(!WhoIsHuman[4]) { g.drawRect(637, 96, 61, 18); g.drawRect(638, 97, 59, 16); } } public void ShowStatusNothing() { if(!GameOver) ShowStatusQ(""); } public void StartUp(Graphics g) { turncounter=1;saved_fifty_move_rule=0;saved_turncounter=1;ShowStatusNothing(); halt_if_king_taken=false; accepted_terms=false; who_is_winning=0; for(aaa=1; aaa <=16; aaa++) for(bbb=1; bbb <=16; bbb++) { NowBoard.sq_[bbb][aaa].piece_=0; NowBoard.sq_[bbb][aaa].side_=0; } TakeOutTheCorners(); NowBoard.sq_[1][5].side_=1; NowBoard.sq_[1][5].piece_=6; NowBoard.sq_[12][1].side_=2; NowBoard.sq_[12][1].piece_=6; NowBoard.sq_[16][12].side_=3; NowBoard.sq_[16][12].piece_=6; NowBoard.sq_[5][16].side_=4; NowBoard.sq_[5][16].piece_=6; NowBoard.sq_[1][6].side_=1; NowBoard.sq_[1][6].piece_=3; NowBoard.sq_[11][1].side_=2; NowBoard.sq_[11][1].piece_=3; NowBoard.sq_[16][11].side_=3; NowBoard.sq_[16][11].piece_=3; NowBoard.sq_[6][16].side_=4; NowBoard.sq_[6][16].piece_=3; NowBoard.sq_[1][7].side_=1; NowBoard.sq_[1][7].piece_=4; NowBoard.sq_[10][1].side_=2; NowBoard.sq_[10][1].piece_=4; NowBoard.sq_[16][10].side_=3; NowBoard.sq_[16][10].piece_=4; NowBoard.sq_[7][16].side_=4; NowBoard.sq_[7][16].piece_=4; NowBoard.sq_[1][8].side_=1; NowBoard.sq_[1][8].piece_=9; NowBoard.sq_[9][1].side_=2; NowBoard.sq_[9][1].piece_=-2; NowBoard.sq_[16][9].side_=3; NowBoard.sq_[16][9].piece_=9; NowBoard.sq_[8][16].side_=4; NowBoard.sq_[8][16].piece_=-2; NowBoard.sq_[1][9].side_=1; NowBoard.sq_[1][9].piece_=-2; NowBoard.sq_[8][1].side_=2; NowBoard.sq_[8][1].piece_=9; NowBoard.sq_[16][8].side_=3; NowBoard.sq_[16][8].piece_=-2; NowBoard.sq_[9][16].side_=4; NowBoard.sq_[9][16].piece_=9; NowBoard.sq_[1][10].side_=1; NowBoard.sq_[1][10].piece_=4; NowBoard.sq_[7][1].side_=2; NowBoard.sq_[7][1].piece_=4; NowBoard.sq_[16][7].side_=3; NowBoard.sq_[16][7].piece_=4; NowBoard.sq_[10][16].side_=4; NowBoard.sq_[10][16].piece_=4; NowBoard.sq_[1][11].side_=1; NowBoard.sq_[1][11].piece_=3; NowBoard.sq_[6][1].side_=2; NowBoard.sq_[6][1].piece_=3; NowBoard.sq_[16][6].side_=3; NowBoard.sq_[16][6].piece_=3; NowBoard.sq_[11][16].side_=4; NowBoard.sq_[11][16].piece_=3; NowBoard.sq_[1][12].side_=1; NowBoard.sq_[1][12].piece_=6; NowBoard.sq_[5][1].side_=2; NowBoard.sq_[5][1].piece_=6; NowBoard.sq_[16][5].side_=3; NowBoard.sq_[16][5].piece_=6; NowBoard.sq_[12][16].side_=4; NowBoard.sq_[12][16].piece_=6; for(x=5; x < 13; x++) { NowBoard.sq_[2][x].side_=1; NowBoard.sq_[2][x].piece_=1; NowBoard.sq_[15][x].side_=3; NowBoard.sq_[15][x].piece_=1; NowBoard.sq_[x][2].side_=2; NowBoard.sq_[x][2].piece_=1; NowBoard.sq_[x][15].side_=4; NowBoard.sq_[x][15].piece_=1; } for(x=1; x < 17; x++) for(y=1; y < 17; y++) { MaybeBoard.sq_[y][x].side_=NowBoard.sq_[y][x].side_; MaybeBoard.sq_[y][x].piece_=NowBoard.sq_[y][x].piece_; i_began_as[y][x]=NowBoard.sq_[y][x].side_; } whoseMove=1; whatpiecescanmove(g); GameOver=false; fifty_move_rule=0; ILost[1]=false; ILost[2]=false; ILost[3]=false; ILost[4]=false; ControlsSouth=1; ControlsWest=2; ControlsNorth=3; ControlsEast=4; DrawNowBoard(g); TotalSaveBoard(); TotalBackBoard(); } public void TakeOutTheCorners(){ for(x=1; x < 5; x++) for(y=1; y < 5; y++) { NowBoard.sq_[y][x].piece_=74; NowBoard.sq_[y][x].side_=6; NowBoard.sq_[y + 12][x].piece_=74; NowBoard.sq_[y + 12][x].side_=6; NowBoard.sq_[y][x + 12].piece_=74; NowBoard.sq_[y][x + 12].side_=6; NowBoard.sq_[y + 12][x + 12].piece_=74; NowBoard.sq_[y + 12][x + 12].side_=6; } } public void UnTwoThePawns(int i) { for(xq=1; xq < 17; xq++) for(yq=1; yq < 17; yq++) if((NowBoard.sq_[yq][xq].side_==i) & (NowBoard.sq_[yq][xq].piece_==2)) NowBoard.sq_[yq][xq].piece_=1; } public void alterMaybeBoard(Graphics g, Chsq16 chsq16, Chsq16 chsq16_1, FourCB fourcb, FourCB fourcb1) { fourcb1.sq_[chsq16.rank_][chsq16.file_].piece_=0; fourcb1.sq_[chsq16.rank_][chsq16.file_].side_=0; fourcb1.sq_[chsq16_1.rank_][chsq16_1.file_].piece_=fourcb.sq_[chsq16.rank_][chsq16.file_].piece_; fourcb1.sq_[chsq16_1.rank_][chsq16_1.file_].side_=fourcb.sq_[chsq16.rank_][chsq16.file_].side_; if((fourcb.sq_[chsq16.rank_][chsq16.file_].piece_==1) & (fourcb.sq_[chsq16_1.rank_][chsq16_1.file_].side_==0) & (chsq16.file_ !=chsq16_1.file_)) { fourcb1.sq_[chsq16.rank_][chsq16_1.file_].piece_=0; fourcb1.sq_[chsq16.rank_][chsq16_1.file_].side_=0; } } public boolean findPieceMoves(Graphics g, Chsq16 chsq16, FourCB fourcb, FourCB fourcb1) { CheckSquare[depth]=false; SquatterOnCheckSquare[depth]=false; if((chsq16.piece_==9) | (chsq16.piece_==5) | (chsq16.piece_==6)) { c[depth]=chsq16.file_ - 1; for(d[depth]=chsq16.rank_; (MaybeAdd(g, chsq16, fourcb, fourcb1)) | (CheckSquare[depth]) & (!SquatterOnCheckSquare[depth]); c[depth]=c[depth] - 1); } if((chsq16.piece_==9) | (chsq16.piece_==5) | (chsq16.piece_==6)) { c[depth]=chsq16.file_ + 1; for(d[depth]=chsq16.rank_; (MaybeAdd(g, chsq16, fourcb, fourcb1)) | (CheckSquare[depth]) & (!SquatterOnCheckSquare[depth]); c[depth]++); } if((chsq16.piece_==9) | (chsq16.piece_==5) | (chsq16.piece_==6)) { c[depth]=chsq16.file_; for(d[depth]=chsq16.rank_ - 1; (MaybeAdd(g, chsq16, fourcb, fourcb1)) | (CheckSquare[depth]) & (!SquatterOnCheckSquare[depth]); d[depth]=d[depth] - 1); } if((chsq16.piece_==9) | (chsq16.piece_==5) | (chsq16.piece_==6)) { c[depth]=chsq16.file_; for(d[depth]=chsq16.rank_ + 1; (MaybeAdd(g, chsq16, fourcb, fourcb1)) | (CheckSquare[depth]) & (!SquatterOnCheckSquare[depth]); d[depth]++); } if((chsq16.piece_==9) | (chsq16.piece_==4)) { c[depth]=chsq16.file_ - 1; for(d[depth]=chsq16.rank_ - 1; (MaybeAdd(g, chsq16, fourcb, fourcb1)) | (CheckSquare[depth]) & (!SquatterOnCheckSquare[depth]); d[depth]=d[depth] - 1) c[depth]=c[depth] - 1; } if((chsq16.piece_==9) | (chsq16.piece_==4)) { c[depth]=chsq16.file_ - 1; for(d[depth]=chsq16.rank_ + 1; (MaybeAdd(g, chsq16, fourcb, fourcb1)) | (CheckSquare[depth]) & (!SquatterOnCheckSquare[depth]); d[depth]=d[depth] + 1) c[depth]=c[depth] - 1; } if((chsq16.piece_==9) | (chsq16.piece_==4)) { c[depth]=chsq16.file_ + 1; for(d[depth]=chsq16.rank_ - 1; (MaybeAdd(g, chsq16, fourcb, fourcb1)) | (CheckSquare[depth]) & (!SquatterOnCheckSquare[depth]); d[depth]=d[depth] - 1) c[depth]=c[depth] + 1; } if((chsq16.piece_==9) | (chsq16.piece_==4)) { c[depth]=chsq16.file_ + 1; for(d[depth]=chsq16.rank_ + 1; (MaybeAdd(g, chsq16, fourcb, fourcb1)) | (CheckSquare[depth]) & (!SquatterOnCheckSquare[depth]); d[depth]=d[depth] + 1) c[depth]=c[depth] + 1; } if((chsq16.piece_==-1) | (chsq16.piece_==-2)) { c[depth]=chsq16.file_ + 1; d[depth]=chsq16.rank_; MaybeAdd(g, chsq16, fourcb, fourcb1); } if((chsq16.piece_==-1) | (chsq16.piece_==-2)) { c[depth]=chsq16.file_; d[depth]=chsq16.rank_ + 1; MaybeAdd(g, chsq16, fourcb, fourcb1); } if((chsq16.piece_==-1) | (chsq16.piece_==-2)) { c[depth]=chsq16.file_ - 1; d[depth]=chsq16.rank_; MaybeAdd(g, chsq16, fourcb, fourcb1); } if((chsq16.piece_==-1) | (chsq16.piece_==-2)) { c[depth]=chsq16.file_; d[depth]=chsq16.rank_ - 1; MaybeAdd(g, chsq16, fourcb, fourcb1); } if((chsq16.piece_==-1) | (chsq16.piece_==-2)) { c[depth]=chsq16.file_ + 1; d[depth]=chsq16.rank_ + 1; MaybeAdd(g, chsq16, fourcb, fourcb1); } if((chsq16.piece_==-1) | (chsq16.piece_==-2)) { c[depth]=chsq16.file_ + 1; d[depth]=chsq16.rank_ - 1; MaybeAdd(g, chsq16, fourcb, fourcb1); } if((chsq16.piece_==-1) | (chsq16.piece_==-2)) { c[depth]=chsq16.file_ - 1; d[depth]=chsq16.rank_ + 1; MaybeAdd(g, chsq16, fourcb, fourcb1); } if((chsq16.piece_==-1) | (chsq16.piece_==-2)) { c[depth]=chsq16.file_ - 1; d[depth]=chsq16.rank_ - 1; MaybeAdd(g, chsq16, fourcb, fourcb1); } if(chsq16.piece_==3) { c[depth]=chsq16.file_ - 2; d[depth]=chsq16.rank_ - 1; MaybeAdd(g, chsq16, fourcb, fourcb1); } if(chsq16.piece_==3) { c[depth]=chsq16.file_ - 2; d[depth]=chsq16.rank_ + 1; MaybeAdd(g, chsq16, fourcb, fourcb1); } if(chsq16.piece_==3) { c[depth]=chsq16.file_ + 2; d[depth]=chsq16.rank_ - 1; MaybeAdd(g, chsq16, fourcb, fourcb1); } if(chsq16.piece_==3) { c[depth]=chsq16.file_ + 2; d[depth]=chsq16.rank_ + 1; MaybeAdd(g, chsq16, fourcb, fourcb1); } if(chsq16.piece_==3) { c[depth]=chsq16.file_ - 1; d[depth]=chsq16.rank_ - 2; MaybeAdd(g, chsq16, fourcb, fourcb1); } if(chsq16.piece_==3) { c[depth]=chsq16.file_ - 1; d[depth]=chsq16.rank_ + 2; MaybeAdd(g, chsq16, fourcb, fourcb1); } if(chsq16.piece_==3) { c[depth]=chsq16.file_ + 1; d[depth]=chsq16.rank_ - 2; MaybeAdd(g, chsq16, fourcb, fourcb1); } if(chsq16.piece_==3) { c[depth]=chsq16.file_ + 1; d[depth]=chsq16.rank_ + 2; MaybeAdd(g, chsq16, fourcb, fourcb1); } if((chsq16.piece_==1) | (chsq16.piece_==2)) { if((i_began_as[chsq16.rank_][chsq16.file_]==2) & (chsq16.file_ < 16)) { if(NowBoard.sq_[chsq16.rank_][chsq16.file_ + 1].piece_==0) { c[depth]=chsq16.file_ + 1; d[depth]=chsq16.rank_; MaybeAdd(g, chsq16, fourcb, fourcb1); } if((chsq16.file_==2) & (NowBoard.sq_[chsq16.rank_][3].piece_==0) & (NowBoard.sq_[chsq16.rank_][4].piece_==0)) { c[depth]=4; d[depth]=chsq16.rank_; MaybeAdd(g, chsq16, fourcb, fourcb1); } if(chsq16.rank_ > 1 && (NowBoard.sq_[chsq16.rank_ - 1][chsq16.file_ + 1].side_ !=0) & (NowBoard.sq_[chsq16.rank_ - 1][chsq16.file_ + 1].side_ !=chsq16.side_) & (NowBoard.sq_[chsq16.rank_ - 1][chsq16.file_ + 1].piece_ !=0)) { c[depth]=chsq16.file_ + 1; d[depth]=chsq16.rank_ - 1; MaybeAdd(g, chsq16, fourcb, fourcb1); } if(chsq16.file_ < 16 && (NowBoard.sq_[chsq16.rank_ + 1][chsq16.file_ + 1].side_ !=0) & (NowBoard.sq_[chsq16.rank_ + 1][chsq16.file_ + 1].side_ !=chsq16.side_) & (NowBoard.sq_[chsq16.rank_ + 1][chsq16.file_ + 1].piece_ !=0)) { c[depth]=chsq16.file_ + 1; d[depth]=chsq16.rank_ + 1; MaybeAdd(g, chsq16, fourcb, fourcb1); } } if((i_began_as[chsq16.rank_][chsq16.file_]==4) & (chsq16.file_ > 1)) { if(NowBoard.sq_[chsq16.rank_][chsq16.file_ - 1].piece_==0) { c[depth]=chsq16.file_ - 1; d[depth]=chsq16.rank_; MaybeAdd(g, chsq16, fourcb, fourcb1); } if((chsq16.file_==15) & (NowBoard.sq_[chsq16.rank_][14].piece_==0) & (NowBoard.sq_[chsq16.rank_][13].piece_==0)) { c[depth]=13; d[depth]=chsq16.rank_; MaybeAdd(g, chsq16, fourcb, fourcb1); } if(chsq16.rank_ > 1 && (NowBoard.sq_[chsq16.rank_ - 1][chsq16.file_ - 1].side_ !=0) & (NowBoard.sq_[chsq16.rank_ - 1][chsq16.file_ - 1].side_ !=chsq16.side_) & (NowBoard.sq_[chsq16.rank_ - 1][chsq16.file_ - 1].piece_ !=0)) { c[depth]=chsq16.file_ - 1; d[depth]=chsq16.rank_ - 1; MaybeAdd(g, chsq16, fourcb, fourcb1); } if(chsq16.file_ < 16 && (NowBoard.sq_[chsq16.rank_ + 1][chsq16.file_ - 1].side_ !=0) & (NowBoard.sq_[chsq16.rank_ + 1][chsq16.file_ - 1].side_ !=chsq16.side_) & (NowBoard.sq_[chsq16.rank_ + 1][chsq16.file_ - 1].piece_ !=0)) { c[depth]=chsq16.file_ - 1; d[depth]=chsq16.rank_ + 1; MaybeAdd(g, chsq16, fourcb, fourcb1); } } if((i_began_as[chsq16.rank_][chsq16.file_]==1) & (chsq16.rank_ < 16)) { if(NowBoard.sq_[chsq16.rank_ + 1][chsq16.file_].piece_==0) { c[depth]=chsq16.file_; d[depth]=chsq16.rank_ + 1; MaybeAdd(g, chsq16, fourcb, fourcb1); } if((chsq16.rank_==2) & (NowBoard.sq_[3][chsq16.file_].piece_==0) & (NowBoard.sq_[4][chsq16.file_].piece_==0)) { c[depth]=chsq16.file_; d[depth]=4; MaybeAdd(g, chsq16, fourcb, fourcb1); } if(chsq16.file_ > 1 && (NowBoard.sq_[chsq16.rank_ + 1][chsq16.file_ - 1].side_ !=0) & (NowBoard.sq_[chsq16.rank_ + 1][chsq16.file_ - 1].side_ !=chsq16.side_) & (NowBoard.sq_[chsq16.rank_ + 1][chsq16.file_ - 1].piece_ !=0)) { c[depth]=chsq16.file_ - 1; d[depth]=chsq16.rank_ + 1; MaybeAdd(g, chsq16, fourcb, fourcb1); } if(chsq16.file_ < 16 && (NowBoard.sq_[chsq16.rank_ + 1][chsq16.file_ + 1].side_ !=0) & (NowBoard.sq_[chsq16.rank_ + 1][chsq16.file_ + 1].side_ !=chsq16.side_) & (NowBoard.sq_[chsq16.rank_ + 1][chsq16.file_ + 1].piece_ !=0)) { c[depth]=chsq16.file_ + 1; d[depth]=chsq16.rank_ + 1; MaybeAdd(g, chsq16, fourcb, fourcb1); } } if((i_began_as[chsq16.rank_][chsq16.file_]==3) & (chsq16.rank_ > 1)) { if(NowBoard.sq_[chsq16.rank_ - 1][chsq16.file_].piece_==0) { c[depth]=chsq16.file_; d[depth]=chsq16.rank_ - 1; MaybeAdd(g, chsq16, fourcb, fourcb1); } if((chsq16.rank_==15) & (NowBoard.sq_[14][chsq16.file_].piece_==0) & (NowBoard.sq_[13][chsq16.file_].piece_==0)) { c[depth]=chsq16.file_; d[depth]=13; MaybeAdd(g, chsq16, fourcb, fourcb1); } if(chsq16.file_ > 1 && (NowBoard.sq_[chsq16.rank_ - 1][chsq16.file_ - 1].side_ !=0) & (NowBoard.sq_[chsq16.rank_ - 1][chsq16.file_ - 1].side_ !=chsq16.side_) & (NowBoard.sq_[chsq16.rank_ - 1][chsq16.file_ - 1].piece_ !=0)) { c[depth]=chsq16.file_ - 1; d[depth]=chsq16.rank_ - 1; MaybeAdd(g, chsq16, fourcb, fourcb1); } if(chsq16.file_ < 16 && (NowBoard.sq_[chsq16.rank_ - 1][chsq16.file_ + 1].side_ !=0) & (NowBoard.sq_[chsq16.rank_ - 1][chsq16.file_ + 1].side_ !=chsq16.side_) & (NowBoard.sq_[chsq16.rank_ - 1][chsq16.file_ + 1].piece_ !=0)) { c[depth]=chsq16.file_ + 1; d[depth]=chsq16.rank_ - 1; MaybeAdd(g, chsq16, fourcb, fourcb1); } } } if(chsq16.piece_==-2) { MaybeCastleKingside(g, chsq16.side_); MaybeCastleQueenside(g, chsq16.side_); } return true; } public void init() { i_began_as=new int[18][18]; halt_if_king_taken=true; term_counts=new int[5]; best_four_count=new int[7]; KingRank=new int[5]; KingFile=new int[5]; niceblue=new Color(0, 192, 255); Attackers=new int[17][17][5]; StrongestAttacker=new int[17][17][5]; WeakestAttacker=new int[17][17][5]; NowBoard=new FourCB(316); SaveBoard=new FourCB(316); BackBoard=new FourCB(316); MaybeBoard=new FourCB(316); OneBoard=new FourCB(316); TwoBoard=new FourCB(316); ThreeBoard=new FourCB(316); FourBoard=new FourCB(316); icanmove=new boolean[18][18]; happySquare=new Chsq16(1, 1, 5, 1); MaybeMoves=new Chmo16[1001]; c=new int[7]; d=new int[7]; x_run=new int[7]; y_run=new int[7]; z_run=new int[7]; CheckSquare=new boolean[7]; SquatterOnCheckSquare=new boolean[7]; f1=new Font("Arial", 0, 12); f2=new Font("Arial", 0, 18); f3=new Font("Arial", 0, 8); WhoIsHuman=new boolean[5]; ILost=new boolean[5]; wins=new int[5]; depth=0; WhoIsHuman[1]=true; WhoIsHuman[2]=false; WhoIsHuman[3]=false; WhoIsHuman[4]=false; GameOver=false; drawn_games=0; Graphics g=getGraphics(); setBackground(niceblue); markingAPiece=true; for(aaa=1; aaa <=1000; aaa++) MaybeMoves[aaa]=new Chmo16(happySquare, happySquare); WhoIsHuman[0]=true; WhoIsHuman[1]=true; WhoIsHuman[2]=false; WhoIsHuman[3]=false; WhoIsHuman[4]=false; wins[0]=0; wins[1]=0; wins[2]=0; millipede1=System.currentTimeMillis(); for(aaa=0; aaa < 18; aaa++) for(bbb=0; bbb < 18; bbb++) { NowBoard.sq_[bbb][aaa]=new Chsq16(bbb, aaa, 0, 0); MaybeBoard.sq_[bbb][aaa]=new Chsq16(bbb, aaa, 0, 0); NowBoard.sq_[bbb][aaa].rank_=bbb; NowBoard.sq_[bbb][aaa].file_=aaa; MaybeBoard.sq_[bbb][aaa].rank_=bbb; MaybeBoard.sq_[bbb][aaa].file_=aaa; } millipede2=System.currentTimeMillis(); how_deep_to_seek=1; StartUp(g); } public void inquire_about_terms() { } public boolean markAPiece(Graphics g, int i, int j) { if(NowBoard.sq_[i][j].side_ !=whoseMove) return false; moveCounter=0; c[depth]=j; d[depth]=i; mover_rank=i; mover_file=j; moveCounter=0; findPieceMoves(g, NowBoard.sq_[mover_rank][mover_file], NowBoard, MaybeBoard); if(moveCounter==0) { stringy=NowBoard.sq_[mover_rank][mover_file].moniker();ShowStatusQ("That "+stringy+" cannot move."); NowBoard.sq_[i][j].drawchsq(g, 1, icanmove[i][j]); drawballs(g,NowBoard.sq_[i][j]); return false; } if(moveCounter==0) ShowStatusQ("Not that unit."); NowBoard.sq_[i][j].drawchsq(g, 2, false); drawballs(g,NowBoard.sq_[i][j]); for(x=1; x <=moveCounter; x++) MaybeMoves[x].endingsquare_.markchsq(g); markingAPiece=false; return true; } public boolean mouseDown(Event event, int i, int j) { if(NowBoard==null) return true; Graphics g=getGraphics(); ShowStatusNothing(); if(GameOver) { GameOver=false; StartUp(g); repaint(); return true; } a_square=i / 30; b_square=17 - j / 30; if((i >=576) & (j >=36) & (i <=624) & (j <=54)) { humanizing=true; WhoIsHuman[1]=true; SayWhoIsHuman(g); } else if((i >=637) & (j >=36) & (i <=698) & (j <=54)) { humanizing=true; WhoIsHuman[1]=false; SayWhoIsHuman(g); } else if((i >=576) & (j >=56) & (i <=624) & (j <=74)) { humanizing=true; WhoIsHuman[2]=true; SayWhoIsHuman(g); } else if((i >=637) & (j >=56) & (i <=698) & (j <=74)) { humanizing=true; WhoIsHuman[2]=false; SayWhoIsHuman(g); } else if((i >=576) & (j >=76) & (i <=624) & (j <=94)) { humanizing=true; WhoIsHuman[3]=true; SayWhoIsHuman(g); } else if((i >=637) & (j >=76) & (i <=698) & (j <=94)) { humanizing=true; WhoIsHuman[3]=false; SayWhoIsHuman(g); } else if((i >=576) & (j >=96) & (i <=624) & (j <=114)) { humanizing=true; WhoIsHuman[4]=true; SayWhoIsHuman(g); } else if((i >=637) & (j >=96) & (i <=698) & (j <=114)) { humanizing=true; WhoIsHuman[4]=false; SayWhoIsHuman(g); } else if((i >=560) & (j >=160) & (i < 660) & (j < 180)) { humanizing=false; SayWhoIsHuman(g); if(accepted_terms) { if(who_is_winning !=0) GameOver=true; if(who_is_winning==1) wins[1]++; if(who_is_winning==2) wins[2]++; if(who_is_winning==3) drawn_games++; if(who_is_winning !=0) { StartUp(g); repaint(); markingAPiece=true; return true; } } } if(humanizing) return true; UnTwoThePawns(whoseMove); if((a_square < 1) | (a_square > 16) | (b_square < 1) | (b_square > 16)) return true; if(WhoIsHuman[whoseMove]) if(markingAPiece) { if(!IsThisSideAbleToMove(g, whoseMove)) { ShowStatusQ("No moves! Click...."); NextPlayer(g); return true; } markAPiece(g, b_square, a_square); } else if(HumanMoveAPiece(g, b_square, a_square)) { if(GameOver) return true; NextPlayer(g); } while((!WhoIsHuman[whoseMove]) & (!GameOver)) { MachineMoves(g, whoseMove); if(GameOver) return true; NextPlayer(g); UnTwoThePawns(whoseMove); } return true; } public boolean opening_library() { return false; } public void paint(Graphics g) { setBackground(niceblue); if(NowBoard==null) { g.setColor(Color.black); g.setFont(f1); AssignVariantName();g.drawString("Thank you for playing " + variant_name + "!", 5, 20); g.drawString("Final totals: White " + wins[1] + " Blue " + wins[2] + " Red " + wins[3] + " Gold " + wins[4] + " Drawn " + drawn_games, 5, 50); return; } for(aaa=1; aaa <=16; aaa++) for(bbb=1; bbb <=16; bbb++) if((aaa > 4) & (aaa < 13) | (bbb > 4) & (bbb < 13)) { NowBoard.sq_[bbb][aaa].drawchsq(g, 1, icanmove[bbb][aaa]); drawballs(g,NowBoard.sq_[bbb][aaa]); } g.setColor(niceblue); g.fillRect(520, 31, 300, 29);g.setColor(Color.black);g.setFont(f1);NameThisChessVariant(g); g.setColor(Color.black); g.setFont(f1); g.setColor(Color.black); SayWhoIsHuman(g); if((!markingAPiece) & (WhoIsHuman[whoseMove])) { NowBoard.sq_[mover_rank][mover_file].drawchsq(g, 2, false); drawballs(g,NowBoard.sq_[mover_rank][mover_file]); for(x=1; x <=moveCounter; x++) MaybeMoves[x].endingsquare_.markchsq(g); } } public void stop() { NowBoard=null; MaybeBoard=null; OneBoard=null; TwoBoard=null; ThreeBoard=null; FourBoard=null; MaybeMoves=null; Attackers=null; destroy(); } public void unalterMaybeBoard(Graphics g, Chsq16 chsq16, Chsq16 chsq16_1, FourCB fourcb, FourCB fourcb1) { fourcb1.sq_[chsq16.rank_][chsq16.file_].piece_=fourcb.sq_[chsq16.rank_][chsq16.file_].piece_; fourcb1.sq_[chsq16.rank_][chsq16.file_].side_=fourcb.sq_[chsq16.rank_][chsq16.file_].side_; fourcb1.sq_[chsq16_1.rank_][chsq16_1.file_].piece_=fourcb.sq_[chsq16_1.rank_][chsq16_1.file_].piece_; fourcb1.sq_[chsq16_1.rank_][chsq16_1.file_].side_=fourcb.sq_[chsq16_1.rank_][chsq16_1.file_].side_; fourcb1.sq_[chsq16.rank_][chsq16_1.file_].side_=fourcb.sq_[chsq16.rank_][chsq16_1.file_].side_; } public void whatpiecescanmove(Graphics g) { for(ee=1; ee < 17; ee++) for(ff=1; ff < 17; ff++) { icanmove[ff][ee]=false; moveCounter=0; if(NowBoard.sq_[ff][ee].piece_ < 0) { KingRank[NowBoard.sq_[ff][ee].side_]=ff; KingFile[NowBoard.sq_[ff][ee].side_]=ee; } if(whoseMove==NowBoard.sq_[ff][ee].side_) { skipDtGM=true; findPieceMoves(g, NowBoard.sq_[ff][ee], NowBoard, MaybeBoard); skipDtGM=false; if(moveCounter > 0) icanmove[ff][ee]=true; } } } static String variant_name; int term_counts[]; static boolean accepted_terms; static int who_is_winning; static int how_deep_to_seek; public static long millipede1; public static long millipede2; static int gametreecounter; int best_four_count[]; static int vcom1; static int vcom2; static int vcom3; static int vcom4; static int bestvcom1; static int bestvcom2; static int bestvcom3; static int bestvcom4; static boolean skipDtGM; static boolean worried; int KingRank[]; int KingFile[]; static int cee; static int dee; static int eee; static int xee; static int yee; static int assailant_rank; static int assailant_file; static int assailant2_rank; static int assailant2_file; Color niceblue; int Attackers[][][]; int StrongestAttacker[][][]; int WeakestAttacker[][][]; FourCB NowBoard; FourCB BackBoard; FourCB SaveBoard; FourCB MaybeBoard; FourCB OneBoard; FourCB TwoBoard; FourCB ThreeBoard; FourCB FourBoard; boolean icanmove[][]; Chsq16 happySquare; Chmo16 MaybeMoves[]; static int ArchiveCounter; static int fifties_got_to; static int goodmove1; static int goodmove2; static int goodmove3; static int goodmove4; static int goodmove5; static int goodmove6; static int goodmove7; static int goodmove8; static int goodmove9; static int goodmove10; static int GM1count; static int GM2count; static int GM3count; static int GM4count; static int GM5count; static int GM6count; static int GM7count; static int GM8count; static int GM9count; static int GM10count; int c[]; int d[]; int x_run[]; int y_run[]; int z_run[]; static int x; static int y; static int z; static int aaa; static int bbb; static int depth; static int e; static int f; static int h; static int moveCounter; static int xx; static int yy; static int cc; static int dd; static int ee; static int ff; static int xxx; static int yyy; static int a; static int b; static int a_square; static int b_square; static int ControlsNorth; static int ControlsSouth; static int ControlsEast; static int ControlsWest; static int satt; static int patt; static int zatt; static int yatt; static int xatt; static int datt; static int catt; static int xq; static int yq; static int good_move; static int good_counter; boolean CheckSquare[]; boolean SquatterOnCheckSquare[]; static boolean markingAPiece; static boolean GameOver; static boolean humanizing; static int mover_rank; static int mover_file; static int moveto_rank; static int moveto_file; static int queening_rank; static int queening_file; Font f1; Font f2; Font f3; static int drawn_games; static int fifty_move_rule; static int whoseMove; boolean WhoIsHuman[]; boolean ILost[]; int wins[]; static String stringy; static boolean halt_if_king_taken; int i_began_as[][]; static int turncounter;static int saved_turncounter;static int back_turncounter;static int saved_fifty_move_rule;static int back_fifty_move_rule; static char oopsKey; static char loadKey; static char saveKey; static int who_backed; static int who_saved;static int when_saved; }