// 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: NewFour.java import java.applet.Applet; import java.awt.*; public class NewFour extends Applet { public NewFour() { } public boolean SomeInitialConditionForKeydown(){ // System.out.println("Backup keys have been disabled"); // return true; return false; } 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) { PromotingAPawn=false; 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) { PromotingAPawn=false; 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 < 13; xxx++) for(yyy=0; yyy < 13; 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 < 13; xxx++) for(yyy=0; yyy < 13; 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 < 13; xxx++) for(yyy=0; yyy < 13; 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 < 13; xxx++) for(yyy=0; yyy < 13; 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 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 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 > 12) | (datt > 12) | (catt < 1) | (datt < 1)) { return; } else { Attackers[datt][catt][satt]=Attackers[datt][catt][satt] + 1; if (StrongestAttacker[datt][catt][whoseteam(satt)]NowBoard.sq_[yatt][xatt].strength()) | (WeakestAttacker[datt][catt][whoseteam(satt)]==0)) {WeakestAttacker[datt][catt][whoseteam(satt)]=NowBoard.sq_[yatt][xatt].strength();} return; } } public void AlsoMark(Graphics g) { } public boolean AmIUnderAttack(int i, int j, int k) { if(SupplementalAmIUnderAttackers(i, j, k)) return true; cc=j + 1; dd=i; while(cc < 13) if(MaybeBoard.sq_[dd][cc].side_ == k) { cc=20; } else { if(IsEnemyRook(dd, cc)) return true; if(MaybeBoard.sq_[dd][cc].piece_ != 0) cc=20; 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 < 13;) if(MaybeBoard.sq_[dd][cc].side_ == k) { dd=20; } else { if(IsEnemyRook(dd, cc)) return true; if(MaybeBoard.sq_[dd][cc].piece_ != 0) dd=20; 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 < 13) & (dd < 13);) if(MaybeBoard.sq_[dd][cc].side_ == k) { cc=20; } else { if(IsEnemyBishop(dd, cc)) return true; if(MaybeBoard.sq_[dd][cc].piece_ != 0) cc=20; cc++; dd++; } cc=j + 1; for(dd=i - 1; (cc < 13) & (dd > 0);) if(MaybeBoard.sq_[dd][cc].side_ == k) { cc=20; } else { if(IsEnemyBishop(dd, cc)) return true; if(MaybeBoard.sq_[dd][cc].piece_ != 0) cc=20; cc++; dd--; } cc=j - 1; for(dd=i + 1; (cc > 0) & (dd < 13);) 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(IsEnemySouthWestPawn(dd, cc, k)) return true; cc=j + 1; dd=i - 1; if(IsEnemyNorthWestPawn(dd, cc, k)) return true; cc=j - 1; dd=i + 1; if(IsEnemySouthEastPawn(dd, cc, k)) return true; cc=j - 1; dd=i - 1; return IsEnemyNorthEastPawn(dd, cc, k); } public boolean AmIUnderSparrowAttack(int i, int j, int k) { if(SupplementalAmIUnderSparrowAttackers(i, j, k)) return true; cc=j + 1; dd=i; while(cc < 13) if(MaybeBoard.sq_[dd][cc].side_ == k) { cc=20; } else { if(IsEnemyRook(dd, cc) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; if(MaybeBoard.sq_[dd][cc].piece_ != 0) cc=20; 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()) return true; if(MaybeBoard.sq_[dd][cc].piece_ != 0) cc=-1; cc--; } cc=j; for(dd=i + 1; dd < 13;) if(MaybeBoard.sq_[dd][cc].side_ == k) { dd=20; } else { if(IsEnemyRook(dd, cc) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; if(MaybeBoard.sq_[dd][cc].piece_ != 0) dd=20; 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()) return true; if(MaybeBoard.sq_[dd][cc].piece_ != 0) dd=-1; dd--; } cc=j + 1; for(dd=i + 1; (cc < 13) & (dd < 13);) if(MaybeBoard.sq_[dd][cc].side_ == k) { cc=20; } else { if(IsEnemyBishop(dd, cc) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; if(MaybeBoard.sq_[dd][cc].piece_ != 0) cc=20; cc++; dd++; } cc=j + 1; for(dd=i - 1; (cc < 13) & (dd > 0);) if(MaybeBoard.sq_[dd][cc].side_ == k) { cc=20; } else { if(IsEnemyBishop(dd, cc) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; if(MaybeBoard.sq_[dd][cc].piece_ != 0) cc=20; cc++; dd--; } cc=j - 1; for(dd=i + 1; (cc > 0) & (dd < 13);) if(MaybeBoard.sq_[dd][cc].side_ == k) { cc=-1; } else { if(IsEnemyBishop(dd, cc) && 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()) 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()) return true; cc=j - 1; dd=i; if(IsEnemyKing(dd, cc, k) && 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()) return true; cc=j; dd=i - 1; if(IsEnemyKing(dd, cc, k) && 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()) return true; cc=j + 1; dd=i - 1; if(IsEnemyKing(dd, cc, k) && 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()) return true; cc=j + 1; dd=i + 1; if(IsEnemyKing(dd, cc, k) && 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()) return true; cc=j - 2; dd=i + 1; if(IsEnemyKnight(dd, cc, k) && 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()) return true; cc=j + 2; dd=i + 1; if(IsEnemyKnight(dd, cc, k) && 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()) return true; cc=j - 1; dd=i + 2; if(IsEnemyKnight(dd, cc, k) && 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()) return true; cc=j + 1; dd=i + 2; if(IsEnemyKnight(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j + 1; dd=i + 1; if(IsEnemySouthWestPawn(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j + 1; dd=i - 1; if(IsEnemyNorthWestPawn(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j - 1; dd=i + 1; if(IsEnemySouthEastPawn(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j - 1; dd=i - 1; return IsEnemyNorthEastPawn(dd, cc, k) && 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 < 13; xxx++) for(yyy=1; yyy < 13; 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 boolean AnotherWayToCheck(int i) { return false; } public boolean AnotherWayToEndGame(Graphics g, int i) { return false; } public void Archives() { ArchiveCounter=0; for(ff=1; ff < 15; ff++) for(ee=1; ee < 15; ee++) { ArchiveBoard[fifty_move_rule].sq_[ff][ee].piece_=NowBoard.sq_[ff][ee].piece_; ArchiveBoard[fifty_move_rule].sq_[ff][ee].side_=NowBoard.sq_[ff][ee].side_; } ArchiveBoard[fifty_move_rule].sq_[0][0].side_=whoseMove; for(xxx=0; xxx < fifty_move_rule; xxx++) { if(DoesArchiveMatchNowBoard()) ArchiveCounter++; if(ArchiveCounter > 1) { drawn_games++; ShowStatusQ("Draw By Repetition"); GameOver=true; return; } } } public void CountAllThePieces() { ZeroAllFiveCounts(); for(xxx=1; xxx < 13; xxx++) for(yyy=1; yyy < 13; yyy++) { if(NowBoard.sq_[yyy][xxx].piece_ == 401) PawnCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_ == 402) PawnCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_ == 403) PawnCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_ == 404) PawnCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_ == 2) PawnCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_ == 3) KnightCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_ == 260) BishopCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_ == 4) BishopCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_ == 5) RookCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_ == 6) RookCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_ == 9) QueenCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_ == 223) QueenCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_ == 224) QueenCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_ < 0) KingCount[NowBoard.sq_[yyy][xxx].side_]++; } } public void DesignateTheFineMoves(Chsq chsq) { good_move=1; if((skipDtGM) | (depth > 1) | (worried)) return; if(IsMySideInCheck(nextplayer(chsq.side_))) good_move += 5; if(IsMySideInCheck(secondenemy(chsq.side_))) good_move += 5; if(chsq.strength() < NowBoard.sq_[d[depth]][c[depth]].strength()) good_move=(good_move + 3 * NowBoard.sq_[d[depth]][c[depth]].strength()) - chsq.strength(); if((Attackers[chsq.rank_][chsq.file_][nextplayer(chsq.side_)] + Attackers[chsq.rank_][chsq.file_][secondenemy(chsq.side_)] > 0) & (Attackers[d[depth]][c[depth]][nextplayer(chsq.side_)] + Attackers[d[depth]][c[depth]][secondenemy(chsq.side_)] == 0)) good_move += 5 * chsq.strength(); if((NowBoard.sq_[d[depth]][c[depth]].piece_ > 0) & (Attackers[d[depth]][c[depth]][chsq.side_] + Attackers[d[depth]][c[depth]][partner(chsq.side_)] > Attackers[d[depth]][c[depth]][nextplayer(chsq.side_)] + Attackers[d[depth]][c[depth]][secondenemy(chsq.side_)])) good_move += 3 * NowBoard.sq_[d[depth]][c[depth]].strength(); } public void DesignateTheGoodMoves(Chsq chsq) { if((whoseMove != chsq.side_) | (skipDtGM) | (depth > 1)|(partner(chsq.side_)==NowBoard.sq_[d[depth]][c[depth]].side_)) return; IncrediblyGoodMove(chsq); if ((Attackers[chsq.rank_][chsq.file_][nextplayer(chsq.side_)]+ Attackers[chsq.rank_][chsq.file_][secondenemy(chsq.side_)] >Attackers[chsq.rank_][chsq.file_][chsq.side_]+ Attackers[chsq.rank_][chsq.file_][partner(chsq.side_)] )) { if (AmIUnderAttack(d[depth],c[depth],nextplayer(chsq.side_))==true) AssignGoodMove1(); } if((AmIUnderAttack(d[depth],c[depth],whoseMove)==false) && (NowBoard.sq_[d[depth]][c[depth]].strength() > 3) && Math.random() * 100D < 139D) AssignGoodMove9(); if(NowBoard.sq_[d[depth]][c[depth]].piece_ < 0) goodmove10=moveCounter; if(NowBoard.sq_[d[depth]][c[depth]].strength() > 1 + chsq.strength() && Math.random() * 100D < 138D && !worried) AssignGoodMove9(); if(NowBoard.sq_[d[depth]][c[depth]].strength() > 2 + chsq.strength() && !worried) AssignGoodMove9(); if((chsq.strength() > 3) & (Attackers[chsq.rank_][chsq.file_][nextplayer(chsq.side_)] + Attackers[chsq.rank_][chsq.file_][secondenemy(chsq.side_)] > 0) & (AmIUnderAttack(d[depth],c[depth],whoseMove)==false) && (Math.random() * 100D < 137D && !worried)) {AssignGoodMove8();if (NowBoard.sq_[d[depth]][c[depth]].piece_!=0){AssignGoodMove9();}} if((AmIUnderAttack(d[depth],c[depth],whoseMove)==false) & (NowBoard.sq_[d[depth]][c[depth]].strength() > 3) && (Math.random() * 100D < 136D && !worried)) AssignGoodMove7(); if((chsq.strength() < 3) & (NowBoard.sq_[d[depth]][c[depth]].strength() > 3) && (Math.random() * 100D < 135D && !worried)) AssignGoodMove6(); if((chsq.strength() > 2) & (Attackers[chsq.rank_][chsq.file_][nextplayer(chsq.side_)] + Attackers[chsq.rank_][chsq.file_][secondenemy(chsq.side_)] > 0) & (AmIUnderAttack(d[depth],c[depth],whoseMove)==false) && (Math.random() * 100D < 134D && !worried)) {AssignGoodMove8();if (NowBoard.sq_[d[depth]][c[depth]].piece_!=0){AssignGoodMove9();}} if((AmIUnderAttack(d[depth],c[depth],whoseMove)==false) & (NowBoard.sq_[d[depth]][c[depth]].strength() > 1) && (Math.random() * 100D < 133D && !worried)) AssignGoodMove4(); if(chsq.strength() < NowBoard.sq_[d[depth]][c[depth]].strength() && Math.random() * 100D < 132D && !worried) AssignGoodMove3(); if((AmIUnderAttack(d[depth],c[depth],whoseMove)==false) & ((IsMySideInCheck(nextplayer(chsq.side_))) | (IsMySideInCheck(secondenemy(chsq.side_)))) && (Math.random() * 100D < 131D && !worried)) AssignGoodMove2(); if ((StrongestAttacker[d[depth]][c[depth]][3-whoseteam(chsq.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[chsq.rank_][chsq.file_][3-whoseteam(chsq.side_)]>0) &(StrongestAttacker[chsq.rank_][chsq.file_][3-whoseteam(chsq.side_)]0) &(Attackers[chsq.rank_][chsq.file_][chsq.side_]==0) &(StrongestAttacker[d[depth]][c[depth]][3-whoseteam(chsq.side_)]==0) &(Math.random() * 100D < 98D) ) { switch(chsq.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 > 8) & (chsq.pawn()) & (Math.random() * 100D < (double)(100 - 10 * PawnCount[chsq.side_])) & (!worried) & (AmIUnderAttack(d[depth],c[depth],whoseMove)==false)) AssignGoodMove1(); if((WeakestAttacker[d[depth]][c[depth]][3-whoseteam(chsq.side_)]>=chsq.strength())&(Attackers[d[depth]][c[depth]][nextplayer(chsq.side_)] + Attackers[d[depth]][c[depth]][secondenemy(chsq.side_)] < Attackers[d[depth]][c[depth]][chsq.side_] + Attackers[d[depth]][c[depth]][chsq.side_]) & (NowBoard.sq_[d[depth]][c[depth]].piece_ != 0) && (Math.random() * 100D < 130D && !worried)) AssignGoodMove1(); MoreGoodMoves(chsq); } public void DidICheckOrStalemate(Graphics g, int i) { } public void DisplayRules(Graphics g) { LowRectangle(g); g.drawString("Win by capturing the last king. Units belonging to a player in checkmate cannot", 5, 405); g.drawString("be taken but to give check until king is taken. If your are in checkmate or", 5, 421); g.drawString("otherwise cannot move, your turn passes. Taking a mated king eliminates that", 5, 437); g.drawString("starting area, with capturer repatriating. All promotions are to queens.", 5, 453); } public boolean DoesArchiveMatchNowBoard() { if(whoseMove != ArchiveBoard[xxx].sq_[0][0].side_) return false; for(ff=1; ff < 15; ff++) for(ee=1; ee < 15; ee++) { if(NowBoard.sq_[ff][ee].piece_ != ArchiveBoard[xxx].sq_[ff][ee].piece_) return false; if(NowBoard.sq_[ff][ee].piece_ != ArchiveBoard[xxx].sq_[ff][ee].piece_) return false; } return true; } public void DrawMaybeBoard(Graphics g) { for(ee=1; ee < 13; ee++) for(ff=1; ff < 13; ff++) MaybeBoard.sq_[ff][ee].drawchsq2(g, 1); } public void DrawNowBoard(Graphics g) { for(ee=1; ee < 13; ee++) for(ff=1; ff < 13; ff++) if((!AmICheckmated[NowBoard.sq_[ff][ee].side_]) & (!terminated[NowBoard.sq_[ff][ee].side_])) NowBoard.sq_[ff][ee].draw4_12(g, 1, DeadZone[ff][ee], icanmove[ff][ee]); else NowBoard.sq_[ff][ee].blacken4_12(g); } public void DrawPromotionOptions(Graphics g) { g.setColor(niceblue); g.fillRect(0, 391, 480, 74); g.setColor(Color.black); g.setFont(f2); g.drawString("Choose: ", 5, 320); happySquare.side_=whoseMove; happySquare.rank_=-1; happySquare.file_=3; happySquare.piece_=9; happySquare.draw4_12(g, 1, true, false); happySquare.file_=4; happySquare.piece_=5; happySquare.draw4_12(g, 1, true, false); happySquare.file_=5; happySquare.piece_=4; happySquare.draw4_12(g, 1, true, false); happySquare.file_=6; happySquare.piece_=3; happySquare.draw4_12(g, 1, true, false); } public void ForGambler(Graphics g) { } public void GenerateAttackersArrays() { for(zatt=1; zatt < 3; zatt++) for(yatt=1; yatt < 13; yatt++) for(xatt=1; xatt < 13; xatt++) { Attackers[yatt][xatt][zatt]=0; StrongestAttacker[yatt][xatt][zatt]=0; WeakestAttacker[yatt][xatt][zatt]=0; } for(yatt=1; yatt < 13; yatt++) for(xatt=1; xatt < 13; xatt++) { satt=NowBoard.sq_[yatt][xatt].side_; patt=NowBoard.sq_[yatt][xatt].piece_; SupplementalAddAnAttacker(); if((patt == 5) | (patt == 9)) { catt=xatt; datt=yatt; for(; catt < 13; catt++) { AddAnAttacker(); if((catt != xatt) & (NowBoard.sq_[datt][catt].side_ != 0)) catt=20; } 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 < 13; datt++) { AddAnAttacker(); if((datt != yatt) & (NowBoard.sq_[datt][catt].side_ != 0)) datt=20; } 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 < 13) & (datt < 13); datt++) { AddAnAttacker(); if((catt != xatt) & (NowBoard.sq_[datt][catt].side_ != 0)) catt=20; catt++; } catt=xatt; for(datt=yatt; (catt > 0) & (datt < 13); datt++) { AddAnAttacker(); if((catt != xatt) & (NowBoard.sq_[datt][catt].side_ != 0)) catt=-20; catt--; } catt=xatt; for(datt=yatt; (catt < 13) & (datt > 0); catt++) { AddAnAttacker(); if((datt != yatt) & (NowBoard.sq_[datt][catt].side_ != 0)) catt=20; 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) | (patt == 25)) { 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 == 401) { datt=yatt + 1; catt=xatt + 1; AddAnAttacker(); datt=yatt + 1; catt=xatt - 1; AddAnAttacker(); } if(patt == 403) { datt=yatt - 1; catt=xatt + 1; AddAnAttacker(); datt=yatt - 1; catt=xatt - 1; AddAnAttacker(); } if(patt == 402) { datt=yatt + 1; catt=xatt + 1; AddAnAttacker(); datt=yatt - 1; catt=xatt + 1; AddAnAttacker(); } if(patt == 404) { datt=yatt + 1; catt=xatt - 1; AddAnAttacker(); datt=yatt - 1; catt=xatt - 1; AddAnAttacker(); } } } public boolean HumanMoveAPiece(Graphics g, int i, int j) { moveto_rank=i; moveto_file=j; if((mover_rank == moveto_rank) & (mover_file == moveto_file)) { markingAPiece=true; DrawNowBoard(g); return false; } if(!IsMyMoveListed()) { return false; } else { TotalBackBoard(); who_backed=whoseMove; NormalMove(g); TotalMaybeBoard(NowBoard,MaybeBoard);DidICheckOrStalemate(g, whoseMove); IsTheGameOver(); markingAPiece=true; DrawNowBoard(g); TotalMaybeBoard(NowBoard, MaybeBoard); TotalMaybeBoard(MaybeBoard, TwoBoard); TotalMaybeBoard(TwoBoard, ThreeBoard); TotalMaybeBoard(ThreeBoard, FourBoard); return true; } } public void IncrediblyGoodMove(Chsq chsq) { } public boolean IsEnemyBishop(int i, int j) { if((j > 12) | (j < 1) | (i > 12) | (i < 1)) return false; if(terminated[MaybeBoard.sq_[i][j].side_]) 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 > 12) | (j < 1) | (i > 12) | (i < 1)) return false; if(terminated[MaybeBoard.sq_[i][j].side_]) return false; if(MaybeBoard.sq_[i][j].side_ == k) return false; if(MaybeBoard.sq_[i][j].piece_ == -1) { assailant_rank=i; assailant_file=j; return true; } else { return false; } } public boolean IsEnemyKnight(int i, int j, int k) { if((j > 12) | (j < 1) | (i > 12) | (i < 1)) return false; if(terminated[MaybeBoard.sq_[i][j].side_]) 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 IsEnemyNorthEastPawn(int i, int j, int k) { if((j > 12) | (j < 1) | (i > 12) | (i < 1)) return false; if(terminated[MaybeBoard.sq_[i][j].side_]) return false; if(MaybeBoard.sq_[i][j].side_ == k) return false; if(MaybeBoard.sq_[i][j].piece_ == 402) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 401) { assailant_rank=i; assailant_file=j; return true; } else { return false; } } public boolean IsEnemyNorthWestPawn(int i, int j, int k) { if((j > 12) | (j < 1) | (i > 12) | (i < 1)) return false; if(terminated[MaybeBoard.sq_[i][j].side_]) return false; if(MaybeBoard.sq_[i][j].side_ == k) return false; if(MaybeBoard.sq_[i][j].piece_ == 404) return true; return MaybeBoard.sq_[i][j].piece_ == 401; } public boolean IsEnemyRook(int i, int j) { if((j > 12) | (j < 1) | (i > 12) | (i < 1)) return false; if(terminated[MaybeBoard.sq_[i][j].side_]) 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 IsEnemySouthEastPawn(int i, int j, int k) { if((j > 12) | (j < 1) | (i > 12) | (i < 1)) return false; if(terminated[MaybeBoard.sq_[i][j].side_]) return false; if(MaybeBoard.sq_[i][j].side_ == k) return false; if(MaybeBoard.sq_[i][j].piece_ == 402) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 403) { assailant_rank=i; assailant_file=j; return true; } else { return false; } } public boolean IsEnemySouthWestPawn(int i, int j, int k) { if((j > 12) | (j < 1) | (i > 12) | (i < 1)) return false; if(terminated[MaybeBoard.sq_[i][j].side_]) return false; if(MaybeBoard.sq_[i][j].side_ == k) return false; if(MaybeBoard.sq_[i][j].piece_ == 403) return true; return MaybeBoard.sq_[i][j].piece_ == 404; } 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) { if(AnotherWayToCheck(i)) return true; for(xxx=1; xxx < 13; xxx++) for(yyy=1; yyy < 13; yyy++) if((i == MaybeBoard.sq_[yyy][xxx].side_) & (MaybeBoard.sq_[yyy][xxx].piece_ < 0) && AmIUnderAttack(yyy, xxx, i)) return true; return false; } public boolean IsTheGameOver() { CountAllThePieces(); if((QueenCount[1] == 0) & (QueenCount[2] == 0) & (RookCount[1] == 0) & (RookCount[2] == 0) & (PawnCount[1] == 0) & (PawnCount[2] == 0)) { if((BishopCount[1] == 0) & (BishopCount[2] == 0) & (KnightCount[1] < 3) & (KnightCount[2] < 3)) { GameOver=true; drawn_games++; ShowStatusQ("Lack of force!"); return true; } if((BishopCount[1] < 2) & (BishopCount[2] < 2) & (KnightCount[1] == 0) & (KnightCount[2] == 0)) { GameOver=true; drawn_games++; ShowStatusQ("Lack of force!"); return true; } } return false; } public void LowRectangle(Graphics g) { g.setColor(niceblue); g.fillRect(0, 391, 480, 74); 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) { if(GameOver) return true; NegateGMCounts();goodmove1=0; goodmove2=0; goodmove3=0; goodmove4=0; goodmove5=0; goodmove6=0; goodmove7=0; goodmove8=0; goodmove9=0; goodmove10=0; 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] < 13; x_run[1]++) for(y_run[1]=1; y_run[1] < 13; 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(); 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_][nextplayer(i)] + Attackers[MaybeMoves[x].endingsquare_.rank_][MaybeMoves[x].endingsquare_.file_][secondenemy(i)] > Attackers[MaybeMoves[x].endingsquare_.rank_][MaybeMoves[x].endingsquare_.file_][i] + Attackers[MaybeMoves[x].endingsquare_.rank_][MaybeMoves[x].endingsquare_.file_][partner(i)]) x=1 + (int)Math.floor(Math.random() * (double)moveCounter); if(Attackers[MaybeMoves[x].endingsquare_.rank_][MaybeMoves[x].endingsquare_.file_][nextplayer(i)] + Attackers[MaybeMoves[x].endingsquare_.rank_][MaybeMoves[x].endingsquare_.file_][secondenemy(i)] > Attackers[MaybeMoves[x].endingsquare_.rank_][MaybeMoves[x].endingsquare_.file_][i] + Attackers[MaybeMoves[x].endingsquare_.rank_][MaybeMoves[x].endingsquare_.file_][partner(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].draw4_12(g, 1, DeadZone[mover_rank][mover_file], false); NowBoard.sq_[moveto_rank][moveto_file].draw4_12(g, 1, DeadZone[moveto_rank][moveto_file], false); 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(GameOver) return true; if(fifty_move_rule>100) { fifty_move_rule=0; DrawNowBoard(g);ShowStatusQ("Fifty move rule!"); drawn_games++; GameOver=true; return false; } else { return true; } } public boolean MaybeAdd(Graphics g, Chsq chsq, CB16_16 cb16_16, CB16_16 cb16_16_1) { assailant_rank=0; assailant2_rank=0; assailant_file=0; assailant2_file=0; CheckSquare[depth]=false; SquatterOnCheckSquare[depth]=false; if((c[depth] < 1) | (c[depth] > 12) | (d[depth] < 1) | (d[depth] > 12)) return false; if(!PassedOtherRequirementsToKeep(chsq, cb16_16, cb16_16_1)) return false; if(NowBoard.sq_[d[depth]][c[depth]].side_ == chsq.side_) return false; if(DeadZone[d[depth]][c[depth]]) return false; if(chsq.piece_ == 401) { if((c[depth] == 2) & (d[depth] == 3)) return false; if((c[depth] == 11) & (d[depth] == 3)) return false; } if(chsq.piece_ == 402) { if((c[depth] == 3) & (d[depth] == 2)) return false; if((c[depth] == 3) & (d[depth] == 11)) return false; } if(chsq.piece_ == 403) { if((c[depth] == 2) & (d[depth] == 10)) return false; if((c[depth] == 11) & (d[depth] == 10)) return false; } if(chsq.piece_ == 404) { if((c[depth] == 10) & (d[depth] == 2)) return false; if((c[depth] == 10) & (d[depth] == 11)) return false; } alterMaybeBoard(g, chsq, cb16_16.sq_[d[depth]][c[depth]], cb16_16, cb16_16_1); worried=AmIWorried(chsq.side_); if(IsMySideInCheck(chsq.side_)) { TotalMaybeBoard(cb16_16, cb16_16_1); CheckSquare[depth]=true; if(NowBoard.sq_[d[depth]][c[depth]].piece_ != 0) SquatterOnCheckSquare[depth]=true; return false; } if ((how_deep_to_seek<4)&(seek_sacrificial_wins==false)&(WhoIsHuman[whoseMove]==false)&(moveCounter>0)&(chsq.side_==whoseMove)) { if ((Attackers[d[depth]][c[depth]][3-whoseteam(chsq.side_)]>0)& ( (WeakestAttacker[d[depth]][c[depth]][3-whoseteam(chsq.side_)]Attackers[d[depth]][c[depth]][chsq.side_]-1) ) ) { // SquatterOnCheckSquare[depth]=true; SquatterOnCheckSquare[depth]=false; if(NowBoard.sq_[d[depth]][c[depth]].piece_ != 0) SquatterOnCheckSquare[depth]=true; if (NowBoard.sq_[d[depth]][c[depth]].piece_==0){CheckSquare[depth]=true;} TotalMaybeBoard(cb16_16, cb16_16_1); return false; } } good_move=1; 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_=chsq; MaybeMoves[moveCounter].endingsquare_=cb16_16.sq_[d[depth]][c[depth]]; } DesignateTheGoodMoves(chsq); if((worried) & (IsThisAGoodMove()==false) & (moveCounter > 1) & (!WhoIsHuman[whoseMove])) moveCounter--; TotalMaybeBoard(cb16_16, cb16_16_1); return NowBoard.sq_[d[depth]][c[depth]].side_ == 0; } public void MoreGoodMoves(Chsq chsq) { } public void AssignVariantName(){ variant_name="Four-Handed Chess III"; } public void NameThisChessVariant(Graphics g) { AssignVariantName();// "Four Handed Chess III"; g.setColor(niceblue); g.fillRect(0, 0, 300, 29); g.setColor(Color.black); g.setFont(f1);g.drawString(variant_name, 5, 15); g.drawString("About:", 360, 15); } public void NextOrdinaryPlayer(Graphics g) { IsTheGameOver(); goinghome=false; for(x_rex=1; x_rex < 15; x_rex++) for(y_rex=1; y_rex < 15; y_rex++) if((DeadZone[y_rex][x_rex]) & (NowBoard.sq_[y_rex][x_rex].piece_ != 0)) { goinghome=true; return; } AmICheckmated[0]=false; AmICheckmated[1]=false; AmICheckmated[2]=false; AmICheckmated[3]=false; AmICheckmated[4]=false; AmICheckmated[5]=false; AmICheckmated[6]=false; AmIParalyzed[0]=false; AmIParalyzed[1]=false; AmIParalyzed[2]=false; AmIParalyzed[3]=false; AmIParalyzed[4]=false; AmIParalyzed[5]=false; AmIParalyzed[6]=false; moveCounter=0; for(x=1; (x < 13) & (moveCounter == 0); x++) for(y=1; (y < 13) & (moveCounter == 0); y++) if(NowBoard.sq_[y][x].side_ == nextplayer(whoseMove)) findPieceMoves(g, NowBoard.sq_[y][x], NowBoard, MaybeBoard); if(moveCounter == 0) AmIParalyzed[nextplayer(whoseMove)]=true; moveCounter=0; for(x=1; (x < 13) & (moveCounter == 0); x++) for(y=1; (y < 13) & (moveCounter == 0); y++) if(NowBoard.sq_[y][x].side_ == partner(whoseMove)) findPieceMoves(g, NowBoard.sq_[y][x], NowBoard, MaybeBoard); if(moveCounter == 0) AmIParalyzed[partner(whoseMove)]=true; moveCounter=0; for(x=1; (x < 13) & (moveCounter == 0); x++) for(y=1; (y < 13) & (moveCounter == 0); y++) if(NowBoard.sq_[y][x].side_ == secondenemy(whoseMove)) findPieceMoves(g, NowBoard.sq_[y][x], NowBoard, MaybeBoard); if(moveCounter == 0) AmIParalyzed[secondenemy(whoseMove)]=true; if(AmIParalyzed[1] && IsMySideInCheck(1)) AmICheckmated[1]=true; if(AmIParalyzed[2] && IsMySideInCheck(2)) AmICheckmated[2]=true; if(AmIParalyzed[3] && IsMySideInCheck(3)) AmICheckmated[3]=true; if(AmIParalyzed[4] && IsMySideInCheck(4)) AmICheckmated[4]=true; DrawNowBoard(g); if(terminated[1]) AmIParalyzed[1]=true; if(terminated[2]) AmIParalyzed[2]=true; if(terminated[3]) AmIParalyzed[3]=true; if(terminated[4]) AmIParalyzed[4]=true; whoseMove=nextplayer(whoseMove); if (whoseMove==1){turncounter++;} UnTwoThePawns(whoseMove); whatpiecescanmove(g); if(AmIParalyzed[whoseMove]) { whoseMove=nextplayer(whoseMove); whatpiecescanmove(g); } if(AmIParalyzed[whoseMove]) { whoseMove=nextplayer(whoseMove); whatpiecescanmove(g); } if(AmIParalyzed[whoseMove]) { whoseMove=nextplayer(whoseMove); whatpiecescanmove(g); } if((AmIParalyzed[1]) & (AmIParalyzed[2]) & (AmIParalyzed[3])) { wins[4]++; ShowStatusQ("Gold wins!"); GameOver=true; return; } if((AmIParalyzed[2]) & (AmIParalyzed[3]) & (AmIParalyzed[4])) { wins[1]++; ShowStatusQ("Blue wins!"); GameOver=true; return; } if((AmIParalyzed[3]) & (AmIParalyzed[4]) & (AmIParalyzed[1])) { wins[2]++; ShowStatusQ("Red wins!"); GameOver=true; return; } if((AmIParalyzed[4]) & (AmIParalyzed[1]) & (AmIParalyzed[2])) { wins[3]++; ShowStatusQ("Green wins!"); GameOver=true; return; } ShowStatusNothing(); for(ee=1; ee < 13; ee++) for(ff=1; ff < 13; ff++) switch(whoseMove) { default: break; case 1: // '\001' if(NowBoard.sq_[ff][ee].piece_ == 405) NowBoard.sq_[ff][ee].piece_=401; break; case 2: // '\002' if(NowBoard.sq_[ff][ee].piece_ == 406) NowBoard.sq_[ff][ee].piece_=402; break; case 3: // '\003' if(NowBoard.sq_[ff][ee].piece_ == 407) NowBoard.sq_[ff][ee].piece_=403; break; case 4: // '\004' if(NowBoard.sq_[ff][ee].piece_ == 408) NowBoard.sq_[ff][ee].piece_=404; break; } } 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; } NormalMoveExtra(); if(NowBoard.sq_[moveto_rank][moveto_file].piece_ == -1) { regicide(NowBoard.sq_[moveto_rank][moveto_file].side_); if(slaughtered[1]) regicide(1); if(slaughtered[2]) regicide(2); if(slaughtered[3]) regicide(3); if(slaughtered[4]) regicide(4); if(slaughtered[1]) regicide(1); if(slaughtered[2]) regicide(2); if(slaughtered[3]) regicide(3); if(slaughtered[4]) regicide(4); } PawnStuff(g); if((NowBoard.sq_[moveto_rank][moveto_file].piece_ > 0) | (NowBoard.sq_[mover_rank][mover_file].piece_ == 401) | (NowBoard.sq_[mover_rank][mover_file].piece_ == 402) | (NowBoard.sq_[mover_rank][mover_file].piece_ == 403) | (NowBoard.sq_[mover_rank][mover_file].piece_ == 404) | (NowBoard.sq_[mover_rank][mover_file].piece_ == 51) | (NowBoard.sq_[mover_rank][mover_file].piece_ == 83) | (NowBoard.sq_[mover_rank][mover_file].piece_ == 85) | (NowBoard.sq_[mover_rank][mover_file].piece_ == 8101) | (NowBoard.sq_[mover_rank][mover_file].piece_ == 8102)) { fifty_move_rule=0; } else { fifty_move_rule++; if(fifty_move_rule > fifties_got_to) fifties_got_to=fifty_move_rule; } switch(NowBoard.sq_[moveto_rank][moveto_file].piece_) { case -1: CapturedAKing[whoseMove]=true; break; case -2: CapturedAKing[whoseMove]=true; break; case 1: // '\001' CapturedAPawn[whoseMove]=true; break; case 2: // '\002' CapturedAPawn[whoseMove]=true; break; case 3: // '\003' CapturedAKnight[whoseMove]=true; break; case 4: // '\004' CapturedABishop[whoseMove]=true; break; case 5: // '\005' CapturedARook[whoseMove]=true; break; case 6: // '\006' CapturedARook[whoseMove]=true; break; case 9: // '\t' CapturedAQueen[whoseMove]=true; break; } 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_; SupplementForInsaneChess(); 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_ == -2) NowBoard.sq_[moveto_rank][moveto_file].piece_=-1; if(NowBoard.sq_[moveto_rank][moveto_file].piece_ == 224) NowBoard.sq_[moveto_rank][moveto_file].piece_=223; if(NowBoard.sq_[moveto_rank][moveto_file].piece_ == -14) NowBoard.sq_[moveto_rank][moveto_file].piece_=-13; PromoStuff(g); TwoingPawns(); NowBoard.sq_[mover_rank][mover_file].side_=0; NowBoard.sq_[mover_rank][mover_file].piece_=0; TotalMaybeBoard(NowBoard, MaybeBoard); TotalMaybeBoard(MaybeBoard, TwoBoard); TotalMaybeBoard(TwoBoard, ThreeBoard); TotalMaybeBoard(ThreeBoard, FourBoard); NormalMoveFinale(g); ShowStatusNothing(); Archives(); inquire_about_terms(); if (WhoIsHuman[whoseMove]==true){SayWhoIsHuman(g);} } public void NormalMoveExtra() { } public void NormalMoveFinale(Graphics g) { } public boolean PassedOtherRequirementsToKeep(Chsq chsq, CB16_16 cb16_16, CB16_16 cb16_16_1) { return true; } public void PawnStuff(Graphics g) { if((mover_rank - moveto_rank) * (mover_rank - moveto_rank) != 1) return; if((mover_file - moveto_file) * (mover_file - moveto_file) != 1) return; if(NowBoard.sq_[mover_rank][mover_file].piece_ > 400) { if((moveto_rank == mover_rank - 1) & (NowBoard.sq_[mover_rank][moveto_file].piece_ == 405) | (moveto_rank == mover_rank + 1) & (NowBoard.sq_[mover_rank][moveto_file].piece_ == 407)) { NowBoard.sq_[mover_rank][moveto_file].piece_=0; NowBoard.sq_[mover_rank][moveto_file].side_=0; NowBoard.sq_[mover_rank][moveto_file].draw4_12(g, 1, false, false); ShowStatusQ("En Passant");CapturedAPawn[whoseMove]=true; } if((moveto_file == mover_file - 1) & (NowBoard.sq_[moveto_rank][mover_file].piece_ == 406) | (moveto_file == mover_file + 1) & (NowBoard.sq_[moveto_rank][mover_file].piece_ == 408)) { NowBoard.sq_[moveto_rank][mover_file].piece_=0; NowBoard.sq_[moveto_rank][mover_file].side_=0; NowBoard.sq_[moveto_rank][mover_file].draw4_12(g, 1, false, false); ShowStatusQ("En Passant");CapturedAPawn[whoseMove]=true; } } } public void PromoStuff(Graphics g) { if((moveto_file == 1) | (moveto_file == 12) && (NowBoard.sq_[moveto_rank][moveto_file].piece_ == 402) | (NowBoard.sq_[moveto_rank][moveto_file].piece_ == 404)) { NowBoard.sq_[moveto_rank][moveto_file].piece_=9; NowBoard.sq_[moveto_rank][moveto_file].draw4_12(g, 1, DeadZone[moveto_rank][moveto_file], false); return; } if((moveto_rank == 1) | (moveto_rank == 12) && (NowBoard.sq_[moveto_rank][moveto_file].piece_ == 401) | (NowBoard.sq_[moveto_rank][moveto_file].piece_ == 403)) { NowBoard.sq_[moveto_rank][moveto_file].piece_=9; NowBoard.sq_[moveto_rank][moveto_file].draw4_12(g, 1, DeadZone[moveto_rank][moveto_file], false); return; } if(NowBoard.sq_[moveto_rank][moveto_file].piece_ == 401 && (moveto_rank == 10) & (DeadZone[11][moveto_file])) { NowBoard.sq_[moveto_rank][moveto_file].piece_=9; NowBoard.sq_[moveto_rank][moveto_file].draw4_12(g, 1, DeadZone[moveto_rank][moveto_file], false); return; } if(NowBoard.sq_[moveto_rank][moveto_file].piece_ == 402 && (moveto_file == 10) & (DeadZone[moveto_file][11])) { NowBoard.sq_[moveto_rank][moveto_file].piece_=9; NowBoard.sq_[moveto_rank][moveto_file].draw4_12(g, 1, DeadZone[moveto_rank][moveto_file], false); return; } if(NowBoard.sq_[moveto_rank][moveto_file].piece_ == 403 && (moveto_rank == 3) & (DeadZone[2][moveto_file])) { NowBoard.sq_[moveto_rank][moveto_file].piece_=9; NowBoard.sq_[moveto_rank][moveto_file].draw4_12(g, 1, DeadZone[moveto_rank][moveto_file], false); return; } if(NowBoard.sq_[moveto_rank][moveto_file].piece_ == 404 && (moveto_file == 2) & (DeadZone[moveto_rank][2])) { NowBoard.sq_[moveto_rank][moveto_file].piece_=9; NowBoard.sq_[moveto_rank][moveto_file].draw4_12(g, 1, DeadZone[moveto_rank][moveto_file], false); return; } else { return; } } public boolean PromotionClicks(int i, int j) { if(j < 300) return false; if(j > 330) return false; if(i < 130) return false; if(i > 210) return false; if(i < 120) xxx=9; else if(i < 130) xxx=5; else if(i < 180) xxx=4; else xxx=3; return true; } public void SayWhoIsHuman(Graphics g) { if(PromotingAPawn) return; g.setColor(niceblue); g.fillRect(0, 391, 480, 74); g.setColor(Color.black); g.setFont(f1); g.drawString("Blue:", 10, 410); g.drawString("Red:", 10, 430); g.drawString("Computer", 120, 410); g.drawString("Computer", 120, 430); g.drawString("Human", 60, 410); g.drawString("Human", 60, 430); g.drawString("Green:", 220, 410); g.drawString("Gold:", 220, 430); g.drawString("Computer", 330, 410); g.drawString("Computer", 330, 430); g.drawString("Human", 270, 410); g.drawString("Human", 270, 430); g.setFont(f1);NameThisChessVariant(g); g.drawString("Blue " + wins[1] + " Red " + wins[2] + " Green " + wins[3] + " Gold " + wins[4] + " Drawn " + drawn_games, 5, 460); g.setFont(f3); g.drawString("--Ed Friedlander", 355, 460); g.setFont(f2); if(humanizing) g.drawString("OKAY", 420, 420); g.setColor(Color.blue); if(WhoIsHuman[1]) { g.drawRect(56, 396, 48, 18); g.drawRect(57, 397, 46, 16); } if(!WhoIsHuman[1]) { g.drawRect(117, 396, 61, 18); g.drawRect(118, 397, 59, 16); } g.setColor(Color.red); if(WhoIsHuman[2]) { g.drawRect(56, 416, 48, 18); g.drawRect(57, 417, 46, 16); } if(!WhoIsHuman[2]) { g.drawRect(117, 416, 61, 18); g.drawRect(118, 417, 59, 16); } g.setColor(Color.green); if(WhoIsHuman[3]) { g.drawRect(266, 396, 48, 18); g.drawRect(267, 397, 46, 16); } if(!WhoIsHuman[3]) { g.drawRect(327, 396, 61, 18); g.drawRect(328, 397, 59, 16); } g.setColor(Color.yellow); if(WhoIsHuman[4]) { g.drawRect(266, 416, 48, 18); g.drawRect(267, 417, 46, 16); } if(!WhoIsHuman[4]) { g.drawRect(327, 416, 61, 18); g.drawRect(328, 417, 59, 16); } } public void ShowStatusNothing() { if(!GameOver) switch(whoseMove) { case 1: // '\001' ShowStatusQ("Blue moves!"); break; case 2: // '\002' ShowStatusQ("Red moves!"); break; case 3: // '\003' ShowStatusQ("Green moves!"); break; case 4: // '\004' ShowStatusQ("Gold moves!"); break; } } 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; goinghome=false; terminated[1]=false; terminated[2]=false; terminated[3]=false; terminated[4]=false; AmICheckmated[1]=false; AmICheckmated[2]=false; AmICheckmated[3]=false; AmICheckmated[4]=false; AmICheckmated[5]=false; AmICheckmated[6]=false; slaughtered[1]=false; slaughtered[2]=false; slaughtered[3]=false; slaughtered[4]=false; slaughtered[5]=false; slaughtered[6]=false; slaughtered[0]=false; AmIParalyzed[1]=false; AmIParalyzed[2]=false; AmIParalyzed[3]=false; AmIParalyzed[4]=false; AmIParalyzed[5]=false; AmIParalyzed[6]=false; AmIParalyzed[0]=false; for(a=0; a < 3; a++) { IHaveBeenInCheck[a]=false; CapturedAKing[a]=false; CapturedAQueen[a]=false; CapturedARook[a]=false; CapturedAKnight[a]=false; CapturedABishop[a]=false; CapturedAPawn[a]=false; } for(a=1; a < 13; a++) for(b=1; b < 13; b++) { NowBoard.sq_[b][a].piece_=0; NowBoard.sq_[b][a].side_=0; DeadZone[b][a]=false; } SetUpNewFourBoard(); for(x=1; x < 13; x++) for(y=1; y < 13; y++) { MaybeBoard.sq_[y][x].side_=NowBoard.sq_[y][x].side_; MaybeBoard.sq_[y][x].piece_=NowBoard.sq_[y][x].piece_; } whoseMove=1; whatpiecescanmove(g); PromotingAPawn=false; GameOver=false; fifty_move_rule=0; DrawNowBoard(g); ShowStatusQ("Blue moves first!"); TotalSaveBoard(); TotalBackBoard(); } public void SetUpNewFourBoard(){ NowBoard.sq_[1][3].piece_=5; NowBoard.sq_[1][4].piece_=3; NowBoard.sq_[1][5].piece_=4; NowBoard.sq_[1][6].piece_=9; NowBoard.sq_[1][7].piece_=-1; NowBoard.sq_[1][8].piece_=4; NowBoard.sq_[1][9].piece_=3; NowBoard.sq_[1][10].piece_=5; NowBoard.sq_[12][10].piece_=5; NowBoard.sq_[12][9].piece_=3; NowBoard.sq_[12][8].piece_=4; NowBoard.sq_[12][7].piece_=9; NowBoard.sq_[12][6].piece_=-1; NowBoard.sq_[12][5].piece_=4; NowBoard.sq_[12][4].piece_=3; NowBoard.sq_[12][3].piece_=5; NowBoard.sq_[10][1].piece_=5; NowBoard.sq_[9][1].piece_=3; NowBoard.sq_[8][1].piece_=4; NowBoard.sq_[7][1].piece_=9; NowBoard.sq_[6][1].piece_=-1; NowBoard.sq_[5][1].piece_=4; NowBoard.sq_[4][1].piece_=3; NowBoard.sq_[3][1].piece_=5; NowBoard.sq_[3][12].piece_=5; NowBoard.sq_[4][12].piece_=3; NowBoard.sq_[5][12].piece_=4; NowBoard.sq_[6][12].piece_=9; NowBoard.sq_[7][12].piece_=-1; NowBoard.sq_[8][12].piece_=4; NowBoard.sq_[9][12].piece_=3; NowBoard.sq_[10][12].piece_=5; for(x=3; x <= 10; x++) { NowBoard.sq_[x][2].side_=2; NowBoard.sq_[x][2].piece_=402; NowBoard.sq_[x][11].side_=4; NowBoard.sq_[x][11].piece_=404; NowBoard.sq_[2][x].side_=1; NowBoard.sq_[2][x].piece_=401; NowBoard.sq_[11][x].side_=3; NowBoard.sq_[11][x].piece_=403; NowBoard.sq_[x][1].side_=2; NowBoard.sq_[x][12].side_=4; NowBoard.sq_[1][x].side_=1; NowBoard.sq_[12][x].side_=3; } for(x=1; x < 3; x++) for(y=1; y < 3; y++) { DeadZone[y][x]=true; DeadZone[y + 10][x]=true; DeadZone[y][x + 10]=true; DeadZone[y + 10][x + 10]=true; } } public void SupplementForInsaneChess() { } public void SupplementalAddAnAttacker() { } public boolean SupplementalAmIUnderAttackers(int i, int j, int k) { return false; } public boolean SupplementalAmIUnderSparrowAttackers(int i, int j, int k) { return false; } public void SupplementalInit() { } public void SupplementalMovers(Graphics g, Chsq chsq, CB16_16 cb16_16, CB16_16 cb16_16_1) { } public void TotalMaybeBoard(CB16_16 cb16_16, CB16_16 cb16_16_1) { for(xxx=1; xxx < 13; xxx++) for(yyy=1; yyy < 13; yyy++) { cb16_16_1.sq_[yyy][xxx].side_=cb16_16.sq_[yyy][xxx].side_; cb16_16_1.sq_[yyy][xxx].piece_=cb16_16.sq_[yyy][xxx].piece_; } } public void TwoingPawns() { if(mover_rank + 2 == moveto_rank && NowBoard.sq_[moveto_rank][moveto_file].piece_ == 401) NowBoard.sq_[moveto_rank][moveto_file].piece_=405; if(mover_file + 2 == moveto_file && NowBoard.sq_[moveto_rank][moveto_file].piece_ == 402) NowBoard.sq_[moveto_rank][moveto_file].piece_=406; if(mover_rank - 2 == moveto_rank && NowBoard.sq_[moveto_rank][moveto_file].piece_ == 403) NowBoard.sq_[moveto_rank][moveto_file].piece_=407; if(mover_file - 2 == moveto_file && NowBoard.sq_[moveto_rank][moveto_file].piece_ == 404) NowBoard.sq_[moveto_rank][moveto_file].piece_=408; } public void UnTwoThePawns(int i) { } public void ZeroAllFiveCounts() { PawnCount[0]=0; QueenCount[0]=0; KingCount[0]=0; RookCount[0]=0; BishopCount[0]=0; KnightCount[0]=0; PawnCount[1]=0; QueenCount[1]=0; KingCount[1]=0; RookCount[1]=0; BishopCount[1]=0; KnightCount[1]=0; PawnCount[2]=0; KingCount[2]=0; QueenCount[2]=0; RookCount[2]=0; BishopCount[2]=0; KnightCount[2]=0; } public void alterMaybeBoard(Graphics g, Chsq chsq, Chsq chsq1, CB16_16 cb16_16, CB16_16 cb16_16_1) { cb16_16_1.sq_[chsq.rank_][chsq.file_].piece_=0; cb16_16_1.sq_[chsq.rank_][chsq.file_].side_=0; cb16_16_1.sq_[chsq1.rank_][chsq1.file_].piece_=cb16_16.sq_[chsq.rank_][chsq.file_].piece_; cb16_16_1.sq_[chsq1.rank_][chsq1.file_].side_=cb16_16.sq_[chsq.rank_][chsq.file_].side_; if(chsq.piece_ > 400 && ((chsq.rank_ - chsq1.rank_) * (chsq.rank_ - chsq1.rank_) == 1) & ((chsq.file_ - chsq1.file_) * (chsq.file_ - chsq1.file_) == 1)) { if(cb16_16.sq_[chsq1.rank_ + 1][chsq1.file_].piece_ == 405) { cb16_16_1.sq_[chsq1.rank_ + 1][chsq1.file_].piece_=0; cb16_16_1.sq_[chsq1.rank_ + 1][chsq1.file_].side_=0; } if(cb16_16.sq_[chsq1.rank_][chsq1.file_ + 1].piece_ == 406) { cb16_16_1.sq_[chsq1.rank_][chsq1.file_ + 1].piece_=0; cb16_16_1.sq_[chsq1.rank_][chsq1.file_ + 1].side_=0; } if(cb16_16.sq_[chsq1.rank_ - 1][chsq1.file_].piece_ == 407) { cb16_16_1.sq_[chsq1.rank_ - 1][chsq1.file_].piece_=0; cb16_16_1.sq_[chsq1.rank_ - 1][chsq1.file_].side_=0; } if(cb16_16.sq_[chsq1.rank_][chsq1.file_ - 1].piece_ == 408) { cb16_16_1.sq_[chsq1.rank_][chsq1.file_ - 1].piece_=0; cb16_16_1.sq_[chsq1.rank_][chsq1.file_ - 1].side_=0; } } } public void ep(Graphics g, Chsq chsq, CB16_16 cb16_16, CB16_16 cb16_16_1) { if((c[depth] < 11) & (c[depth] > 2) & (d[depth] < 11) & (d[depth] > 2)) { if(NowBoard.sq_[d[depth] + 1][c[depth]].piece_ == 405) MaybeAdd(g, chsq, cb16_16, cb16_16_1); if(NowBoard.sq_[d[depth]][c[depth] + 1].piece_ == 406) MaybeAdd(g, chsq, cb16_16, cb16_16_1); if(NowBoard.sq_[d[depth] - 1][c[depth]].piece_ == 407) MaybeAdd(g, chsq, cb16_16, cb16_16_1); if(NowBoard.sq_[d[depth]][c[depth] - 1].piece_ == 408) MaybeAdd(g, chsq, cb16_16, cb16_16_1); } } public int findPieceMoves(Graphics g, Chsq chsq, CB16_16 cb16_16, CB16_16 cb16_16_1) { CheckSquare[depth]=false; SquatterOnCheckSquare[depth]=false; SupplementalMovers(g, chsq, cb16_16, cb16_16_1); if((goinghome) & (chsq.side_ == 1)) { if(!DeadZone[chsq.rank_][chsq.file_]) return 0; for(c[depth]=3; c[depth] < 11; c[depth]++) for(d[depth]=1; d[depth] < 3; d[depth]++) if(NowBoard.sq_[d[depth]][c[depth]].piece_ == 0) MaybeAdd(g, chsq, cb16_16, cb16_16_1); return moveCounter; } if((goinghome) & (chsq.side_ == 2)) { if(!DeadZone[chsq.rank_][chsq.file_]) return 0; for(c[depth]=1; c[depth] < 3; c[depth]++) for(d[depth]=3; d[depth] < 11; d[depth]++) if(NowBoard.sq_[d[depth]][c[depth]].piece_ == 0) MaybeAdd(g, chsq, cb16_16, cb16_16_1); return moveCounter; } if((goinghome) & (chsq.side_ == 3)) { if(!DeadZone[chsq.rank_][chsq.file_]) return 0; for(c[depth]=3; c[depth] < 11; c[depth]++) for(d[depth]=11; d[depth] < 13; d[depth]++) if(NowBoard.sq_[d[depth]][c[depth]].piece_ == 0) MaybeAdd(g, chsq, cb16_16, cb16_16_1); return moveCounter; } if((goinghome) & (chsq.side_ == 4)) { if(!DeadZone[chsq.rank_][chsq.file_]) return 0; for(c[depth]=11; c[depth] < 13; c[depth]++) for(d[depth]=3; d[depth] < 11; d[depth]++) if(NowBoard.sq_[d[depth]][c[depth]].piece_ == 0) MaybeAdd(g, chsq, cb16_16, cb16_16_1); return moveCounter; } if(chsq.piece_ == 401) { c[depth]=chsq.file_ + 1; d[depth]=chsq.rank_ + 1; if(NowBoard.sq_[d[depth]][c[depth]].piece_ != 0) MaybeAdd(g, chsq, cb16_16, cb16_16_1); ep(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_ - 1; d[depth]=chsq.rank_ + 1; if(NowBoard.sq_[d[depth]][c[depth]].piece_ != 0) MaybeAdd(g, chsq, cb16_16, cb16_16_1); ep(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_; d[depth]=chsq.rank_ + 1; if(NowBoard.sq_[d[depth]][c[depth]].piece_ == 0) MaybeAdd(g, chsq, cb16_16, cb16_16_1); if(chsq.rank_ == 2) { d[depth]=4; c[depth]=chsq.file_; if((NowBoard.sq_[3][c[depth]].piece_ == 0) & (NowBoard.sq_[4][c[depth]].piece_ == 0)) MaybeAdd(g, chsq, cb16_16, cb16_16_1); } } if(chsq.piece_ == 402) { c[depth]=chsq.file_ + 1; d[depth]=chsq.rank_ + 1; if(NowBoard.sq_[d[depth]][c[depth]].piece_ != 0) MaybeAdd(g, chsq, cb16_16, cb16_16_1); ep(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_ + 1; d[depth]=chsq.rank_ - 1; if(NowBoard.sq_[d[depth]][c[depth]].piece_ != 0) MaybeAdd(g, chsq, cb16_16, cb16_16_1); ep(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_ + 1; d[depth]=chsq.rank_; if(NowBoard.sq_[d[depth]][c[depth]].piece_ == 0) MaybeAdd(g, chsq, cb16_16, cb16_16_1); if(chsq.file_ == 2) { d[depth]=chsq.rank_; c[depth]=4; if((NowBoard.sq_[d[depth]][3].piece_ == 0) & (NowBoard.sq_[d[depth]][4].piece_ == 0)) MaybeAdd(g, chsq, cb16_16, cb16_16_1); } } if(chsq.piece_ == 403) { c[depth]=chsq.file_ + 1; d[depth]=chsq.rank_ - 1; if(NowBoard.sq_[d[depth]][c[depth]].piece_ != 0) MaybeAdd(g, chsq, cb16_16, cb16_16_1); ep(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_ - 1; d[depth]=chsq.rank_ - 1; if(NowBoard.sq_[d[depth]][c[depth]].piece_ != 0) MaybeAdd(g, chsq, cb16_16, cb16_16_1); ep(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_; d[depth]=chsq.rank_ - 1; if(NowBoard.sq_[d[depth]][c[depth]].piece_ == 0) MaybeAdd(g, chsq, cb16_16, cb16_16_1); if(chsq.rank_ == 11) { d[depth]=9; c[depth]=chsq.file_; if((NowBoard.sq_[10][c[depth]].piece_ == 0) & (NowBoard.sq_[9][c[depth]].piece_ == 0)) MaybeAdd(g, chsq, cb16_16, cb16_16_1); } } if(chsq.piece_ == 404) { c[depth]=chsq.file_ - 1; d[depth]=chsq.rank_ + 1; if(NowBoard.sq_[d[depth]][c[depth]].piece_ != 0) MaybeAdd(g, chsq, cb16_16, cb16_16_1); ep(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_ - 1; d[depth]=chsq.rank_ - 1; if(NowBoard.sq_[d[depth]][c[depth]].piece_ != 0) MaybeAdd(g, chsq, cb16_16, cb16_16_1); ep(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_ - 1; d[depth]=chsq.rank_; if(NowBoard.sq_[d[depth]][c[depth]].piece_ == 0) MaybeAdd(g, chsq, cb16_16, cb16_16_1); if(chsq.file_ == 11) { d[depth]=chsq.rank_; c[depth]=9; if((NowBoard.sq_[d[depth]][10].piece_ == 0) & (NowBoard.sq_[d[depth]][9].piece_ == 0)) MaybeAdd(g, chsq, cb16_16, cb16_16_1); } } if((chsq.piece_ == 60) | (chsq.piece_ == 260) | (chsq.piece_ == 224)) { c[depth]=chsq.file_ - 2; d[depth]=chsq.rank_ - 2; MaybeAdd(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_ - 2; d[depth]=chsq.rank_ + 2; MaybeAdd(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_ + 2; d[depth]=chsq.rank_ - 2; MaybeAdd(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_ + 2; d[depth]=chsq.rank_ + 2; MaybeAdd(g, chsq, cb16_16, cb16_16_1); } if((chsq.piece_ == 9) | (chsq.piece_ == 5) | (chsq.piece_ == 6)) { c[depth]=chsq.file_ - 1; for(d[depth]=chsq.rank_; (MaybeAdd(g, chsq, cb16_16, cb16_16_1)) | (CheckSquare[depth]) & (chsq.piece_ != -9) & (!SquatterOnCheckSquare[depth]); c[depth]=c[depth] - 1); } if((chsq.piece_ == 9) | (chsq.piece_ == 5) | (chsq.piece_ == 6)) { c[depth]=chsq.file_ + 1; for(d[depth]=chsq.rank_; (MaybeAdd(g, chsq, cb16_16, cb16_16_1)) | (CheckSquare[depth]) & (chsq.piece_ != -9) & (!SquatterOnCheckSquare[depth]); c[depth]++); } if((chsq.piece_ == 9) | (chsq.piece_ == 5) | (chsq.piece_ == 6)) { c[depth]=chsq.file_; for(d[depth]=chsq.rank_ - 1; (MaybeAdd(g, chsq, cb16_16, cb16_16_1)) | (CheckSquare[depth]) & (chsq.piece_ != -9) & (!SquatterOnCheckSquare[depth]); d[depth]=d[depth] - 1); } if((chsq.piece_ == 9) | (chsq.piece_ == 5) | (chsq.piece_ == 6)) { c[depth]=chsq.file_; for(d[depth]=chsq.rank_ + 1; (MaybeAdd(g, chsq, cb16_16, cb16_16_1)) | (CheckSquare[depth]) & (chsq.piece_ != -9) & (!SquatterOnCheckSquare[depth]); d[depth]++); } if((chsq.piece_ == 9) | (chsq.piece_ == 4)) { c[depth]=chsq.file_ - 1; for(d[depth]=chsq.rank_ - 1; (MaybeAdd(g, chsq, cb16_16, cb16_16_1)) | (CheckSquare[depth]) & (chsq.piece_ != -9) & (!SquatterOnCheckSquare[depth]); d[depth]=d[depth] - 1) c[depth]=c[depth] - 1; } if((chsq.piece_ == 9) | (chsq.piece_ == 4)) { c[depth]=chsq.file_ - 1; for(d[depth]=chsq.rank_ + 1; (MaybeAdd(g, chsq, cb16_16, cb16_16_1)) | (CheckSquare[depth]) & (chsq.piece_ != -9) & (!SquatterOnCheckSquare[depth]); d[depth]=d[depth] + 1) c[depth]=c[depth] - 1; } if((chsq.piece_ == 9) | (chsq.piece_ == 4)) { c[depth]=chsq.file_ + 1; for(d[depth]=chsq.rank_ - 1; (MaybeAdd(g, chsq, cb16_16, cb16_16_1)) | (CheckSquare[depth]) & (chsq.piece_ != -9) & (!SquatterOnCheckSquare[depth]); d[depth]=d[depth] - 1) c[depth]=c[depth] + 1; } if((chsq.piece_ == 9) | (chsq.piece_ == 4)) { c[depth]=chsq.file_ + 1; for(d[depth]=chsq.rank_ + 1; (MaybeAdd(g, chsq, cb16_16, cb16_16_1)) | (CheckSquare[depth]) & (chsq.piece_ != -9) & (!SquatterOnCheckSquare[depth]); d[depth]=d[depth] + 1) c[depth]=c[depth] + 1; } if(chsq.piece_ == -1) { c[depth]=chsq.file_ + 1; d[depth]=chsq.rank_; MaybeAdd(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_; d[depth]=chsq.rank_ + 1; MaybeAdd(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_ - 1; d[depth]=chsq.rank_; MaybeAdd(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_; d[depth]=chsq.rank_ - 1; MaybeAdd(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_ + 1; d[depth]=chsq.rank_ + 1; MaybeAdd(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_ + 1; d[depth]=chsq.rank_ - 1; MaybeAdd(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_ - 1; d[depth]=chsq.rank_ + 1; MaybeAdd(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_ - 1; d[depth]=chsq.rank_ - 1; MaybeAdd(g, chsq, cb16_16, cb16_16_1); } if(chsq.piece_ == 3) { c[depth]=chsq.file_ - 2; d[depth]=chsq.rank_ - 1; MaybeAdd(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_ - 2; d[depth]=chsq.rank_ + 1; MaybeAdd(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_ + 2; d[depth]=chsq.rank_ - 1; MaybeAdd(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_ + 2; d[depth]=chsq.rank_ + 1; MaybeAdd(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_ - 1; d[depth]=chsq.rank_ - 2; MaybeAdd(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_ - 1; d[depth]=chsq.rank_ + 2; MaybeAdd(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_ + 1; d[depth]=chsq.rank_ - 2; MaybeAdd(g, chsq, cb16_16, cb16_16_1); c[depth]=chsq.file_ + 1; d[depth]=chsq.rank_ + 2; MaybeAdd(g, chsq, cb16_16, cb16_16_1); } return moveCounter; } public void init() { seek_sacrificial_wins=false; 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); AmICheckmated=new boolean[7]; AmIParalyzed=new boolean[7]; terminated=new boolean[5]; slaughtered=new boolean[7]; IHaveBeenInCheck=new boolean[5]; CapturedAKing=new boolean[5]; CapturedAQueen=new boolean[5]; CapturedABishop=new boolean[5]; CapturedARook=new boolean[5]; CapturedAKnight=new boolean[5]; CapturedAPawn=new boolean[5]; PawnCount=new int[5]; KnightCount=new int[5]; BishopCount=new int[5]; RookCount=new int[5]; QueenCount=new int[5]; KingCount=new int[5]; Attackers=new int[16][16][5]; StrongestAttacker=new int[16][16][5]; WeakestAttacker=new int[16][16][5]; NowBoard=new CB16_16(316); SaveBoard=new CB16_16(316); BackBoard=new CB16_16(316); icanmove=new boolean[16][16]; MaybeBoard=new CB16_16(316); OneBoard=new CB16_16(316); TwoBoard=new CB16_16(316); ThreeBoard=new CB16_16(316); FourBoard=new CB16_16(316); ArchiveBoard=new CB16_16[102]; DeadZone=new boolean[16][16]; happySquare=new Chsq(1, 1, 5, 1); MaybeMoves=new Chmo[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]; wins=new int[5]; depth=0; WhoIsHuman[1]=true; WhoIsHuman[2]=false; WhoIsHuman[3]=false; WhoIsHuman[4]=false; SupplementalInit(); GameOver=false; PromotingAPawn=false; drawn_games=0; Graphics g=getGraphics(); setBackground(niceblue); markingAPiece=true; for(a=1; a <= 1000; a++) MaybeMoves[a]=new Chmo(); WhoIsHuman[0]=true; wins[0]=0; wins[1]=0; wins[2]=0; StartUp(g); millipede1=System.currentTimeMillis();for (xxx=0;xxx<102;xxx++){ArchiveBoard[xxx]=new CB16_16(316);} millipede2=System.currentTimeMillis(); how_deep_to_seek=1; } 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; AlsoMark(g); 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].draw4_12(g, 1, DeadZone[i][j], false); return false; } NowBoard.sq_[i][j].draw4_12(g, 2, DeadZone[i][j], false); for(x=1; x <= moveCounter; x++) MaybeMoves[x].endingsquare_.mark4_12(g); markingAPiece=false; return true; } public boolean mouseDown(Event event, int i, int j) { if(NowBoard == null) return true; Graphics g=getGraphics(); ShowStatusNothing(); if(j < 30) if((humanizing) | (PromotingAPawn)) { return true; } else { DisplayRules(g); return true; } if(!PromotingAPawn) SayWhoIsHuman(g); if(PromotingAPawn) DrawPromotionOptions(g); if(GameOver) { GameOver=false; StartUp(g); repaint(); return true; } a=i / 30; b=13 - j / 30; if(!PromotingAPawn) if((i >= 56) & (j >= 396) & (i <= 104) & (j <= 414)) { humanizing=true; WhoIsHuman[1]=true; SayWhoIsHuman(g); } else if((i >= 117) & (j >= 396) & (i <= 178) & (j <= 414)) { humanizing=true; WhoIsHuman[1]=false; SayWhoIsHuman(g); } else if((i >= 56) & (j >= 416) & (i <= 104) & (j <= 434)) { humanizing=true; WhoIsHuman[2]=true; SayWhoIsHuman(g); } else if((i >= 117) & (j >= 416) & (i <= 178) & (j <= 434)) { humanizing=true; WhoIsHuman[2]=false; SayWhoIsHuman(g); } else if((i >= 26) & (j > 316) & (i <= 93) & (j <= 334)) { if(who_is_winning == 0) return true; humanizing=true; accepted_terms=true; SayWhoIsHuman(g); } else if((i >= 147) & (j >= 316) & (i < 242) & (j < 334)) { if(who_is_winning == 0) return true; humanizing=true; accepted_terms=false; SayWhoIsHuman(g); } else if((i >= 266) & (j >= 396) & (i <= 314) & (j <= 414)) { humanizing=true; WhoIsHuman[3]=true; SayWhoIsHuman(g); } else if((i >= 327) & (j >= 396) & (i <= 388) & (j <= 414)) { humanizing=true; WhoIsHuman[3]=false; SayWhoIsHuman(g); } else if((i >= 266) & (j >= 416) & (i <= 314) & (j <= 434)) { humanizing=true; WhoIsHuman[4]=true; SayWhoIsHuman(g); } else if((i >= 327) & (j >= 416) & (i <= 388) & (j <= 434)) { humanizing=true; WhoIsHuman[4]=false; SayWhoIsHuman(g); } else if((i >= 420) & (j >= 405) & (i < 480) & (j < 440)) { 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; if(PromotingAPawn) { if(!PromotionClicks(i, j)) return true; NowBoard.sq_[queening_rank][queening_file].piece_=xxx; MaybeBoard.sq_[queening_rank][queening_file].piece_=xxx; NowBoard.sq_[queening_rank][queening_file].draw4_12(g, 1, DeadZone[queening_rank][queening_file], false); TotalMaybeBoard(NowBoard,MaybeBoard);DidICheckOrStalemate(g, whoseMove); PromotingAPawn=false; SayWhoIsHuman(g); NextOrdinaryPlayer(g); if(WhoIsHuman[whoseMove]) { markingAPiece=true; return true; } } if((a < 1) | (a > 12) | (b < 1) | (b > 12) && WhoIsHuman[whoseMove]) return true; if(WhoIsHuman[whoseMove]) if(markingAPiece) markAPiece(g, b, a); else if(HumanMoveAPiece(g, b, a)) { if(GameOver) return true; if(PromotingAPawn) return true; NextOrdinaryPlayer(g); } while((!WhoIsHuman[whoseMove]) & (!GameOver) & (!PromotingAPawn)) { MachineMoves(g, whoseMove); if(GameOver) return true; NextOrdinaryPlayer(g); if(WhoIsHuman[whoseMove]) markingAPiece=true; } return true; } public int nextplayer(int i) { switch(i) { case 1: // '\001' return 2; case 2: // '\002' return 3; case 3: // '\003' return 4; case 4: // '\004' return 1; } return 0; } public boolean opening_library() { return false; } public void paint(Graphics g) { 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] + " Red " + wins[2] + " Drawn " + drawn_games, 5, 50); g.drawString("Final totals: Blue " + wins[1] + " Red " + wins[2] + " Green " + wins[3] + " Gold " + wins[4] + " Drawn " + drawn_games, 5, 460); return; } setBackground(niceblue); paintSomethingElse(g); DrawNowBoard(g); g.setColor(niceblue); g.fillRect(0, 391, 480, 29);g.setColor(Color.black);g.setFont(f1);NameThisChessVariant(g); g.setColor(Color.black); g.setFont(f1); g.setColor(Color.black); if(!PromotingAPawn) SayWhoIsHuman(g); if(PromotingAPawn) DrawPromotionOptions(g); if((!markingAPiece) & (WhoIsHuman[whoseMove])) { NowBoard.sq_[mover_rank][mover_file].draw4_12(g, 2, DeadZone[mover_rank][mover_file], false); for(x=1; x <= moveCounter; x++) MaybeMoves[x].endingsquare_.mark4_12(g); } paintSomethingElse2(g); } public void paintSomethingElse(Graphics g) { } public void paintSomethingElse2(Graphics g) { } public int partner(int i) { switch(i) { case 1: // '\001' return 3; case 2: // '\002' return 4; case 3: // '\003' return 1; case 4: // '\004' return 2; } return 0; } public void regicide(int i) { if(i == 1) { terminated[1]=true; for(x_rex=3; x_rex < 11; x_rex++) for(y_rex=1; y_rex < 3; y_rex++) { DeadZone[y_rex][x_rex]=true; if(NowBoard.sq_[y_rex][x_rex].side_ != whoseMove) { if(NowBoard.sq_[y_rex][x_rex].piece_ == -1) slaughtered[NowBoard.sq_[y_rex][x_rex].side_]=true; NowBoard.sq_[y_rex][x_rex].side_=0; NowBoard.sq_[y_rex][x_rex].piece_=0; } } } if(i == 2) { terminated[2]=true; for(x_rex=1; x_rex < 3; x_rex++) for(y_rex=3; y_rex < 11; y_rex++) { DeadZone[y_rex][x_rex]=true; if(NowBoard.sq_[y_rex][x_rex].side_ != whoseMove) { if(NowBoard.sq_[y_rex][x_rex].piece_ == -1) slaughtered[NowBoard.sq_[y_rex][x_rex].side_]=true; NowBoard.sq_[y_rex][x_rex].side_=0; NowBoard.sq_[y_rex][x_rex].piece_=0; } } } if(i == 3) { terminated[3]=true; for(x_rex=3; x_rex < 11; x_rex++) for(y_rex=11; y_rex < 13; y_rex++) { DeadZone[y_rex][x_rex]=true; if(NowBoard.sq_[y_rex][x_rex].side_ != whoseMove) { if(NowBoard.sq_[y_rex][x_rex].piece_ == -1) slaughtered[NowBoard.sq_[y_rex][x_rex].side_]=true; NowBoard.sq_[y_rex][x_rex].side_=0; NowBoard.sq_[y_rex][x_rex].piece_=0; } } } if(i == 4) { terminated[4]=true; for(x_rex=11; x_rex < 13; x_rex++) for(y_rex=3; y_rex < 11; y_rex++) { DeadZone[y_rex][x_rex]=true; if(NowBoard.sq_[y_rex][x_rex].side_ != whoseMove) { if(NowBoard.sq_[y_rex][x_rex].piece_ == -1) slaughtered[NowBoard.sq_[y_rex][x_rex].side_]=true; NowBoard.sq_[y_rex][x_rex].side_=0; NowBoard.sq_[y_rex][x_rex].piece_=0; } } } slaughtered[i]=false; } public int whoseteam(int i){ switch (i){ case 1:return 1; case 2:return 2; case 3:return 1; case 4:return 2; } return 0; } public int secondenemy(int i) { switch(i) { case 1: // '\001' return 4; case 2: // '\002' return 1; case 3: // '\003' return 2; case 4: // '\004' return 3; } return 0; } public void stop() { NowBoard=null; MaybeBoard=null; OneBoard=null; TwoBoard=null; ThreeBoard=null; FourBoard=null; // ArchiveBoard=null; MaybeMoves=null; Attackers=null; destroy(); } public void whatpiecescanmove(Graphics g) { for(ee=1; ee < 13; ee++) for(ff=1; ff < 13; 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; } } DrawNowBoard(g); } 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; boolean AmICheckmated[]; boolean AmIParalyzed[]; boolean terminated[]; boolean slaughtered[]; boolean IHaveBeenInCheck[]; boolean CapturedAKing[]; boolean CapturedAQueen[]; boolean CapturedABishop[]; boolean CapturedARook[]; boolean CapturedAKnight[]; boolean CapturedAPawn[]; int PawnCount[]; int KnightCount[]; int BishopCount[]; int RookCount[]; int QueenCount[]; int KingCount[]; int Attackers[][][]; int StrongestAttacker[][][]; int WeakestAttacker[][][]; CB16_16 NowBoard; CB16_16 BackBoard; CB16_16 SaveBoard; boolean icanmove[][]; CB16_16 MaybeBoard; CB16_16 OneBoard; CB16_16 TwoBoard; CB16_16 ThreeBoard; CB16_16 FourBoard; CB16_16 ArchiveBoard[]; boolean DeadZone[][]; Chsq happySquare; Chmo 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; static int x_rex; static int y_rex; int c[]; int d[]; int x_run[]; int y_run[]; int z_run[]; static int x; static int y; static int z; static int a; static int b; 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 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 PromotingAPawn; static boolean goinghome; 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[]; int wins[]; static String stringy; static boolean halt_if_king_taken; static boolean seek_sacrificial_wins; 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; }