// FEUDAL FOUR LOCKS // 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: Feudal4.java import java.applet.Applet; import java.awt.*; public class Feudal4 extends Applet { public Feudal4() { } 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) { PromotingAPawn=false; GameOver=false; UnBackBoard();TotalMaybeBoard(NowBoard, MaybeBoard); markingAPiece=true; AssumeAllIsWell(); 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); AssumeAllIsWell(); 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 < 10; xxx++) for(yyy=0; yyy < 10; 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_whoseMove=whoseMove;saved_fifty_move_rule=fifty_move_rule;saved_turncounter=turncounter; for(xxx=0; xxx < 10; xxx++) for(yyy=0; yyy < 10; 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 < 10; xxx++) for(yyy=0; yyy < 10; 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(){whoseMove=saved_whoseMove;turncounter=saved_turncounter;fifty_move_rule=saved_fifty_move_rule;ShowStatusNothing(); for(xxx=0; xxx < 10; xxx++) for(yyy=0; yyy < 10; 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 AddACLCAttacker() { if((xatt == catt) && (yatt == datt)) return; if((catt > 9) | (datt > 9) | (catt < 1) | (datt < 1)) return; if(satt > 2) { return; } else { CLCAttackers[datt][catt][satt]++; return; } } public void AddAnAttacker() { if((xatt == catt) && (yatt == datt)) return; if((catt > 9) | (datt > 9) | (catt < 1) | (datt < 1)) return; if(satt > 4) { return; } else { Attackers[datt][catt][satt]++; 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 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 < 10) 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 < 10;) 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 < 10) && (dd < 10);) 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 < 10) && (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 < 10);) 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 - 2; dd=i - 2; if(IsEnemyAlfil(dd, cc, k)) return true; cc=j - 2; dd=i + 2; if(IsEnemyAlfil(dd, cc, k)) return true; cc=j + 2; dd=i - 2; if(IsEnemyAlfil(dd, cc, k)) return true; cc=j + 2; dd=i + 2; if(IsEnemyAlfil(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; 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 - 1; dd=i - 1; if(IsEnemyFerz(dd, cc, k)) return true; cc=j - 1; dd=i + 1; if(IsEnemyFerz(dd, cc, k)) return true; cc=j + 1; dd=i - 1; if(IsEnemyFerz(dd, cc, k)) return true; cc=j + 1; dd=i + 1; if(IsEnemyFerz(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(IsEnemyGoldPawn(dd, cc, k)) return true; if(IsEnemyRedPawn(dd, cc, k)) return true; if(IsEnemyWhitePawn(dd, cc, k)) return true; cc=j - 1; dd=i + 1; if(IsEnemyBluePawn(dd, cc, k)) return true; if(IsEnemyRedPawn(dd, cc, k)) return true; if(IsEnemyWhitePawn(dd, cc, k)) return true; cc=j + 1; dd=i - 1; if(IsEnemyBluePawn(dd, cc, k)) return true; if(IsEnemyGoldPawn(dd, cc, k)) return true; if(IsEnemyRedPawn(dd, cc, k)) return true; cc=j - 1; dd=i - 1; if(IsEnemyBluePawn(dd, cc, k)) return true; if(IsEnemyGoldPawn(dd, cc, k)) return true; else return IsEnemyWhitePawn(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 < 10) 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 < 10;) 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 < 10) && (dd < 10);) 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 < 10) && (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 < 10);) 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 - 2; dd=i - 2; if(IsEnemyAlfil(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j - 2; dd=i + 2; if(IsEnemyAlfil(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j + 2; dd=i - 2; if(IsEnemyAlfil(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j + 2; dd=i + 2; if(IsEnemyAlfil(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; 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 - 1; dd=i - 1; if(IsEnemyFerz(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j - 1; dd=i + 1; if(IsEnemyFerz(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j + 1; dd=i - 1; if(IsEnemyFerz(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j + 1; dd=i + 1; if(IsEnemyFerz(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(IsEnemyGoldPawn(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; if(IsEnemyRedPawn(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; if(IsEnemyWhitePawn(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j - 1; dd=i + 1; if(IsEnemyBluePawn(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; if(IsEnemyRedPawn(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; if(IsEnemyWhitePawn(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j + 1; dd=i - 1; if(IsEnemyBluePawn(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; if(IsEnemyGoldPawn(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; if(IsEnemyRedPawn(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j - 1; dd=i - 1; if(IsEnemyBluePawn(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; if(IsEnemyGoldPawn(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; return IsEnemyWhitePawn(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 < 10; xxx++) for(yyy=1; yyy < 10; 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 AnotherReasonNotToCastleKingside(int i) { return false; } public boolean AnotherReasonNotToCastleQueenside(int i) { 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 < 10; ff++) for(ee=1; ee < 10; 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 CastleStuff(Graphics g) { if((NowBoard.sq_[moveto_rank][moveto_file].piece_ == -2) | (NowBoard.sq_[moveto_rank][moveto_file].piece_ == -14)) { if(moveto_file == 7) { ShowStatusQ("Castling King Side"); NowBoard.sq_[moveto_rank][6].side_=NowBoard.sq_[mover_rank][mover_file].side_; NowBoard.sq_[moveto_rank][6].piece_=5; NowBoard.sq_[moveto_rank][8].side_=0; NowBoard.sq_[moveto_rank][8].piece_=0; NowBoard.sq_[moveto_rank][6].drawfeudal4(g, 1, false); NowBoard.sq_[moveto_rank][8].drawfeudal4(g, 1, false); MaybeBoard.sq_[moveto_rank][6].side_=NowBoard.sq_[mover_rank][mover_file].side_; MaybeBoard.sq_[moveto_rank][6].piece_=5; MaybeBoard.sq_[moveto_rank][8].side_=0; MaybeBoard.sq_[moveto_rank][8].piece_=0; } if(moveto_file == 3) { ShowStatusQ("Castling Queen Side"); NowBoard.sq_[moveto_rank][4].side_=NowBoard.sq_[mover_rank][mover_file].side_; NowBoard.sq_[moveto_rank][4].piece_=5; NowBoard.sq_[moveto_rank][1].side_=0; NowBoard.sq_[moveto_rank][1].piece_=0; NowBoard.sq_[moveto_rank][4].drawfeudal4(g, 1, false); NowBoard.sq_[moveto_rank][1].drawfeudal4(g, 1, false); MaybeBoard.sq_[moveto_rank][4].side_=NowBoard.sq_[mover_rank][mover_file].side_; MaybeBoard.sq_[moveto_rank][4].piece_=5; MaybeBoard.sq_[moveto_rank][1].side_=0; MaybeBoard.sq_[moveto_rank][1].piece_=0; } NowBoard.sq_[moveto_rank][moveto_file].piece_++; } } public void CountAllThePieces() { ZeroAllFiveCounts(); for(xxx=1; xxx < 10; xxx++) for(yyy=1; yyy < 10; yyy++) switch(NowBoard.sq_[yyy][xxx].piece_) { case 1: // '\001' PawnCount[NowBoard.sq_[yyy][xxx].side_]++; break; case 2: // '\002' PawnCount[NowBoard.sq_[yyy][xxx].side_]++; break; case 51: // '3' PawnCount[NowBoard.sq_[yyy][xxx].side_]++; break; case 52: // '4' PawnCount[NowBoard.sq_[yyy][xxx].side_]++; break; case 3: // '\003' KnightCount[NowBoard.sq_[yyy][xxx].side_]++; break; case 2203: KnightCount[NowBoard.sq_[yyy][xxx].side_]++; break; case 260: BishopCount[NowBoard.sq_[yyy][xxx].side_]++; break; case 4: // '\004' BishopCount[NowBoard.sq_[yyy][xxx].side_]++; break; case 2204: BishopCount[NowBoard.sq_[yyy][xxx].side_]++; break; case 5: // '\005' RookCount[NowBoard.sq_[yyy][xxx].side_]++; break; case 2205: RookCount[NowBoard.sq_[yyy][xxx].side_]++; break; case 6: // '\006' RookCount[NowBoard.sq_[yyy][xxx].side_]++; break; case 9: // '\t' QueenCount[NowBoard.sq_[yyy][xxx].side_]++; break; case 29: // '\035' QueenCount[NowBoard.sq_[yyy][xxx].side_]++; break; case 89: // 'Y' QueenCount[NowBoard.sq_[yyy][xxx].side_]++; break; case 21: // '\025' QueenCount[NowBoard.sq_[yyy][xxx].side_]++; break; case 2209: QueenCount[NowBoard.sq_[yyy][xxx].side_]++; break; case 223: QueenCount[NowBoard.sq_[yyy][xxx].side_]++; break; case 224: QueenCount[NowBoard.sq_[yyy][xxx].side_]++; break; case -1: KingCount[NowBoard.sq_[yyy][xxx].side_]++; break; case -2: KingCount[NowBoard.sq_[yyy][xxx].side_]++; break; } } public void DesignateTheFineMoves(Chsq chsq) { good_move=1; if(skipDtGM | (depth > 1) | worried) return; else return; } public void DesignateTheGoodMoves(Chsq chsq) { if((whoseMove != chsq.side_) | (skipDtGM | (depth > 1))) return; IncrediblyGoodMove(chsq); if((Attackers[d[depth]][c[depth]][nextplayer(chsq.side_)] + Attackers[d[depth]][c[depth]][secondenemy(chsq.side_)] == 0) && (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) && (Attackers[d[depth]][c[depth]][nextplayer(chsq.side_)] + Attackers[d[depth]][c[depth]][secondenemy(chsq.side_)] == 0) && (Math.random() * 100D < 137D && !worried)) {AssignGoodMove8();if (NowBoard.sq_[d[depth]][c[depth]].piece_!=0){AssignGoodMove9();}} if((Attackers[d[depth]][c[depth]][nextplayer(chsq.side_)] + Attackers[d[depth]][c[depth]][secondenemy(chsq.side_)] == 0) && (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) && (Attackers[d[depth]][c[depth]][nextplayer(chsq.side_)] + Attackers[d[depth]][c[depth]][secondenemy(chsq.side_)] == 0) && (Math.random() * 100D < 134D && !worried)) {AssignGoodMove8();if (NowBoard.sq_[d[depth]][c[depth]].piece_!=0){AssignGoodMove9();}} if((Attackers[d[depth]][c[depth]][nextplayer(chsq.side_)] + Attackers[d[depth]][c[depth]][secondenemy(chsq.side_)] == 0) && (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((Attackers[d[depth]][c[depth]][nextplayer(chsq.side_)] + Attackers[d[depth]][c[depth]][secondenemy(chsq.side_)] == 0) && (IsMySideInCheck(nextplayer(chsq.side_)) | IsMySideInCheck(secondenemy(chsq.side_))) && (Math.random() * 100D < 131D && !worried)) AssignGoodMove2(); if((fifty_move_rule > 8) && chsq.pawn() && (Math.random() * 100D < (double)(100 - 10 * PawnCount[chsq.side_])) && (!worried) && (Attackers[d[depth]][c[depth]][nextplayer(chsq.side_)] + Attackers[d[depth]][c[depth]][secondenemy(chsq.side_)] == 0)) AssignGoodMove1(); AssignGoodMove1(); MoreGoodMoves(chsq); } public void DidICheckOrStalemate(Graphics g, int i) { } public void DisplayRules(Graphics g) { LowRectangle(g); g.drawString("Proprietary four-handed game, no partners.", 5, 315); g.drawString("When a king is captured, its army vanishes.", 5, 331); g.drawString("The program requires you to escape from check", 5, 347); g.drawString("if you can, otherwise you may make any move.", 5, 363); } public boolean DoesArchiveMatchNowBoard() { if(whoseMove != ArchiveBoard[xxx].sq_[0][0].side_) return false; for(ff=1; ff < 10; ff++) for(ee=1; ee < 10; 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 DrawNowBoard(Graphics g) { for(ee=1; ee < 10; ee++) for(ff=1; ff < 10; ff++) NowBoard.sq_[ff][ee].drawfeudal4(g, 1, icanmove[ff][ee]); } public void DrawPromotionOptions(Graphics g) { g.setColor(niceblue); g.fillRect(0, 301, 300, 134); 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.drawfeudal4(g, 11, false); happySquare.file_=4; happySquare.piece_=5; happySquare.drawfeudal4(g, 11, false); happySquare.file_=5; happySquare.piece_=4; happySquare.drawfeudal4(g, 11, false); happySquare.file_=6; happySquare.piece_=3; happySquare.drawfeudal4(g, 11, false); } public void ForGambler(Graphics g) { } public void GenerateAttackersArrays() { for(zatt=1; zatt < 5; zatt++) for(yatt=1; yatt < 10; yatt++) for(xatt=1; xatt < 10; xatt++) {Attackers[yatt][xatt][zatt]=0; StrongestAttacker[yatt][xatt][zatt]=0; WeakestAttacker[yatt][xatt][zatt]=0; } for(yatt=1; yatt < 10; yatt++) for(xatt=1; xatt < 10; xatt++) { satt=NowBoard.sq_[yatt][xatt].side_; patt=NowBoard.sq_[yatt][xatt].piece_; SupplementalAddAnAttacker(); if((patt == 5) | (patt == 2205) | (patt == 6) | (patt == 105) | (patt == 109) | (patt == 163) | (patt == 165) | (patt == 9) | (patt == -3) | (patt == 2209) | (patt == -9) | (patt == -67) | (patt == -68) | (patt == 57) | (patt == 29) | (patt == 28)) { catt=xatt; datt=yatt; for(; catt < 10; 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 < 10; 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 == 2204) | (patt == 9) | (patt == -3) | (patt == 2209) | (patt == -9) | (patt == -67) | (patt == -68) | (patt == 21) | (patt == 28) | (patt == 104) | (patt == 109) | (patt == 161) | (patt == 166)) { catt=xatt; for(datt=yatt; (catt < 10) && (datt < 10); datt++) { AddAnAttacker(); if((catt != xatt) && (NowBoard.sq_[datt][catt].side_ != 0)) catt=20; catt++; } catt=xatt; for(datt=yatt; (catt > 0) && (datt < 10); datt++) { AddAnAttacker(); if((catt != xatt) && (NowBoard.sq_[datt][catt].side_ != 0)) catt=-20; catt--; } catt=xatt; for(datt=yatt; (catt < 10) && (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 == 60) | (patt == 260) | (patt == 224)) { catt=xatt + 2; datt=yatt + 2; AddAnAttacker(); catt=xatt + 2; datt=yatt - 2; AddAnAttacker(); catt=xatt - 2; datt=yatt + 2; AddAnAttacker(); catt=xatt - 2; datt=yatt - 2; AddAnAttacker(); } if((patt == 3) | (patt == -3) | (patt == -67) | (patt == -68) | (patt == 2203) | (patt == 103) | (patt == -4) | (patt == -5) | (patt == 21) | (patt == 28) | (patt == 29) | (patt == 57) | (patt == 193) | (patt == 162) | (patt == 164)) { 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 == 23) | (patt == 123) | (patt == 140) | (patt == 223) | (patt == 224)) { 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(); } if((patt == 1) | (patt == 2) | (patt == 51) | (patt == 52) | (patt == 101) | (patt == 102) | (patt == 83) | (patt == 84) | (patt == 85) | (patt == 8101) | (patt == 8102)) { if(satt == 1) { datt=yatt + 1; catt=xatt + 1; AddAnAttacker(); datt=yatt + 1; catt=xatt - 1; AddAnAttacker(); } if(satt == 2) { datt=yatt - 1; catt=xatt + 1; AddAnAttacker(); datt=yatt - 1; catt=xatt - 1; AddAnAttacker(); } } } } public void GenerateCLCAttackersArrays(boolean flag, boolean flag1) { for(zatt=1; zatt < 5; zatt++) for(yatt=1; yatt < 10; yatt++) for(xatt=1; xatt < 10; xatt++) CLCAttackers[yatt][xatt][zatt]=0; for(yatt=1; yatt < 10; yatt++) for(xatt=1; xatt < 10; xatt++) { satt=MaybeBoard.sq_[yatt][xatt].side_; patt=MaybeBoard.sq_[yatt][xatt].piece_; SupplementalAddACLCAttacker(); if((patt == 5) | (patt == 2205) | (patt == 6) | (patt == 105) | (patt == 109) | (patt == 163) | (patt == 165) | (patt == 9) | (patt == -3) | (patt == 2209) | (patt == -9) | (patt == -67) | (patt == -68) | (patt == 57) | (patt == 29) | (patt == 28)) { catt=xatt; datt=yatt; for(; catt < 10; catt++) { AddACLCAttacker(); if((catt != xatt) && ((MaybeBoard.sq_[datt][catt].side_ == satt) | (MaybeBoard.sq_[datt][catt].piece_ > 0))) catt=20; } catt=xatt; datt=yatt; for(; catt > 0; catt--) { AddACLCAttacker(); if((catt != xatt) && ((MaybeBoard.sq_[datt][catt].side_ == satt) | (MaybeBoard.sq_[datt][catt].piece_ > 0))) catt=-20; } catt=xatt; for(datt=yatt; datt < 10; datt++) { AddACLCAttacker(); if((datt != yatt) && ((MaybeBoard.sq_[datt][catt].side_ == satt) | (MaybeBoard.sq_[datt][catt].piece_ > 0))) datt=20; } catt=xatt; for(datt=yatt; datt > 0; datt--) { AddACLCAttacker(); if((datt != yatt) && ((MaybeBoard.sq_[datt][catt].side_ == satt) | (MaybeBoard.sq_[datt][catt].piece_ > 0))) datt=-20; } } if((patt == 4) | (patt == 2204) | (patt == 9) | (patt == -3) | (patt == 2209) | (patt == -9) | (patt == -67) | (patt == -68) | (patt == 21) | (patt == 28) | (patt == 104) | (patt == 109) | (patt == 161) | (patt == 166)) { catt=xatt; for(datt=yatt; (catt < 10) && (datt < 10); datt++) { AddACLCAttacker(); if((catt != xatt) && ((MaybeBoard.sq_[datt][catt].side_ == satt) | (MaybeBoard.sq_[datt][catt].piece_ > 0))) catt=20; catt++; } catt=xatt; for(datt=yatt; (catt > 0) && (datt < 10); datt++) { AddACLCAttacker(); if((catt != xatt) && ((MaybeBoard.sq_[datt][catt].side_ == satt) | (MaybeBoard.sq_[datt][catt].piece_ > 0))) catt=-20; catt--; } catt=xatt; for(datt=yatt; (catt < 10) && (datt > 0); catt++) { AddACLCAttacker(); if((datt != yatt) && ((MaybeBoard.sq_[datt][catt].side_ == satt) | (MaybeBoard.sq_[datt][catt].piece_ > 0))) catt=20; datt--; } catt=xatt; for(datt=yatt; (catt > 0) && (datt > 0); catt--) { AddACLCAttacker(); if((datt != yatt) && ((MaybeBoard.sq_[datt][catt].side_ == satt) | (MaybeBoard.sq_[datt][catt].piece_ > 0))) catt=-20; datt--; } } if((patt == 60) | (patt == 260) | (patt == 224)) { catt=xatt + 2; datt=yatt + 2; AddACLCAttacker(); catt=xatt + 2; datt=yatt - 2; AddACLCAttacker(); catt=xatt - 2; datt=yatt + 2; AddACLCAttacker(); catt=xatt - 2; datt=yatt - 2; AddACLCAttacker(); } if((patt == 3) | (patt == -3) | (patt == -67) | (patt == -68) | (patt == 2203) | (patt == 103) | (patt == -4) | (patt == -5) | (patt == 21) | (patt == 28) | (patt == 29) | (patt == 57) | (patt == 193) | (patt == 162) | (patt == 164)) { catt=xatt + 1; datt=yatt + 2; AddACLCAttacker(); catt=xatt + 1; datt=yatt - 2; AddACLCAttacker(); catt=xatt - 1; datt=yatt + 2; AddACLCAttacker(); catt=xatt - 1; datt=yatt - 2; AddACLCAttacker(); catt=xatt + 2; datt=yatt + 1; AddACLCAttacker(); catt=xatt + 2; datt=yatt - 1; AddACLCAttacker(); catt=xatt - 2; datt=yatt + 1; AddACLCAttacker(); catt=xatt - 2; datt=yatt - 1; AddACLCAttacker(); } if(flag1 && (patt < 0) | (patt == 25)) { catt=xatt + 1; datt=yatt + 1; AddACLCAttacker(); catt=xatt + 1; datt=yatt - 1; AddACLCAttacker(); catt=xatt - 1; datt=yatt + 1; AddACLCAttacker(); catt=xatt - 1; datt=yatt - 1; AddACLCAttacker(); catt=xatt; datt=yatt + 1; AddACLCAttacker(); catt=xatt; datt=yatt - 1; AddACLCAttacker(); catt=xatt + 1; datt=yatt; AddACLCAttacker(); catt=xatt - 1; datt=yatt; AddACLCAttacker(); } if((patt == 23) | (patt == 123) | (patt == 140) | (patt == 223) | (patt == 224)) { catt=xatt + 1; datt=yatt + 1; AddACLCAttacker(); catt=xatt + 1; datt=yatt - 1; AddACLCAttacker(); catt=xatt - 1; datt=yatt + 1; AddACLCAttacker(); catt=xatt - 1; datt=yatt - 1; AddACLCAttacker(); } if((patt == 1) | (patt == 2) | (patt == 51) | (patt == 52) | (patt == 101) | (patt == 102) | (patt == 83) | (patt == 84) | (patt == 85) | (patt == 8101) | (patt == 8102)) { if(satt == 1) if(flag) { datt=yatt + 1; catt=xatt + 1; AddACLCAttacker(); datt=yatt + 1; catt=xatt - 1; AddACLCAttacker(); } else if(yatt < 9 && MaybeBoard.sq_[yatt + 1][xatt].piece_ == 0) { datt=yatt + 1; catt=xatt; AddACLCAttacker(); if((MaybeBoard.sq_[yatt + 1][xatt].piece_ == 0) && (MaybeBoard.sq_[yatt + 2][xatt].piece_ == 0) && (satt == 1) && (yatt == 2)) { datt=4; catt=xatt; AddACLCAttacker(); } } if(satt == 2) if(flag) { datt=yatt - 1; catt=xatt + 1; AddACLCAttacker(); datt=yatt - 1; catt=xatt - 1; AddACLCAttacker(); } else if(yatt > 1 && MaybeBoard.sq_[yatt - 1][xatt].piece_ == 0) { datt=yatt - 1; catt=xatt; AddACLCAttacker(); if((MaybeBoard.sq_[yatt - 1][xatt].piece_ == 0) && (MaybeBoard.sq_[yatt - 2][xatt].piece_ == 0) && (satt == 2) && (yatt == 7)) { datt=5; catt=xatt; AddACLCAttacker(); } } } } } public void HappyFiftyMoveRule() { if((NowBoard.sq_[moveto_rank][moveto_file].piece_ > 0) | (NowBoard.sq_[mover_rank][mover_file].piece_ == 1) | (NowBoard.sq_[mover_rank][mover_file].piece_ == 298) | (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; return; } fifty_move_rule++; if((fifty_move_rule > fifties_got_to) && (fifty_move_rule <102)) fifties_got_to=fifty_move_rule; } public boolean HumanMoveAPiece(Graphics g, int i, int j) { if((mover_rank == i) && (mover_file == j)) { markingAPiece=true; DrawNowBoard(g); return false; } if(!IsMyMoveListed()) { return false; } else { moveto_rank=i; moveto_file=j; TotalBackBoard(); who_backed=whoseMove; NormalMove(g); TotalMaybeBoard(NowBoard,MaybeBoard);DidICheckOrStalemate(g, whoseMove); whatpiecescanmove(g); markingAPiece=true; DrawNowBoard(g); TotalMaybeBoard(NowBoard, MaybeBoard); TotalMaybeBoard(MaybeBoard, TwoBoard); TotalMaybeBoard(TwoBoard, ThreeBoard); TotalMaybeBoard(ThreeBoard, FourBoard); return true; } } public boolean IGaveEscapableCheck(int i) { if(i > 2) return false; if(!IsMySideInCheck(3 - i)) return false; GenerateCLCAttackersArrays(true, true); cee=KingFile[3 - i]; dee=KingRank[3 - i] + 1; if(KingCanEscape(3 - i)) return true; cee=KingFile[3 - i] + 1; dee=KingRank[3 - i] + 1; if(KingCanEscape(3 - i)) return true; cee=KingFile[3 - i] + 1; dee=KingRank[3 - i]; if(KingCanEscape(3 - i)) return true; cee=KingFile[3 - i] + 1; dee=KingRank[3 - i] - 1; if(KingCanEscape(3 - i)) return true; cee=KingFile[3 - i]; dee=KingRank[3 - i] - 1; if(KingCanEscape(3 - i)) return true; cee=KingFile[3 - i] - 1; dee=KingRank[3 - i] - 1; if(KingCanEscape(3 - i)) return true; cee=KingFile[3 - i] - 1; dee=KingRank[3 - i]; if(KingCanEscape(3 - i)) return true; cee=KingFile[3 - i] - 1; dee=KingRank[3 - i] + 1; if(KingCanEscape(3 - i)) return true; if(CLCAttackers[KingRank[3 - i]][KingFile[3 - i]][i] > 1) return false; GenerateCLCAttackersArrays(true, false); if(CLCAttackers[assailant_rank][assailant_file][3 - i] > 0) return true; if((assailant_file - KingFile[3 - i]) * (assailant_file - KingFile[3 - i]) + (assailant_rank - KingRank[3 - i]) * (assailant_rank - KingRank[3 - i]) == 5) return false; GenerateCLCAttackersArrays(false, false); if(assailant_file < KingFile[3 - i]) xee=1; if(assailant_file == KingFile[3 - i]) xee=0; if(assailant_file > KingFile[3 - i]) xee=-1; if(assailant_rank < KingRank[3 - i]) yee=1; if(assailant_rank == KingRank[3 - i]) yee=0; if(assailant_rank > KingRank[3 - i]) yee=-1; cee=assailant_file; dee=assailant_rank; if((cee<1)|(dee<1)|(cee>9)|(dee>9)) return true; while((cee != KingFile[3 - i]) | (dee != KingRank[3 - i])) { if(CLCAttackers[dee][cee][3 - i] > 0) return true; cee += xee; dee += yee; if((cee < 1) | (cee > 9) | (dee < 1) | (dee > 9)) return false; } return false; } public void IncrediblyGoodMove(Chsq chsq) { } public boolean IsEnemyAlfil(int i, int j, int k) { if((j > 9) | (j < 1) | (i > 9) | (i < 1)) return false; if(MaybeBoard.sq_[i][j].side_ == k) return false; if(MaybeBoard.sq_[i][j].piece_ == 60) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 260) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 224) { assailant_rank=i; assailant_file=j; return true; } else { return false; } } public boolean IsEnemyBishop(int i, int j) { if((j > 9) | (j < 1) | (i > 9) | (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_ == 2204) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == -3) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 161) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 166) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 9) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 2209) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == -67) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == -68) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 8104) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 8109) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 104) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 109) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 21) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 28) { assailant_rank=i; assailant_file=j; return true; } else { return false; } } public boolean IsEnemyBluePawn(int i, int j, int k) { if((j > 9) | (j < 1) | (i > 9) | (i < 1)) return false; if(MaybeBoard.sq_[i][j].side_ == k) return false; if((MaybeBoard.sq_[i][j].piece_ == 1) && (MaybeBoard.sq_[i][j].side_ == 1)) { assailant_rank=i; assailant_file=j; return true; } else { return false; } } public boolean IsEnemyFerz(int i, int j, int k) { if((j > 9) | (j < 1) | (i > 9) | (i < 1)) return false; if(MaybeBoard.sq_[i][j].side_ == k) return false; if(MaybeBoard.sq_[i][j].piece_ == 123) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 140) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 23) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 223) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 224) { assailant_rank=i; assailant_file=j; return true; } else { return false; } } public boolean IsEnemyKing(int i, int j, int k) { if((j > 9) | (j < 1) | (i > 9) | (i < 1)) 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; } if(MaybeBoard.sq_[i][j].piece_ == -14) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == -13) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == -2) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 8099) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 8098) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 25) { assailant_rank=i; assailant_file=j; return true; } else { return false; } } public boolean IsEnemyKnight(int i, int j, int k) { if((j > 9) | (j < 1) | (i > 9) | (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; } if(MaybeBoard.sq_[i][j].piece_ == -3) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == -67) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == -68) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 2203) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 164) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 162) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 193) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 8103) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 103) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 103) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == -4) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == -5) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 21) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 28) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 29) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 57) { assailant_rank=i; assailant_file=j; return true; } else { return false; } } public boolean IsEnemyRedPawn(int i, int j, int k) { if((j > 9) | (j < 1) | (i > 9) | (i < 1)) return false; if(MaybeBoard.sq_[i][j].side_ == k) return false; if((MaybeBoard.sq_[i][j].piece_ == 1) && (MaybeBoard.sq_[i][j].side_ == 3)) { assailant_rank=i; assailant_file=j; return true; } else { return false; } } public boolean IsEnemyRook(int i, int j) { if((j > 9) | (j < 1) | (i > 9) | (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_ == 2205) { 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_ == -3) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 163) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 165) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 9) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 2209) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == -67) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == -68) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 8105) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 8106) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 8109) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 105) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 106) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 109) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 28) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 29) { assailant_rank=i; assailant_file=j; return true; } if(MaybeBoard.sq_[i][j].piece_ == 57) { assailant_rank=i; assailant_file=j; return true; } else { return false; } } public boolean IsEnemyWhitePawn(int i, int j, int k) { if((j > 9) | (j < 1) | (i > 9) | (i < 1)) return false; if(MaybeBoard.sq_[i][j].side_ == k) return false; if((MaybeBoard.sq_[i][j].piece_ == 1) && (MaybeBoard.sq_[i][j].side_ == 4)) { assailant_rank=i; assailant_file=j; return true; } else { return false; } } public boolean IsEnemyGoldPawn(int i, int j, int k) { if((j > 9) | (j < 1) | (i > 9) | (i < 1)) return false; if(MaybeBoard.sq_[i][j].side_ == k) return false; if((MaybeBoard.sq_[i][j].piece_ == 1) && (MaybeBoard.sq_[i][j].side_ == 2)) { 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_ == b) && (MaybeMoves[x].endingsquare_.file_ == a)) return true; return false; } public boolean IsMySideInCheck(int i) { whichkingisworried=i; if(AnotherWayToCheck(i)) return true; for(xxx=1; xxx < 10; xxx++) for(yyy=1; yyy < 10; 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() { if(GameOver) return true; CountAllThePieces(); if( (QueenCount[1] == 0) && (QueenCount[2] == 0) && (RookCount[1] == 0) && (RookCount[2] == 0) && (PawnCount[1] == 0) && (PawnCount[2] == 0) &&(QueenCount[3] == 0) && (QueenCount[4] == 0) && (RookCount[3] == 0) && (RookCount[4] == 0) && (PawnCount[3] == 0) && (PawnCount[4] == 0) ) { if(BishopCount[1] + BishopCount[2] + BishopCount[3] + BishopCount[4] + KnightCount[1] + KnightCount[2] + KnightCount[3] + KnightCount[4] < 2) { GameOver=true; drawn_games++; ShowStatusQ("Lack of force"); return true; } if((BishopCount[1] + BishopCount[2] + BishopCount[3] + BishopCount[4] == 0) && (KnightCount[1] + KnightCount[2] + KnightCount[3] + KnightCount[4] < 3)) { GameOver=true; drawn_games++; ShowStatusQ("Lack of force"); return true; } } return false; } public boolean KingCanEscape(int i) { if(cee > 9) return false; if(cee < 1) return false; if(dee > 9) return false; if(dee < 1) return false; if(MaybeBoard.sq_[dee][cee].side_ == i) return false; if ((KingRank[i]-assailant_rank)*(cee-assailant_file) == (dee-assailant_rank)*(KingFile[i]-assailant_file)) { if ((assailant_rank!=dee)|(assailant_file!=cee))if (MaybeBoard.sq_[assailant_rank][assailant_file].piece_>2){return false;} } if (assailant2_rank>0) { if ((KingRank[i]-assailant2_rank)*(cee-assailant2_file) == (dee-assailant2_rank)*(KingFile[i]-assailant2_file)) { if ((assailant2_rank!=dee)|(assailant2_file!=cee))if (MaybeBoard.sq_[assailant2_rank][assailant2_file].piece_>2){return false;} } } return CLCAttackers[dee][cee][3 - i] <= 0; } public void LowRectangle(Graphics g) { g.setColor(niceblue); g.fillRect(0, 301, 300, 134); 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 void MachineMoveExtra(Graphics g, int i) { } 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] < 10; x_run[1]++) for(y_run[1]=1; y_run[1] < 10; 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_; RedCastleCheat(); } NormalMove(g); NowBoard.sq_[mover_rank][mover_file].drawfeudal4(g, 1, false); NowBoard.sq_[moveto_rank][moveto_file].drawfeudal4(g, 1, 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 { MachineMoveExtra(g, i); return true; } } public boolean MaybeAdd(Graphics g, Chsq chsq, CB11_11 cb11_11, CB11_11 cb11_11_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] > 9) | (d[depth] < 1) | (d[depth] > 9)) return false; if(!PassedOtherRequirementsToKeep(chsq, cb11_11, cb11_11_1)) return false; if(NowBoard.sq_[d[depth]][c[depth]].side_ == chsq.side_) return false; alterMaybeBoard(g, chsq, cb11_11.sq_[d[depth]][c[depth]], cb11_11, cb11_11_1); worried=AmIWorried(chsq.side_); if(IsMySideInCheck(chsq.side_) && IHaveAMoveNotIntoCheck[chsq.side_]) { unalterMaybeBoard(g, chsq, cb11_11.sq_[d[depth]][c[depth]], cb11_11, cb11_11_1); CheckSquare[depth]=true; if(NowBoard.sq_[d[depth]][c[depth]].piece_ != 0) SquatterOnCheckSquare[depth]=true; return false; } if(!IsMySideInCheck(chsq.side_)) IHaveAMoveNotIntoCheck[chsq.side_]=true; 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_=cb11_11.sq_[d[depth]][c[depth]]; } DesignateTheGoodMoves(chsq); if(worried && (IsThisAGoodMove()==false) && (moveCounter > 1) && (!WhoIsHuman[whoseMove])) moveCounter--; unalterMaybeBoard(g, chsq, cb11_11.sq_[d[depth]][c[depth]], cb11_11, cb11_11_1); IAmAbleToMove[chsq.side_]=true; return NowBoard.sq_[d[depth]][c[depth]].side_ == 0; } public void MaybeCastleKingside(Graphics g, int i) { if(depth > 1) return; if(AnotherReasonNotToCastleKingside(i)) return; if(i == 1) { if(NowBoard.sq_[1][8].piece_ != 6) return; if(NowBoard.sq_[1][7].piece_ != 0) return; if(NowBoard.sq_[1][6].piece_ != 0) return; if(AmIUnderAttack(1, 5, 1)) return; if(AmIUnderAttack(1, 6, 1)) return; if(AmIUnderAttack(1, 7, 1)) return; d[depth]=1; c[depth]=7; MaybeAdd(g, NowBoard.sq_[1][5], NowBoard, MaybeBoard); } if(i == 2) { if(NowBoard.sq_[8][8].piece_ != 6) return; if(NowBoard.sq_[8][7].piece_ != 0) return; if(NowBoard.sq_[8][6].piece_ != 0) return; if(AmIUnderAttack(8, 5, 2)) return; if(AmIUnderAttack(8, 6, 2)) return; if(AmIUnderAttack(8, 7, 2)) return; d[depth]=8; c[depth]=7; MaybeAdd(g, NowBoard.sq_[8][5], NowBoard, MaybeBoard); } } public void MaybeCastleQueenside(Graphics g, int i) { if(depth > 1) return; if(AnotherReasonNotToCastleQueenside(i)) return; if(i == 1) { if((NowBoard.sq_[1][1].piece_ != 6) && (NowBoard.sq_[1][1].piece_ != 57)) return; if(NowBoard.sq_[1][2].piece_ != 0) return; if(NowBoard.sq_[1][3].piece_ != 0) return; if(NowBoard.sq_[1][4].piece_ != 0) return; if(AmIUnderAttack(1, 5, 1)) return; if(AmIUnderAttack(1, 4, 1)) return; if(AmIUnderAttack(1, 3, 1)) return; d[depth]=1; c[depth]=3; MaybeAdd(g, NowBoard.sq_[1][5], NowBoard, MaybeBoard); } if(i == 2) { if((NowBoard.sq_[8][1].piece_ != 6) && (NowBoard.sq_[8][1].piece_ != 28)) return; if(NowBoard.sq_[8][2].piece_ != 0) return; if(NowBoard.sq_[8][3].piece_ != 0) return; if(NowBoard.sq_[8][4].piece_ != 0) return; if(AmIUnderAttack(8, 5, 2)) return; if(AmIUnderAttack(8, 4, 2)) return; if(AmIUnderAttack(8, 3, 2)) return; d[depth]=8; c[depth]=3; MaybeAdd(g, NowBoard.sq_[8][5], NowBoard, MaybeBoard); } } public void MoreGoodMoves(Chsq chsq) { } public void AssignVariantName(){ variant_name="Feudal Chess"; } public void NameThisChessVariant(Graphics g) { AssignVariantName(); 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:", 270, 15); } public void NextOrdinaryPlayer(Graphics g) { TotalMaybeBoard(NowBoard, MaybeBoard); TotalMaybeBoard(MaybeBoard, TwoBoard); TotalMaybeBoard(TwoBoard, ThreeBoard); TotalMaybeBoard(ThreeBoard, FourBoard); IsTheGameOver(); if(GameOver) return; for(ff=1; ff < 5; ff++) { IAmAbleToMove[ff]=false; IAmPresentlyInCheck[ff]=false; IHaveAMoveNotIntoCheck[ff]=false; } for(ff=1; ff < 10; ff++) for(ee=1; ee < 10; ee++) if(NowBoard.sq_[ff][ee].side_ != 0) { skipDtGM=true; findPieceMoves(g, NowBoard.sq_[ff][ee], NowBoard, MaybeBoard); skipDtGM=false; } if((!IAmAbleToMove[2]) && (!IAmAbleToMove[3]) && (!IAmAbleToMove[4])) { wins[1]++; ShowStatusQ("Blue wins!"); GameOver=true; return; } if((!IAmAbleToMove[1]) && (!IAmAbleToMove[3]) && (!IAmAbleToMove[4])) { wins[2]++; ShowStatusQ("Gold wins!"); GameOver=true; return; } if((!IAmAbleToMove[1]) && (!IAmAbleToMove[2]) && (!IAmAbleToMove[4])) { wins[3]++; ShowStatusQ("Red wins!"); GameOver=true; return; } if((!IAmAbleToMove[1]) && (!IAmAbleToMove[2]) && (!IAmAbleToMove[3])) { wins[4]++; ShowStatusQ("White wins!"); GameOver=true; return; } if (WhoIsHuman[whoseMove]==true){SayWhoIsHuman(g);} failsafe(g); whoseMove++; if(whoseMove == 5) whoseMove=1; if(whoseMove == 1) turncounter++; if(!IAmAbleToMove[whoseMove]) { whoseMove++; if(whoseMove == 5) whoseMove=1; if(whoseMove == 1) turncounter++; } if(!IAmAbleToMove[whoseMove]) { whoseMove++; if(whoseMove == 5) whoseMove=1; if(whoseMove == 1) turncounter++; } if(!IAmAbleToMove[whoseMove]) { whoseMove++; if(whoseMove == 5) whoseMove=1; if(whoseMove == 1) turncounter++; } if(!IAmAbleToMove[whoseMove]) { whoseMove++; if(whoseMove == 5) whoseMove=1; if(whoseMove == 1) turncounter++; } UnTwoThePawns(whoseMove); whatpiecescanmove(g); TotalMaybeBoard(NowBoard, MaybeBoard); TotalMaybeBoard(MaybeBoard, TwoBoard); TotalMaybeBoard(TwoBoard, ThreeBoard); TotalMaybeBoard(ThreeBoard, FourBoard); GenerateAttackersArrays(); CountAllThePieces(); DrawNowBoard(g); } public void NightMoves(Chsq chsq) { } public int NightScore(Chsq chsq) { return 0; } 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(); PawnStuff(g); HappyFiftyMoveRule(); 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(); CastleStuff(g); 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_ == -18) NowBoard.sq_[moveto_rank][moveto_file].piece_=-17; 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; if(NowBoard.sq_[moveto_rank][moveto_file].piece_ < 0) { KingRank[whoseMove]=moveto_rank; KingFile[whoseMove]=moveto_file; } PromoStuff(g); TwoingPawns(); if((NowBoard.sq_[moveto_rank][moveto_file].piece_ > 2200) && (NowBoard.sq_[moveto_rank][moveto_file].piece_ < 2300)) { NowBoard.sq_[mover_rank][mover_file].piece_=NowBoard.sq_[mover_rank][mover_file].piece_ - 2200; NowBoard.sq_[moveto_rank][moveto_file].piece_=NowBoard.sq_[moveto_rank][moveto_file].piece_ - 2200; } else { NowBoard.sq_[mover_rank][mover_file].side_=0; NowBoard.sq_[mover_rank][mover_file].piece_=0; } NormalMoveFinale(g); TotalMaybeBoard(NowBoard, MaybeBoard); TotalMaybeBoard(MaybeBoard, TwoBoard); TotalMaybeBoard(TwoBoard, ThreeBoard); TotalMaybeBoard(ThreeBoard, FourBoard); ShowStatusNothing(); Archives(); inquire_about_terms(); if (WhoIsHuman[whoseMove]==true){SayWhoIsHuman(g);} } public void NormalMoveExtra() { if(NowBoard.sq_[moveto_rank][moveto_file].piece_ < 0) { xxx=NowBoard.sq_[moveto_rank][moveto_file].side_; for(ff=1; ff < 10; ff++) for(ee=1; ee < 10; ee++) if(NowBoard.sq_[ff][ee].side_ == xxx) { NowBoard.sq_[ff][ee].side_=0; NowBoard.sq_[ff][ee].piece_=0; } } } public void NormalMoveFinale(Graphics g) { } public boolean PassedOtherRequirementsToKeep(Chsq chsq, CB11_11 cb11_11, CB11_11 cb11_11_1) { if(chsq.piece_ == 1) { if((chsq.file_ == c[depth]) | (chsq.rank_ == d[depth]) && NowBoard.sq_[d[depth]][c[depth]].piece_ != 0) return false; if((chsq.file_ != c[depth]) && (chsq.rank_ != d[depth]) && cb11_11.sq_[d[depth]][c[depth]].piece_ == 0) return false; if((chsq.side_ == 1) && (c[depth] < chsq.file_) && (d[depth] < chsq.rank_)) return false; if((chsq.side_ == 2) && (c[depth] < chsq.file_) && (d[depth] > chsq.rank_)) return false; if((chsq.side_ == 3) && (c[depth] > chsq.file_) && (d[depth] > chsq.rank_)) return false; if((chsq.side_ == 4) && (c[depth] > chsq.file_) && (d[depth] < chsq.rank_)) return false; if((chsq.side_ == 1) && (c[depth] == chsq.file_) && (d[depth] < chsq.rank_)) return false; if((chsq.side_ == 2) && (c[depth] == chsq.file_) && (d[depth] > chsq.rank_)) return false; if((chsq.side_ == 3) && (c[depth] == chsq.file_) && (d[depth] > chsq.rank_)) return false; if((chsq.side_ == 4) && (c[depth] == chsq.file_) && (d[depth] < chsq.rank_)) return false; if((chsq.side_ == 1) && (c[depth] < chsq.file_) && (d[depth] == chsq.rank_)) return false; if((chsq.side_ == 2) && (c[depth] < chsq.file_) && (d[depth] == chsq.rank_)) return false; if((chsq.side_ == 3) && (c[depth] > chsq.file_) && (d[depth] == chsq.rank_)) return false; if((chsq.side_ == 4) && (c[depth] > chsq.file_) && (d[depth] == chsq.rank_)) return false; } return true; } public void PawnStuff(Graphics g) { if(NowBoard.sq_[mover_rank][mover_file].piece_ == 2) NowBoard.sq_[mover_rank][mover_file].piece_=1; I_just_took_en_passant=false; 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_ == 1) | (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)) && ((NowBoard.sq_[mover_rank][moveto_file].piece_ == 2) | (NowBoard.sq_[mover_rank][moveto_file].piece_ == 52) | (NowBoard.sq_[mover_rank][moveto_file].piece_ == 84) | (NowBoard.sq_[mover_rank][moveto_file].piece_ == 102) | (NowBoard.sq_[mover_rank][moveto_file].piece_ == 8102))) { NowBoard.sq_[mover_rank][moveto_file].piece_=0; NowBoard.sq_[mover_rank][moveto_file].side_=0; ShowStatusQ("En Passant");CapturedAPawn[whoseMove]=true; I_just_took_en_passant=true; NowBoard.sq_[mover_rank][moveto_file].drawfeudal4(g, 1, false); MaybeBoard.sq_[mover_rank][moveto_file].side_=0; MaybeBoard.sq_[mover_rank][moveto_file].piece_=0; } } public void PromoStuff(Graphics g) { if(NowBoard.sq_[moveto_rank][moveto_file].piece_ != 1) return; if(NowBoard.sq_[moveto_rank][moveto_file].side_ == 1) { if((moveto_rank < 9) && (moveto_file < 9)) return; if((moveto_rank <= 5) | (moveto_file <= 5)) return; if(!WhoIsHuman[1]) { NowBoard.sq_[moveto_rank][moveto_file].piece_=9; return; } } if(NowBoard.sq_[moveto_rank][moveto_file].side_ == 2) { if((moveto_rank > 1) && (moveto_file < 9)) return; if((moveto_rank >= 5) | (moveto_file <= 5)) return; if(!WhoIsHuman[2]) { NowBoard.sq_[moveto_rank][moveto_file].piece_=9; return; } } if(NowBoard.sq_[moveto_rank][moveto_file].side_ == 3) { if((moveto_rank > 1) && (moveto_file > 1)) return; if((moveto_rank >= 5) | (moveto_file >= 5)) return; if(!WhoIsHuman[3]) { NowBoard.sq_[moveto_rank][moveto_file].piece_=9; return; } } if(NowBoard.sq_[moveto_rank][moveto_file].side_ == 4) { if((moveto_rank < 9) && (moveto_file > 1)) return; if((moveto_rank <= 5) | (moveto_file >= 5)) return; if(!WhoIsHuman[4]) { NowBoard.sq_[moveto_rank][moveto_file].piece_=9; return; } } PromotingAPawn=true; queening_rank=moveto_rank; queening_file=moveto_file; DrawPromotionOptions(g); } public boolean PromotionClicks(int i, int j) { if(j < 330) return true; if(j > 360) return true; if(i < 100) return true; if(i > 210) return true; if(i < 120) xxx=9; else if(i < 150) xxx=5; else if(i < 180) xxx=4; else xxx=3; return true; } public void RedCastleCheat() { } public void SaySomethingElseAboutWhoIsHuman(Graphics g) { } public void SayWhoIsHuman(Graphics g) { if(PromotingAPawn) return; g.setColor(niceblue); g.fillRect(0, 301, 300, 134); g.setColor(Color.black); g.setFont(f1); g.drawString("Blue:", 10, 320); g.drawString("Gold:", 10, 340); g.drawString("Red:", 10, 360); g.drawString("White:", 10, 380); g.drawString("Computer", 120, 320); g.drawString("Human", 60, 320); g.drawString("Computer", 120, 340); g.drawString("Human", 60, 340); g.drawString("Computer", 120, 360); g.drawString("Human", 60, 360); g.drawString("Computer", 120, 380); g.drawString("Human", 60, 380); g.setFont(f1);NameThisChessVariant(g); g.drawString("Blue " + wins[1] + " Gold " + wins[2] + " Red " + wins[3] + " White " + wins[4] + " Drawn " + drawn_games, 5, 430); g.setFont(f3); g.drawString("--Ed Friedlander", 235, 430); g.setFont(f2); if(humanizing) g.drawString("OKAY", 210, 330); g.setColor(Color.blue); if(WhoIsHuman[1]) { g.drawRect(56, 306, 48, 18); g.drawRect(57, 307, 46, 16); } if(!WhoIsHuman[1]) { g.drawRect(117, 306, 61, 18); g.drawRect(118, 307, 59, 16); } g.setColor(Color.yellow); if(WhoIsHuman[2]) { g.drawRect(56, 326, 48, 18); g.drawRect(57, 327, 46, 16); } if(!WhoIsHuman[2]) { g.drawRect(117, 326, 61, 18); g.drawRect(118, 327, 59, 16); } g.setColor(Color.red); if(WhoIsHuman[3]) { g.drawRect(56, 346, 48, 18); g.drawRect(57, 347, 46, 16); } if(!WhoIsHuman[3]) { g.drawRect(117, 346, 61, 18); g.drawRect(118, 347, 59, 16); } g.setColor(Color.white); if(WhoIsHuman[4]) { g.drawRect(56, 366, 48, 18); g.drawRect(57, 367, 46, 16); } if(!WhoIsHuman[4]) { g.drawRect(117, 366, 61, 18); g.drawRect(118, 367, 59, 16); } SaySomethingElseAboutWhoIsHuman(g); } public void ShowStatusNothing() { if(!GameOver) ShowStatusQ(""); } public void StartUp(Graphics g) { halt_if_king_taken=false; accepted_terms=false; who_is_winning=0; assailant_rank=0; assailant_file=0; assailant2_rank=0; assailant2_file=0; fifty_move_rule=0; knights_are_knightriders=false; turncounter=1;saved_fifty_move_rule=0;saved_turncounter=1;ShowStatusNothing(); markingAPiece=true; KingRank[0]=0; KingFile[0]=0; KingRank[1]=1; KingFile[1]=5; KingRank[2]=8; KingFile[2]=5; for(a=0; a < 5; 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 <= 9; a++) for(b=1; b <= 9; b++) { NowBoard.sq_[b][a].piece_=0; NowBoard.sq_[b][a].side_=0; if((b < 5) && (a < 5)) NowBoard.sq_[b][a].side_=1; if((b > 5) && (a < 5)) NowBoard.sq_[b][a].side_=2; if((b > 5) && (a > 5)) NowBoard.sq_[b][a].side_=3; if((b < 5) && (a > 5)) NowBoard.sq_[b][a].side_=4; } NowBoard.sq_[1][1].piece_=-1; NowBoard.sq_[2][1].piece_=5; NowBoard.sq_[1][2].piece_=5; NowBoard.sq_[2][2].piece_=9; NowBoard.sq_[1][3].piece_=3; NowBoard.sq_[3][2].piece_=3; NowBoard.sq_[2][3].piece_=4; NowBoard.sq_[3][1].piece_=4; NowBoard.sq_[1][4].piece_=1; NowBoard.sq_[2][4].piece_=1; NowBoard.sq_[3][3].piece_=1; NowBoard.sq_[3][4].piece_=1; NowBoard.sq_[4][1].piece_=1; NowBoard.sq_[4][2].piece_=1; NowBoard.sq_[4][3].piece_=1; NowBoard.sq_[4][4].piece_=1; NowBoard.sq_[1][9].piece_=-1; NowBoard.sq_[2][9].piece_=5; NowBoard.sq_[1][8].piece_=5; NowBoard.sq_[2][8].piece_=9; NowBoard.sq_[1][7].piece_=3; NowBoard.sq_[3][8].piece_=3; NowBoard.sq_[2][7].piece_=4; NowBoard.sq_[3][9].piece_=4; NowBoard.sq_[1][6].piece_=1; NowBoard.sq_[2][6].piece_=1; NowBoard.sq_[3][7].piece_=1; NowBoard.sq_[3][6].piece_=1; NowBoard.sq_[4][9].piece_=1; NowBoard.sq_[4][8].piece_=1; NowBoard.sq_[4][7].piece_=1; NowBoard.sq_[4][6].piece_=1; NowBoard.sq_[9][1].piece_=-1; NowBoard.sq_[8][1].piece_=5; NowBoard.sq_[9][2].piece_=5; NowBoard.sq_[8][2].piece_=9; NowBoard.sq_[9][3].piece_=3; NowBoard.sq_[7][2].piece_=3; NowBoard.sq_[8][3].piece_=4; NowBoard.sq_[7][1].piece_=4; NowBoard.sq_[9][4].piece_=1; NowBoard.sq_[8][4].piece_=1; NowBoard.sq_[7][3].piece_=1; NowBoard.sq_[7][4].piece_=1; NowBoard.sq_[6][1].piece_=1; NowBoard.sq_[6][2].piece_=1; NowBoard.sq_[6][3].piece_=1; NowBoard.sq_[6][4].piece_=1; NowBoard.sq_[9][9].piece_=-1; NowBoard.sq_[8][9].piece_=5; NowBoard.sq_[9][8].piece_=5; NowBoard.sq_[8][8].piece_=9; NowBoard.sq_[9][7].piece_=3; NowBoard.sq_[7][8].piece_=3; NowBoard.sq_[8][7].piece_=4; NowBoard.sq_[7][9].piece_=4; NowBoard.sq_[9][6].piece_=1; NowBoard.sq_[8][6].piece_=1; NowBoard.sq_[7][7].piece_=1; NowBoard.sq_[7][6].piece_=1; NowBoard.sq_[6][9].piece_=1; NowBoard.sq_[6][8].piece_=1; NowBoard.sq_[6][7].piece_=1; NowBoard.sq_[6][6].piece_=1; SupplementalStartup(); whoseMove=1; ForGambler(g); PromotingAPawn=false; GameOver=false; fifty_move_rule=0; DrawNowBoard(g); TotalMaybeBoard(NowBoard, MaybeBoard); TotalMaybeBoard(MaybeBoard, TwoBoard); TotalMaybeBoard(TwoBoard, ThreeBoard); TotalMaybeBoard(ThreeBoard, FourBoard); GenerateAttackersArrays(); SupplementalStartup(g); IsTheGameOver(); whatpiecescanmove(g); AssumeAllIsWell(); TotalSaveBoard(); TotalBackBoard(); } 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, CB11_11 cb11_11, CB11_11 cb11_11_1) { } public void SupplementalStartup() { } public void SupplementalStartup(Graphics g) { } public void TotalMaybeBoard(CB11_11 cb11_11, CB11_11 cb11_11_1) { for(xxx=1; xxx < 10; xxx++) for(yyy=1; yyy < 10; yyy++) { cb11_11_1.sq_[yyy][xxx].side_=cb11_11.sq_[yyy][xxx].side_; cb11_11_1.sq_[yyy][xxx].piece_=cb11_11.sq_[yyy][xxx].piece_; } } public void TwoingPawns() { if((NowBoard.sq_[moveto_rank][moveto_file].side_ == 1) && (NowBoard.sq_[moveto_rank][moveto_file].piece_ == 1) && (moveto_rank == 4) && (mover_rank < 3)) NowBoard.sq_[moveto_rank][moveto_file].piece_=2; if((NowBoard.sq_[moveto_rank][moveto_file].side_ == 1) && (NowBoard.sq_[moveto_rank][moveto_file].piece_ == 8101) && (moveto_rank == 4) && (mover_rank < 3)) NowBoard.sq_[moveto_rank][moveto_file].piece_=8102; if((NowBoard.sq_[moveto_rank][moveto_file].side_ == 1) && (NowBoard.sq_[moveto_rank][moveto_file].piece_ == 51) && (moveto_rank == 4) && (mover_rank < 3)) NowBoard.sq_[moveto_rank][moveto_file].piece_=52; if((NowBoard.sq_[moveto_rank][moveto_file].side_ == 1) && (NowBoard.sq_[moveto_rank][moveto_file].piece_ == 83) && (moveto_rank == 4) && (mover_rank < 3)) NowBoard.sq_[moveto_rank][moveto_file].piece_=84; if((NowBoard.sq_[moveto_rank][moveto_file].side_ == 2) && (NowBoard.sq_[moveto_rank][moveto_file].piece_ == 1) && (moveto_rank == 5) && (mover_rank > 6)) NowBoard.sq_[moveto_rank][moveto_file].piece_=2; if((NowBoard.sq_[moveto_rank][moveto_file].side_ == 2) && (NowBoard.sq_[moveto_rank][moveto_file].piece_ == 8101) && (moveto_rank == 5) && (mover_rank > 6)) NowBoard.sq_[moveto_rank][moveto_file].piece_=8102; if((NowBoard.sq_[moveto_rank][moveto_file].side_ == 2) && (NowBoard.sq_[moveto_rank][moveto_file].piece_ == 51) && (moveto_rank == 5) && (mover_rank > 6)) NowBoard.sq_[moveto_rank][moveto_file].piece_=52; if((NowBoard.sq_[moveto_rank][moveto_file].side_ == 2) && (NowBoard.sq_[moveto_rank][moveto_file].piece_ == 83) && (moveto_rank == 5) && (mover_rank > 6)) NowBoard.sq_[moveto_rank][moveto_file].piece_=84; } public void UnTwoThePawns(int i) { if((mover_rank == moveto_rank) && (mover_file == moveto_file)) return; for(xq=1; xq < 10; xq++) for(yq=1; yq < 10; yq++) { if((NowBoard.sq_[yq][xq].side_ == i) && (NowBoard.sq_[yq][xq].piece_ == 2)) NowBoard.sq_[yq][xq].piece_=1; if((NowBoard.sq_[yq][xq].side_ == i) && (NowBoard.sq_[yq][xq].piece_ == 52)) NowBoard.sq_[yq][xq].piece_=51; if((NowBoard.sq_[yq][xq].side_ == i) && (NowBoard.sq_[yq][xq].piece_ == 84)) NowBoard.sq_[yq][xq].piece_=83; if((NowBoard.sq_[yq][xq].side_ == i) && (NowBoard.sq_[yq][xq].piece_ == 102)) NowBoard.sq_[yq][xq].piece_=101; } } 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, CB11_11 cb11_11, CB11_11 cb11_11_1) { cb11_11_1.sq_[chsq.rank_][chsq.file_].piece_=0; cb11_11_1.sq_[chsq.rank_][chsq.file_].side_=0; cb11_11_1.sq_[chsq1.rank_][chsq1.file_].piece_=cb11_11.sq_[chsq.rank_][chsq.file_].piece_; cb11_11_1.sq_[chsq1.rank_][chsq1.file_].side_=cb11_11.sq_[chsq.rank_][chsq.file_].side_; if((cb11_11.sq_[chsq.rank_][chsq.file_].piece_ == 1) && (cb11_11.sq_[chsq1.rank_][chsq1.file_].side_ == 0) && (chsq.file_ != chsq1.file_) && ((chsq.rank_ - chsq1.rank_) * (chsq.rank_ - chsq1.rank_) == 1) && ((chsq.file_ - chsq1.file_) * (chsq.file_ - chsq1.file_) == 1) && (((cb11_11.sq_[chsq.rank_][chsq1.file_].piece_ == 2) | (cb11_11.sq_[chsq.rank_][chsq1.file_].piece_ == 52) | (cb11_11.sq_[chsq.rank_][chsq1.file_].piece_ == 84) | (cb11_11.sq_[chsq.rank_][chsq1.file_].piece_ == 102)))) { cb11_11_1.sq_[chsq.rank_][chsq1.file_].piece_=0; cb11_11_1.sq_[chsq.rank_][chsq1.file_].side_=0; } } public void failsafe(Graphics g) { } public boolean findPieceMoves(Graphics g, Chsq chsq, CB11_11 cb11_11, CB11_11 cb11_11_1) { CheckSquare[depth]=false; SquatterOnCheckSquare[depth]=false; SupplementalMovers(g, chsq, cb11_11, cb11_11_1); if((chsq.piece_ == 60) | (chsq.piece_ == 260) | (chsq.piece_ == 224)) { c[depth]=chsq.file_ - 2; d[depth]=chsq.rank_ - 2; MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_ - 2; d[depth]=chsq.rank_ + 2; MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_ + 2; d[depth]=chsq.rank_ - 2; MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_ + 2; d[depth]=chsq.rank_ + 2; MaybeAdd(g, chsq, cb11_11, cb11_11_1); } if((chsq.piece_ == 9) | (chsq.piece_ == -3) | (chsq.piece_ == 2209) | (chsq.piece_ == -67) | (chsq.piece_ == -68) | (chsq.piece_ == 5) | (chsq.piece_ == 2205) | (chsq.piece_ == 57) | (chsq.piece_ == 29) | (chsq.piece_ == 109) | (chsq.piece_ == 105) | (chsq.piece_ == 161) | (chsq.piece_ == 162) | (chsq.piece_ == 163) | (chsq.piece_ == 165) | (chsq.piece_ == 28) | (chsq.piece_ == 6)) { c[depth]=chsq.file_ - 1; for(d[depth]=chsq.rank_; MaybeAdd(g, chsq, cb11_11, cb11_11_1) | CheckSquare[depth] && (chsq.piece_ != -9) && (chsq.piece_ != -67) && (!SquatterOnCheckSquare[depth]); c[depth]=c[depth] - 1); } if((chsq.piece_ == 9) | (chsq.piece_ == -3) | (chsq.piece_ == 2209) | (chsq.piece_ == -67) | (chsq.piece_ == -68) | (chsq.piece_ == 5) | (chsq.piece_ == 2205) | (chsq.piece_ == 57) | (chsq.piece_ == 29) | (chsq.piece_ == 109) | (chsq.piece_ == 105) | (chsq.piece_ == 161) | (chsq.piece_ == 162) | (chsq.piece_ == 163) | (chsq.piece_ == 165) | (chsq.piece_ == 28) | (chsq.piece_ == 6)) { c[depth]=chsq.file_ + 1; for(d[depth]=chsq.rank_; MaybeAdd(g, chsq, cb11_11, cb11_11_1) | CheckSquare[depth] && (chsq.piece_ != -9) && (chsq.piece_ != -67) && (!SquatterOnCheckSquare[depth]); c[depth]++); } if((chsq.piece_ == 9) | (chsq.piece_ == -3) | (chsq.piece_ == 2209) | (chsq.piece_ == -67) | (chsq.piece_ == -68) | (chsq.piece_ == 5) | (chsq.piece_ == 2205) | (chsq.piece_ == 57) | (chsq.piece_ == 29) | (chsq.piece_ == 109) | (chsq.piece_ == 105) | (chsq.piece_ == 161) | (chsq.piece_ == 162) | (chsq.piece_ == 163) | (chsq.piece_ == 165) | (chsq.piece_ == 28) | (chsq.piece_ == 6)) { c[depth]=chsq.file_; for(d[depth]=chsq.rank_ - 1; MaybeAdd(g, chsq, cb11_11, cb11_11_1) | CheckSquare[depth] && (chsq.piece_ != -9) && (chsq.piece_ != -67) && (!SquatterOnCheckSquare[depth]); d[depth]=d[depth] - 1); } if((chsq.piece_ == 9) | (chsq.piece_ == -3) | (chsq.piece_ == 2209) | (chsq.piece_ == -67) | (chsq.piece_ == -68) | (chsq.piece_ == 5) | (chsq.piece_ == 2205) | (chsq.piece_ == 57) | (chsq.piece_ == 29) | (chsq.piece_ == 109) | (chsq.piece_ == 105) | (chsq.piece_ == 161) | (chsq.piece_ == 162) | (chsq.piece_ == 163) | (chsq.piece_ == 165) | (chsq.piece_ == 28) | (chsq.piece_ == 6)) { c[depth]=chsq.file_; for(d[depth]=chsq.rank_ + 1; MaybeAdd(g, chsq, cb11_11, cb11_11_1) | CheckSquare[depth] && (chsq.piece_ != -9) && (chsq.piece_ != -67) && (!SquatterOnCheckSquare[depth]); d[depth]++); } if((chsq.piece_ == 9) | (chsq.piece_ == -3) | (chsq.piece_ == 2209) | (chsq.piece_ == -67) | (chsq.piece_ == -68) | (chsq.piece_ == 4) | (chsq.piece_ == 2204) | (chsq.piece_ == 21) | (chsq.piece_ == 28) | (chsq.piece_ == 109) | (chsq.piece_ == 104) | (chsq.piece_ == 161) | (chsq.piece_ == 163) | (chsq.piece_ == 164) | (chsq.piece_ == 166)) { c[depth]=chsq.file_ - 1; for(d[depth]=chsq.rank_ - 1; MaybeAdd(g, chsq, cb11_11, cb11_11_1) | CheckSquare[depth] && (chsq.piece_ != -9) && (chsq.piece_ != -67) && (!SquatterOnCheckSquare[depth]); d[depth]=d[depth] - 1) c[depth]=c[depth] - 1; } if((chsq.piece_ == 9) | (chsq.piece_ == -3) | (chsq.piece_ == 2209) | (chsq.piece_ == -67) | (chsq.piece_ == -68) | (chsq.piece_ == 4) | (chsq.piece_ == 2204) | (chsq.piece_ == 21) | (chsq.piece_ == 28) | (chsq.piece_ == 109) | (chsq.piece_ == 104) | (chsq.piece_ == 161) | (chsq.piece_ == 163) | (chsq.piece_ == 164) | (chsq.piece_ == 166)) { c[depth]=chsq.file_ - 1; for(d[depth]=chsq.rank_ + 1; MaybeAdd(g, chsq, cb11_11, cb11_11_1) | CheckSquare[depth] && (chsq.piece_ != -9) && (chsq.piece_ != -67) && (!SquatterOnCheckSquare[depth]); d[depth]=d[depth] + 1) c[depth]=c[depth] - 1; } if((chsq.piece_ == 9) | (chsq.piece_ == -3) | (chsq.piece_ == 2209) | (chsq.piece_ == -67) | (chsq.piece_ == -68) | (chsq.piece_ == 4) | (chsq.piece_ == 2204) | (chsq.piece_ == 21) | (chsq.piece_ == 28) | (chsq.piece_ == 109) | (chsq.piece_ == 104) | (chsq.piece_ == 161) | (chsq.piece_ == 163) | (chsq.piece_ == 164) | (chsq.piece_ == 166)) { c[depth]=chsq.file_ + 1; for(d[depth]=chsq.rank_ - 1; MaybeAdd(g, chsq, cb11_11, cb11_11_1) | CheckSquare[depth] && (chsq.piece_ != -9) && (chsq.piece_ != -67) && (!SquatterOnCheckSquare[depth]); d[depth]=d[depth] - 1) c[depth]=c[depth] + 1; } if((chsq.piece_ == 9) | (chsq.piece_ == -3) | (chsq.piece_ == 2209) | (chsq.piece_ == -67) | (chsq.piece_ == -68) | (chsq.piece_ == 4) | (chsq.piece_ == 2204) | (chsq.piece_ == 21) | (chsq.piece_ == 28) | (chsq.piece_ == 109) | (chsq.piece_ == 104) | (chsq.piece_ == 161) | (chsq.piece_ == 163) | (chsq.piece_ == 164) | (chsq.piece_ == 166)) { c[depth]=chsq.file_ + 1; for(d[depth]=chsq.rank_ + 1; MaybeAdd(g, chsq, cb11_11, cb11_11_1) | CheckSquare[depth] && (chsq.piece_ != -9) && (chsq.piece_ != -67) && (!SquatterOnCheckSquare[depth]); d[depth]=d[depth] + 1) c[depth]=c[depth] + 1; } if((chsq.piece_ == -1) | (chsq.piece_ == -2) | (chsq.piece_ == 1)) { c[depth]=chsq.file_ + 1; d[depth]=chsq.rank_; MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_; d[depth]=chsq.rank_ + 1; MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_ - 1; d[depth]=chsq.rank_; MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_; d[depth]=chsq.rank_ - 1; MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_ + 1; d[depth]=chsq.rank_ + 1; MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_ + 1; d[depth]=chsq.rank_ - 1; MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_ - 1; d[depth]=chsq.rank_ + 1; MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_ - 1; d[depth]=chsq.rank_ - 1; MaybeAdd(g, chsq, cb11_11, cb11_11_1); if(chsq.piece_ == -2) { MaybeCastleKingside(g, chsq.side_); MaybeCastleQueenside(g, chsq.side_); } } if(chsq.piece_ == 140) { c[depth]=chsq.file_; d[depth]=chsq.rank_ + 1; if(NowBoard.sq_[d[depth]][c[depth]].piece_ != 0) MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_; d[depth]=chsq.rank_ - 1; if(NowBoard.sq_[d[depth]][c[depth]].piece_ != 0) MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_ + 1; d[depth]=chsq.rank_ + 1; if(NowBoard.sq_[d[depth]][c[depth]].piece_ == 0) MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_ + 1; d[depth]=chsq.rank_ - 1; if(NowBoard.sq_[d[depth]][c[depth]].piece_ == 0) MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_ - 1; d[depth]=chsq.rank_ + 1; if(NowBoard.sq_[d[depth]][c[depth]].piece_ == 0) MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_ - 1; d[depth]=chsq.rank_ - 1; if(NowBoard.sq_[d[depth]][c[depth]].piece_ == 0) MaybeAdd(g, chsq, cb11_11, cb11_11_1); if((chsq.side_ == 1) && ((chsq.rank_ == 2) | (chsq.rank_ == 3) | (chsq.rank_ == 4)) | (chsq.side_ == 2) && ((chsq.rank_ == 5) | (chsq.rank_ == 6) | (chsq.rank_ == 7))) { if((NowBoard.sq_[chsq.rank_ + 1][chsq.file_ + 1].piece_ == 0) && (chsq.rank_ < 8) && (chsq.file_ < 8)) { c[depth]=chsq.file_ + 2; d[depth]=chsq.rank_ + 2; if(NowBoard.sq_[d[depth]][c[depth]].piece_ == 0) MaybeAdd(g, chsq, cb11_11, cb11_11_1); } if((NowBoard.sq_[chsq.rank_ + 1][chsq.file_ - 1].piece_ == 0) && (chsq.rank_ < 8) && (chsq.file_ > 2)) { c[depth]=chsq.file_ - 2; d[depth]=chsq.rank_ + 2; if(NowBoard.sq_[d[depth]][c[depth]].piece_ == 0) MaybeAdd(g, chsq, cb11_11, cb11_11_1); } if((NowBoard.sq_[chsq.rank_ - 1][chsq.file_ + 1].piece_ == 0) && (chsq.rank_ > 2) && (chsq.file_ < 8)) { c[depth]=chsq.file_ + 2; d[depth]=chsq.rank_ - 2; if(NowBoard.sq_[d[depth]][c[depth]].piece_ == 0) MaybeAdd(g, chsq, cb11_11, cb11_11_1); } if((NowBoard.sq_[chsq.rank_ - 1][chsq.file_ - 1].piece_ == 0) && (chsq.rank_ > 2) && (chsq.file_ > 2)) { c[depth]=chsq.file_ - 2; d[depth]=chsq.rank_ - 2; if(NowBoard.sq_[d[depth]][c[depth]].piece_ == 0) MaybeAdd(g, chsq, cb11_11, cb11_11_1); } } } if((chsq.piece_ == 23) | (chsq.piece_ == 123) | (chsq.piece_ == 223) | (chsq.piece_ == 224)) { c[depth]=chsq.file_ + 1; d[depth]=chsq.rank_ + 1; MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_ + 1; d[depth]=chsq.rank_ - 1; MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_ - 1; d[depth]=chsq.rank_ + 1; MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_ - 1; d[depth]=chsq.rank_ - 1; MaybeAdd(g, chsq, cb11_11, cb11_11_1); } if((chsq.piece_ == 3) | (chsq.piece_ == -3) | (chsq.piece_ == -67) | (chsq.piece_ == -68) | (chsq.piece_ == 2203) | (chsq.piece_ == 193) | (chsq.piece_ == -4) | (chsq.piece_ == -5) | (chsq.piece_ == 21) | (chsq.piece_ == 28) | (chsq.piece_ == 57) | (chsq.piece_ == 162) | (chsq.piece_ == 164) | (chsq.piece_ == 165) | (chsq.piece_ == 166) | (chsq.piece_ == 29) | (chsq.piece_ == 103)) { c[depth]=chsq.file_ - 2; d[depth]=chsq.rank_ - 1; MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_ - 2; d[depth]=chsq.rank_ + 1; MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_ + 2; d[depth]=chsq.rank_ - 1; MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_ + 2; d[depth]=chsq.rank_ + 1; MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_ - 1; d[depth]=chsq.rank_ - 2; MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_ - 1; d[depth]=chsq.rank_ + 2; MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_ + 1; d[depth]=chsq.rank_ - 2; MaybeAdd(g, chsq, cb11_11, cb11_11_1); c[depth]=chsq.file_ + 1; d[depth]=chsq.rank_ + 2; MaybeAdd(g, chsq, cb11_11, cb11_11_1); } return moveCounter != 0; } public void init() { halt_if_king_taken=true; term_counts=new int[5]; best_four_count=new int[7]; IAmAbleToMove=new boolean[5]; IAmPresentlyInCheck=new boolean[5]; IHaveAMoveNotIntoCheck=new boolean[5]; niceblue=new Color(0, 192, 255); 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]; KingFile=new int[5]; KingRank=new int[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[11][11][5]; StrongestAttacker=new int[11][11][5]; WeakestAttacker=new int[11][11][5]; CLCAttackers=new int[11][11][5]; NowBoard=new CB11_11(311); SaveBoard=new CB11_11(311); BackBoard=new CB11_11(311); icanmove=new boolean[11][11]; MaybeBoard=new CB11_11(311); OneBoard=new CB11_11(311); TwoBoard=new CB11_11(311); ThreeBoard=new CB11_11(311); FourBoard=new CB11_11(311); happySquare=new Chsq(1, 1, 5, 1); ArchiveBoard=new CB11_11[102]; 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; 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 CB11_11(311);} 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].drawfeudal4(g, 1, icanmove[i][j]); return false; } NowBoard.sq_[i][j].drawfeudal4(g, 2, false); for(x=1; x <= moveCounter; x++) MaybeMoves[x].endingsquare_.markchsq9(g); markingAPiece=false; return true; } public boolean mouseDown(Event event, int i, int j) { if(NowBoard == null) return true; Graphics g=getGraphics(); TotalMaybeBoard(NowBoard, MaybeBoard); TotalMaybeBoard(MaybeBoard, TwoBoard); TotalMaybeBoard(TwoBoard, ThreeBoard); TotalMaybeBoard(ThreeBoard, FourBoard); 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=10 - j / 30; if(!PromotingAPawn) if((i >= 56) && (j >= 306) && (i <= 104) && (j <= 324)) { humanizing=true; WhoIsHuman[1]=true; SayWhoIsHuman(g); } else if((i >= 117) && (j >= 306) && (i <= 178) && (j <= 324)) { humanizing=true; WhoIsHuman[1]=false; SayWhoIsHuman(g); } else if((i >= 56) && (j >= 326) && (i <= 104) && (j <= 344)) { humanizing=true; WhoIsHuman[2]=true; SayWhoIsHuman(g); } else if((i >= 117) && (j >= 326) && (i <= 178) && (j <= 344)) { 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 >= 56) && (j >= 346) && (i <= 104) && (j <= 364)) { humanizing=true; WhoIsHuman[3]=true; SayWhoIsHuman(g); } else if((i >= 117) && (j >= 346) && (i <= 178) && (j <= 364)) { humanizing=true; WhoIsHuman[3]=false; SayWhoIsHuman(g); } else if((i >= 56) && (j >= 366) && (i <= 104) && (j <= 384)) { humanizing=true; WhoIsHuman[4]=true; SayWhoIsHuman(g); } else if((i >= 117) && (j >= 366) && (i <= 178) && (j <= 384)) { humanizing=true; WhoIsHuman[4]=false; SayWhoIsHuman(g); } else if((i >= 210) && (j >= 301) && (i < 270) && (j < 350)) { 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; } } } else if((i >= 147) && (j >= 316) && (i < 242) && (j < 334)) { if(who_is_winning == 0) return true; humanizing=true; accepted_terms=false; SayWhoIsHuman(g); } if(humanizing) return true; if((a < 1) | (a > 9) | (b < 1) | (b > 9) && !PromotingAPawn) 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].drawfeudal4(g, 1, false); TotalMaybeBoard(NowBoard,MaybeBoard);DidICheckOrStalemate(g, whoseMove); PromotingAPawn=false; if (WhoIsHuman[whoseMove]==true){SayWhoIsHuman(g);} NextOrdinaryPlayer(g); if(WhoIsHuman[whoseMove]) { markingAPiece=true; 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) { setBackground(niceblue); if(NowBoard == null) { g.setColor(Color.black); g.setFont(f1); AssignVariantName();g.drawString("Thank you for playing!", 5, 20); g.drawString("Final totals: Blue " + wins[1] + " Gold " + wins[2] + " Red " + wins[3] + " White " + wins[4] + " Drawn " + drawn_games, 5, 430); return; } paintSomethingElse(g); DrawNowBoard(g); g.setColor(niceblue); g.fillRect(0, 301, 300, 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].drawfeudal4(g, 2, false); for(x=1; x <= moveCounter; x++) MaybeMoves[x].endingsquare_.markchsq9(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 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; CLCAttackers=null; destroy(); } public void unalterMaybeBoard(Graphics g, Chsq chsq, Chsq chsq1, CB11_11 cb11_11, CB11_11 cb11_11_1) { cb11_11_1.sq_[chsq.rank_][chsq.file_].piece_=cb11_11.sq_[chsq.rank_][chsq.file_].piece_; cb11_11_1.sq_[chsq.rank_][chsq.file_].side_=cb11_11.sq_[chsq.rank_][chsq.file_].side_; cb11_11_1.sq_[chsq1.rank_][chsq1.file_].piece_=cb11_11.sq_[chsq1.rank_][chsq1.file_].piece_; cb11_11_1.sq_[chsq1.rank_][chsq1.file_].side_=cb11_11.sq_[chsq1.rank_][chsq1.file_].side_; cb11_11_1.sq_[chsq.rank_][chsq1.file_].side_=cb11_11.sq_[chsq.rank_][chsq1.file_].side_; cb11_11_1.sq_[chsq.rank_][chsq1.file_].piece_=cb11_11.sq_[chsq.rank_][chsq1.file_].piece_; } public void SupplementalAddACLCAttacker() { } public void whatpiecescanmove(Graphics g) { for(ee=1; ee < 10; ee++) for(ff=1; ff < 10; ff++) { icanmove[ff][ee]=false; moveCounter=0; 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); } public void AssumeAllIsWell(){ x=0;while (x<5){ IAmAbleToMove[x]=true; IAmPresentlyInCheck[x]=false; IHaveAMoveNotIntoCheck[x]=true; x++;} } 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; boolean IAmAbleToMove[]; boolean IAmPresentlyInCheck[]; boolean IHaveAMoveNotIntoCheck[]; static int strategos; Color niceblue; boolean IHaveBeenInCheck[]; boolean CapturedAKing[]; boolean CapturedAQueen[]; boolean CapturedABishop[]; boolean CapturedARook[]; boolean CapturedAKnight[]; boolean CapturedAPawn[]; static int cee; static int dee; static int eee; static int xee; static int yee; static int turncounter;static int saved_turncounter;static int back_turncounter;static int saved_fifty_move_rule;static int back_fifty_move_rule; static int fifties_got_to; static int assailant_rank; static int assailant_file; static int assailant2_rank; static int assailant2_file; int KingFile[]; int KingRank[]; int PawnCount[]; int KnightCount[]; int BishopCount[]; int RookCount[]; int QueenCount[]; int KingCount[]; int Attackers[][][]; int StrongestAttacker[][][]; int WeakestAttacker[][][]; int CLCAttackers[][][]; CB11_11 NowBoard; CB11_11 BackBoard; CB11_11 SaveBoard; boolean icanmove[][]; CB11_11 MaybeBoard; CB11_11 OneBoard; CB11_11 TwoBoard; CB11_11 ThreeBoard; CB11_11 FourBoard; Chsq happySquare; CB11_11 ArchiveBoard[]; Chmo MaybeMoves[]; static int ArchiveCounter; static int whichkingisworried; 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 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 humanizing; static boolean I_just_took_en_passant; static boolean knights_are_knightriders; 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;static int saved_whoseMove; boolean WhoIsHuman[]; int wins[]; static String stringy; static boolean halt_if_king_taken; static char oopsKey; static char loadKey; static char saveKey; static int who_backed; static int who_saved;static int when_saved; }