// 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: TileChss.java import java.applet.Applet; import java.awt.*; public class TileChss extends Applet { 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; whoseMove=who_backed; SayWhoIsHuman(g); whatpiecescanmove(g); TotalMaybeBoard(NowBoard, MaybeBoard); GenerateAttackersArrays(); CountAllThePieces(); DrawNowBoard(g); return true; } if (k==saveKey) { TotalSaveBoard();TotalMaybeBoard(NowBoard, MaybeBoard); who_saved=whoseMove; } if (k==loadKey) { PromotingAPawn=false; GameOver=false; LoadSavedBoard();TotalMaybeBoard(NowBoard, MaybeBoard); markingAPiece=true; whoseMove=who_backed; SayWhoIsHuman(g); whatpiecescanmove(g); TotalMaybeBoard(NowBoard, MaybeBoard); GenerateAttackersArrays(); CountAllThePieces(); DrawNowBoard(g); return true; } System.out.println("kurwa"); return false; } public void TotalBackBoard(){back_turncounter=turncounter;back_fifty_move_rule=fifty_move_rule; for(xxx=0; xxx < 15; xxx++) for(yyy=0; yyy < 15; yyy++) { BackBoard.sq_[yyy][xxx].side_=NowBoard.sq_[yyy][xxx].side_; BackBoard.sq_[yyy][xxx].piece_=NowBoard.sq_[yyy][xxx].piece_; SomethingElseForTotalBackBoard(); } } public void TotalSaveBoard(){saved_fifty_move_rule=fifty_move_rule;saved_turncounter=turncounter; for(xxx=0; xxx < 15; xxx++) for(yyy=0; yyy < 15; 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 < 15; xxx++) for(yyy=0; yyy < 15; yyy++) { NowBoard.sq_[yyy][xxx].side_=BackBoard.sq_[yyy][xxx].side_; NowBoard.sq_[yyy][xxx].piece_=BackBoard.sq_[yyy][xxx].piece_; SomethingElseForUnBackBoard(); } } public void LoadSavedBoard(){turncounter=saved_turncounter;fifty_move_rule=saved_fifty_move_rule;ShowStatusNothing(); for(xxx=0; xxx < 15; xxx++) for(yyy=0; yyy < 15; 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 int draw_score(int i){ return 12*QueenCount[i]+5*RookCount[i]+3*BishopCount[i]+3*KnightCount[i]+PawnCount[i]; } 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 int e1(int i){ switch(i){ case 1:{return 2;} case 2:{return 3;} case 3:{return 4;} case 4:{return 5;} case 5:{return 6;} case 6:{return 1;} } return 0; } public int e2(int i){ switch(i){ case 1:{return 3;} case 2:{return 4;} case 3:{return 5;} case 4:{return 6;} case 5:{return 1;} case 6:{return 2;} } return 0; } public int e3(int i){ switch(i){ case 1:{return 4;} case 2:{return 5;} case 3:{return 6;} case 4:{return 1;} case 5:{return 2;} case 6:{return 3;} } return 0; } public int e4(int i){ switch(i){ case 1:{return 5;} case 2:{return 6;} case 3:{return 1;} case 4:{return 2;} case 5:{return 3;} case 6:{return 4;} } return 0; } public int e5(int i){ switch(i){ case 1:{return 6;} case 2:{return 1;} case 3:{return 2;} case 4:{return 3;} case 5:{return 4;} case 6:{return 5;} } return 0; } public void SettleADrawnGame(){ if (tile_chess==false){drawn_games++;return;} CountAllThePieces(); winner=1; if (draw_score(2)>draw_score(winner)){winner=2;} if (draw_score(3)>draw_score(winner)){winner=3;} if (draw_score(4)>draw_score(winner)){winner=4;} if (draw_score(5)>draw_score(winner)){winner=5;} if (draw_score(6)>draw_score(winner)){winner=6;} wins[winner]++; System.out.println(""+draw_score(1)+","+draw_score(2)+","+draw_score(3)+","+draw_score(4)+","+draw_score(5)+","+draw_score(6)); switch(winner){ case 1:{ShowStatusQ("Red wins on points!");break;} case 2:{ShowStatusQ("Gold wins on points!");break;} case 3:{ShowStatusQ("Blue wins on points!");break;} case 4:{ShowStatusQ("Black wins on points!");break;} case 5:{ShowStatusQ("White wins on points!");break;} case 6:{ShowStatusQ("Green wins on points!");break;} } } public TileChss() { } public void NormalMoveExtra() { if ((tile_chess==true)&&(NowBoard.sq_[moveto_rank][moveto_file].piece_<0)) { loser_color=NowBoard.sq_[moveto_rank][moveto_file].side_; ff=1;while (ff<15){ ee=1;while (ee<15){ if (NowBoard.sq_[ff][ee].side_==loser_color) {NowBoard.sq_[ff][ee].side_=whoseMove;} ee++;}ff++;} } } public boolean IsEnemyBishop(int i, int j) { if((j > 14) | (j < 1) | (i > 14) | (i < 1)) return false; if ((screen_color>0)&&(MaybeBoard.sq_[i][j].side_!=screen_color)){return false;} if( (MaybeBoard.sq_[i][j].piece_ == 4) | (MaybeBoard.sq_[i][j].piece_ == 9) ) { assailant_rank=i; assailant_file=j; MaybeBoard.sq_[assailant_rank][assailant_file].piece_=0; MaybeBoard.sq_[assailant_rank][assailant_file].side_=0; if (AmIConnected(MaybeBoard)==true) { //System.out.print("1"); MaybeBoard.sq_[assailant_rank][assailant_file].piece_=NowBoard.sq_[assailant_rank][assailant_file].piece_; MaybeBoard.sq_[assailant_rank][assailant_file].side_=NowBoard.sq_[assailant_rank][assailant_file].side_; return true; } else { //System.out.print("0a"+"["+i+""+j+""+d[depth]+""+c[depth]+"]"); MaybeBoard.sq_[assailant_rank][assailant_file].piece_=NowBoard.sq_[assailant_rank][assailant_file].piece_; MaybeBoard.sq_[assailant_rank][assailant_file].side_=NowBoard.sq_[assailant_rank][assailant_file].side_; return false; } } else { return false; } } public boolean IsEnemyKing(int i, int j, int k) { if((j > 14) | (j < 1) | (i > 14) | (i < 1)) return false; if(MaybeBoard.sq_[i][j].side_ == k) return false; if( (MaybeBoard.sq_[i][j].piece_ == -1) | (MaybeBoard.sq_[i][j].piece_ == -2) ) { assailant_rank=i; assailant_file=j; MaybeBoard.sq_[assailant_rank][assailant_file].piece_=0; MaybeBoard.sq_[assailant_rank][assailant_file].side_=0; if (AmIConnected(MaybeBoard)==true) { //System.out.print("1"); MaybeBoard.sq_[assailant_rank][assailant_file].piece_=NowBoard.sq_[assailant_rank][assailant_file].piece_; MaybeBoard.sq_[assailant_rank][assailant_file].side_=NowBoard.sq_[assailant_rank][assailant_file].side_; return true; } else { //System.out.print("0c"+"["+i+""+j+""+d[depth]+""+c[depth]+"]"); MaybeBoard.sq_[assailant_rank][assailant_file].piece_=NowBoard.sq_[assailant_rank][assailant_file].piece_; MaybeBoard.sq_[assailant_rank][assailant_file].side_=NowBoard.sq_[assailant_rank][assailant_file].side_; return false; } } else { return false; } } public boolean IsEnemyKnight(int i, int j, int k) { if((j > 14) | (j < 1) | (i > 14) | (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; MaybeBoard.sq_[assailant_rank][assailant_file].piece_=0; MaybeBoard.sq_[assailant_rank][assailant_file].side_=0; if (AmIConnected(MaybeBoard)==true) { //System.out.print("1"); MaybeBoard.sq_[assailant_rank][assailant_file].piece_=NowBoard.sq_[assailant_rank][assailant_file].piece_; MaybeBoard.sq_[assailant_rank][assailant_file].side_=NowBoard.sq_[assailant_rank][assailant_file].side_; return true; } else { //System.out.print("0e"+"["+i+""+j+""+d[depth]+""+c[depth]+"]"); MaybeBoard.sq_[assailant_rank][assailant_file].piece_=NowBoard.sq_[assailant_rank][assailant_file].piece_; MaybeBoard.sq_[assailant_rank][assailant_file].side_=NowBoard.sq_[assailant_rank][assailant_file].side_; return false; } } else { return false; } } public boolean IsEnemyPawn(int i, int j, int k) { if((j > 14) | (j < 1) | (i > 14) | (i < 1)) return false; if(MaybeBoard.sq_[i][j].side_ == k) return false; if ( (MaybeBoard.sq_[i][j].piece_ == 1) | (MaybeBoard.sq_[i][j].piece_ == 2) ) { assailant_rank=i; assailant_file=j; MaybeBoard.sq_[assailant_rank][assailant_file].piece_=0; MaybeBoard.sq_[assailant_rank][assailant_file].side_=0; if (AmIConnected(MaybeBoard)==true) { //System.out.print("1"); MaybeBoard.sq_[assailant_rank][assailant_file].piece_=NowBoard.sq_[assailant_rank][assailant_file].piece_; MaybeBoard.sq_[assailant_rank][assailant_file].side_=NowBoard.sq_[assailant_rank][assailant_file].side_; return true; } else { //System.out.print("0f"+"["+i+""+j+""+d[depth]+""+c[depth]+"]"); MaybeBoard.sq_[assailant_rank][assailant_file].piece_=NowBoard.sq_[assailant_rank][assailant_file].piece_; MaybeBoard.sq_[assailant_rank][assailant_file].side_=NowBoard.sq_[assailant_rank][assailant_file].side_; return false; } } else { return false; } } public boolean IsEnemyRook(int i, int j) { if((j > 14) | (j < 1) | (i > 14) | (i < 1)) return false; if ((screen_color>0)&&(MaybeBoard.sq_[i][j].side_!=screen_color)){return false;} if( (MaybeBoard.sq_[i][j].piece_ == 5) | (MaybeBoard.sq_[i][j].piece_ == 6) | (MaybeBoard.sq_[i][j].piece_ == 9) ) { assailant_rank=i; assailant_file=j; MaybeBoard.sq_[assailant_rank][assailant_file].piece_=0; MaybeBoard.sq_[assailant_rank][assailant_file].side_=0; if (AmIConnected(MaybeBoard)==true) { //System.out.print("1"); MaybeBoard.sq_[assailant_rank][assailant_file].piece_=NowBoard.sq_[assailant_rank][assailant_file].piece_; MaybeBoard.sq_[assailant_rank][assailant_file].side_=NowBoard.sq_[assailant_rank][assailant_file].side_; return true; } else { //System.out.print("0h"+"["+i+""+j+""+d[depth]+""+c[depth]+"]"); MaybeBoard.sq_[assailant_rank][assailant_file].piece_=NowBoard.sq_[assailant_rank][assailant_file].piece_; MaybeBoard.sq_[assailant_rank][assailant_file].side_=NowBoard.sq_[assailant_rank][assailant_file].side_; return false; } } else { return false; } } public void unalterMaybeBoard(Graphics g, Chsq chsq, Chsq chsq1, CB12_17 cb12_17, CB12_17 cb12_17_1) { // TotalMaybeBoard(NowBoard,MaybeBoard); cb12_17_1.sq_[chsq.rank_][chsq.file_].piece_=cb12_17.sq_[chsq.rank_][chsq.file_].piece_; cb12_17_1.sq_[chsq.rank_][chsq.file_].side_=cb12_17.sq_[chsq.rank_][chsq.file_].side_; cb12_17_1.sq_[chsq1.rank_][chsq1.file_].piece_=cb12_17.sq_[chsq1.rank_][chsq1.file_].piece_; cb12_17_1.sq_[chsq1.rank_][chsq1.file_].side_=cb12_17.sq_[chsq1.rank_][chsq1.file_].side_; cb12_17_1.sq_[chsq.rank_][chsq1.file_].side_=cb12_17.sq_[chsq.rank_][chsq1.file_].side_; cb12_17_1.sq_[chsq.rank_][chsq1.file_].piece_=cb12_17.sq_[chsq.rank_][chsq1.file_].piece_; cb12_17_1.sq_[assailant_rank][assailant_file].side_=cb12_17.sq_[assailant_rank][assailant_file].side_; cb12_17_1.sq_[assailant_rank][assailant_file].piece_=cb12_17.sq_[assailant_rank][assailant_file].piece_; } public void alterMaybeBoard(Graphics g, Chsq chsq, Chsq chsq1, CB12_17 cb12_17, CB12_17 cb12_17_1) { // TotalMaybeBoard(NowBoard,MaybeBoard); cb12_17_1.sq_[chsq.rank_][chsq.file_].piece_=0; cb12_17_1.sq_[chsq.rank_][chsq.file_].side_=0; cb12_17_1.sq_[chsq1.rank_][chsq1.file_].piece_=cb12_17.sq_[chsq.rank_][chsq.file_].piece_; cb12_17_1.sq_[chsq1.rank_][chsq1.file_].side_=cb12_17.sq_[chsq.rank_][chsq.file_].side_; if (cb12_17.sq_[chsq.rank_][chsq.file_].piece_==0) { cb12_17_1.sq_[chsq.rank_][chsq.file_].piece_=74; cb12_17_1.sq_[chsq.rank_][chsq.file_].side_=3; } if((cb12_17.sq_[chsq.rank_][chsq.file_].piece_==1) && (cb12_17.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) && (cb12_17.sq_[chsq.rank_][chsq1.file_].piece_==2)) { cb12_17_1.sq_[chsq.rank_][chsq1.file_].piece_=0; cb12_17_1.sq_[chsq.rank_][chsq1.file_].side_=0; } } public void TwoingPawns(){} public boolean AnotherWayToCheck(int i) { if ((AmIConnected(MaybeBoard)==false)&&(tile_chess==true)){return true;} return false; } public boolean AmIConnected(CB16_23 cb16_23){ if ((turncounter==1)&&(whoseMove==1)){return true;} x_chex=1;while (x_chex<15){ y_chex=1;while (y_chex<15){ connected[y_chex][x_chex]=false; y_chex++;}x_chex++;} found_first_unit=false; x_chex=1;while ((x_chex<15)&&(found_first_unit==false)){ y_chex=1;while ((y_chex<15)&&(found_first_unit==false)){ if (cb16_23.sq_[y_chex][x_chex].side_!=0){connected[y_chex][x_chex]=true;found_first_unit=true;} y_chex++;}x_chex++;} found_a_connection=false; x_chex=1;while (x_chex<15){ y_chex=1;while (y_chex<15){ if ((cb16_23.sq_[y_chex][x_chex].side_!=0)&&(connected[y_chex][x_chex]==false)) { if (connected[y_chex+1][x_chex+1]==true){connected[y_chex][x_chex]=true;found_a_connection=true;} if (connected[y_chex+1][x_chex ]==true){connected[y_chex][x_chex]=true;found_a_connection=true;} if (connected[y_chex+1][x_chex-1]==true){connected[y_chex][x_chex]=true;found_a_connection=true;} if (connected[y_chex ][x_chex-1]==true){connected[y_chex][x_chex]=true;found_a_connection=true;} if (connected[y_chex-1][x_chex-1]==true){connected[y_chex][x_chex]=true;found_a_connection=true;} if (connected[y_chex-1][x_chex ]==true){connected[y_chex][x_chex]=true;found_a_connection=true;} if (connected[y_chex-1][x_chex+1]==true){connected[y_chex][x_chex]=true;found_a_connection=true;} if (connected[y_chex ][x_chex+1]==true){connected[y_chex][x_chex]=true;found_a_connection=true;} } if ((y_chex==14)&&(x_chex==14)&&(found_a_connection==true)){found_a_connection=false;x_chex=1;y_chex=1;} y_chex++;}x_chex++;} x_chex=1;while (x_chex<15){ y_chex=1;while (y_chex<15){ if ((cb16_23.sq_[y_chex][x_chex].side_!=0)&&(connected[y_chex][x_chex]==false)) { return false; } y_chex++;}x_chex++;} return true; } public boolean chex_unacceptable(){return false;} public void isthisschach_plus(){schach_plus=false;} public void isthistile_chess(){tile_chess=true;} 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 > 14) | (datt > 14) | (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 > 14) | (datt > 14) | (catt < 1) | (datt < 1)) return; if(satt > 2) { 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; screen_color=0; cc=j+1; dd=i; while(cc <15) if(MaybeBoard.sq_[dd][cc].side_==k) { cc=20; } else { if(IsEnemyRook(dd, cc)) return true; if (MaybeBoard.sq_[dd][cc].piece_!=0) { if ((screen_color>0)&&(screen_color!=MaybeBoard.sq_[dd][cc].side_)) {cc=20;} if (cc!=20){screen_color=MaybeBoard.sq_[dd][cc].side_;} } cc++; } screen_color=0; 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) { if ((screen_color>0)&&(screen_color!=MaybeBoard.sq_[dd][cc].side_)) {cc=-1;} if (cc!=-1){screen_color=MaybeBoard.sq_[dd][cc].side_;} } cc--; } screen_color=0; cc=j; for(dd=i+1; dd <15;) if(MaybeBoard.sq_[dd][cc].side_==k) { dd=20; } else { if(IsEnemyRook(dd, cc)) return true; if (MaybeBoard.sq_[dd][cc].piece_!=0) { if ((screen_color>0)&&(screen_color!=MaybeBoard.sq_[dd][cc].side_)) {dd=20;} if (dd!=20){screen_color=MaybeBoard.sq_[dd][cc].side_;} } dd++; } screen_color=0; 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) { if ((screen_color>0)&&(screen_color!=MaybeBoard.sq_[dd][cc].side_)) {dd=-1;} if (dd!=-1){screen_color=MaybeBoard.sq_[dd][cc].side_;} } dd--; } screen_color=0; cc=j+1; for(dd=i+1; (cc <15) && (dd <15);) if(MaybeBoard.sq_[dd][cc].side_==k) { cc=20; } else { if(IsEnemyBishop(dd, cc)) return true; if (MaybeBoard.sq_[dd][cc].piece_!=0) { if ((screen_color>0)&&(screen_color!=MaybeBoard.sq_[dd][cc].side_)) {cc=20;} if (cc!=20){screen_color=MaybeBoard.sq_[dd][cc].side_;} } cc++; dd++; } screen_color=0; cc=j+1; for(dd=i-1; (cc <15) && (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) { if ((screen_color>0)&&(screen_color!=MaybeBoard.sq_[dd][cc].side_)) {cc=20;} if (cc!=20){screen_color=MaybeBoard.sq_[dd][cc].side_;} } cc++; dd--; } screen_color=0; cc=j-1; for(dd=i+1; (cc > 0) && (dd <15);) if(MaybeBoard.sq_[dd][cc].side_==k) { cc=-1; } else { if(IsEnemyBishop(dd, cc)) return true; if (MaybeBoard.sq_[dd][cc].piece_!=0) { if ((screen_color>0)&&(screen_color!=MaybeBoard.sq_[dd][cc].side_)) {cc=-1;} if (cc!=-1){screen_color=MaybeBoard.sq_[dd][cc].side_;} } cc--; dd++; } screen_color=0; 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) { if ((screen_color>0)&&(screen_color!=MaybeBoard.sq_[dd][cc].side_)) {cc=-1;} if (cc!=-1){screen_color=MaybeBoard.sq_[dd][cc].side_;} } cc--; dd--; } cc=j-1; dd=i-1; if(IsEnemyKing(dd, cc, k)) return true; cc=j-1; dd=i; if(IsEnemyKing(dd, cc, k)) return true; cc=j-1; dd=i+1; if(IsEnemyKing(dd, cc, k)) return true; cc=j; dd=i-1; if(IsEnemyKing(dd, cc, k)) return true; cc=j; dd=i+1; if(IsEnemyKing(dd, cc, k)) return true; cc=j+1; dd=i-1; if(IsEnemyKing(dd, cc, k)) return true; cc=j+1; dd=i; if(IsEnemyKing(dd, cc, k)) return true; cc=j+1; dd=i+1; if(IsEnemyKing(dd, cc, k)) return true; cc=j-2; dd=i-1; if(IsEnemyKnight(dd, cc, k)) return true; cc=j-2; dd=i+1; if(IsEnemyKnight(dd, cc, k)) return true; cc=j+2; dd=i-1; if(IsEnemyKnight(dd, cc, k)) return true; cc=j+2; dd=i+1; if(IsEnemyKnight(dd, cc, k)) return true; cc=j-1; dd=i-2; if(IsEnemyKnight(dd, cc, k)) return true; cc=j-1; dd=i+2; if(IsEnemyKnight(dd, cc, k)) return true; cc=j+1; dd=i-2; if(IsEnemyKnight(dd, cc, k)) return true; cc=j+1; dd=i+2; if(IsEnemyKnight(dd, cc, k)) return true; if (tile_chess==false){ if(k !=1) { cc=j+1; dd=i-1; if(IsEnemyPawn(dd, cc, k)) return true; cc=j-1; dd=i-1; if(IsEnemyPawn(dd, cc, k)) return true; } if(k !=2) { cc=j+1; dd=i+1; if(IsEnemyPawn(dd, cc, k)) return true; cc=j-1; dd=i+1; if(IsEnemyPawn(dd, cc, k)) return true; }} if (tile_chess==true) { cc=j+1; dd=i+1; if(IsEnemyPawn(dd, cc, k)) return true; cc=j-1; dd=i+1; if(IsEnemyPawn(dd, cc, k)) return true; cc=j+1; dd=i-1; if(IsEnemyPawn(dd, cc, k)) return true; cc=j-1; dd=i-1; if(IsEnemyPawn(dd, cc, k)) return true; } return false; } public boolean AmIUnderSparrowAttack(int i, int j, int k) { if(SupplementalAmIUnderSparrowAttackers(i, j, k)) return true; cc=j+1; dd=i; while(cc <15) 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 <15;) 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 <15) && (dd <15);) 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 <15) && (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 <15);) if(MaybeBoard.sq_[dd][cc].side_==k) { cc=-1; } else { if(IsEnemyBishop(dd, cc) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; if(MaybeBoard.sq_[dd][cc].piece_ !=0) cc=-1; cc--; dd++; } cc=j-1; for(dd=i-1; (cc > 0) && (dd > 0);) if(MaybeBoard.sq_[dd][cc].side_==k) { cc=-1; } else { if(IsEnemyBishop(dd, cc) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; if(MaybeBoard.sq_[dd][cc].piece_ !=0) cc=-1; cc--; dd--; } cc=j-1; dd=i-1; if(IsEnemyKing(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j-1; dd=i; if(IsEnemyKing(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j-1; dd=i+1; if(IsEnemyKing(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j; dd=i-1; if(IsEnemyKing(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j; dd=i+1; if(IsEnemyKing(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j+1; dd=i-1; if(IsEnemyKing(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j+1; dd=i; if(IsEnemyKing(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j+1; dd=i+1; if(IsEnemyKing(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j-2; dd=i-1; if(IsEnemyKnight(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j-2; dd=i+1; if(IsEnemyKnight(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j+2; dd=i-1; if(IsEnemyKnight(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j+2; dd=i+1; if(IsEnemyKnight(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j-1; dd=i-2; if(IsEnemyKnight(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j-1; dd=i+2; if(IsEnemyKnight(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j+1; dd=i-2; if(IsEnemyKnight(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j+1; dd=i+2; if(IsEnemyKnight(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; if(k !=1) { cc=j+1; dd=i-1; if(IsEnemyPawn(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j-1; dd=i-1; if(IsEnemyPawn(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; } if(k !=2) { cc=j+1; dd=i+1; if(IsEnemyPawn(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; cc=j-1; dd=i+1; if(IsEnemyPawn(dd, cc, k) && MaybeBoard.sq_[dd][cc].strength() < MaybeBoard.sq_[i][j].strength()) return true; } return false; } public boolean AmIWorried(int i) { if((skipDtGM) | (depth > 1)) return false; if(i !=whoseMove) return false; for(xxx=1; xxx <15; xxx++) for(yyy=1; yyy <15; 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 AnotherWayToEndGame(Graphics g, int i) { return false; } public void Archives() { ArchiveCounter=0; for(ff=1; ff <15; ff++) for(ee=1; ee <15; ee++) { ArchiveBoard[fifty_move_rule].sq_[ff][ee].piece_=NowBoard.sq_[ff][ee].piece_; ArchiveBoard[fifty_move_rule].sq_[ff][ee].side_=NowBoard.sq_[ff][ee].side_; } ArchiveBoard[fifty_move_rule].sq_[0][0].side_=whoseMove; for(xxx=0; xxx < fifty_move_rule; xxx++) { if(DoesArchiveMatchNowBoard()) ArchiveCounter++; if(ArchiveCounter > 1) { ShowStatusQ("Draw By Repetition"); GameOver=true; SettleADrawnGame(); return; } } } public void CountAllThePieces() { undef_enemy_pawn_most_advanced_file[1]=0; undef_enemy_pawn_most_advanced_file[2]=0; undef_enemy_pawn_most_advanced_rank[1]=0; undef_enemy_pawn_most_advanced_rank[2]=0; undef_enemy_pawn_nearest_king_file[1]=0; undef_enemy_pawn_nearest_king_file[2]=0; undef_enemy_pawn_nearest_king_rank[1]=0; undef_enemy_pawn_nearest_king_rank[2]=0; distance_to_edible_pawn[1]=200; distance_to_edible_pawn[2]=200; /* for(xxx=1; xxx < 15; xxx++) for(yyy=1; yyy <15; yyy++) if(NowBoard.sq_[yyy][xxx].pawn()) { pawnowner=NowBoard.sq_[yyy][xxx].side_; if(Attackers[yyy][xxx][pawnowner]==0) { if((pawnowner==1) && ((undef_enemy_pawn_most_advanced_rank[2]==0) | (yyy > undef_enemy_pawn_most_advanced_rank[2]))) { undef_enemy_pawn_most_advanced_rank[2]=yyy; undef_enemy_pawn_most_advanced_file[2]=xxx; } if((pawnowner==2) && ((undef_enemy_pawn_most_advanced_rank[1]==0) | (yyy < undef_enemy_pawn_most_advanced_rank[2]))) { undef_enemy_pawn_most_advanced_rank[1]=yyy; undef_enemy_pawn_most_advanced_file[1]=xxx; } if(distance_to_edible_pawn[3-pawnowner] > (KingRank[3-pawnowner]-yyy) * (KingRank[3-pawnowner]-yyy)+(KingFile[3-pawnowner]-xxx) * (KingFile[3-pawnowner]-xxx)) { undef_enemy_pawn_nearest_king_rank[3-pawnowner]=yyy; undef_enemy_pawn_nearest_king_file[3-pawnowner]=xxx; } } } */ ZeroAllFiveCounts(); for(xxx=1; xxx < 15; xxx++) for(yyy=1; yyy <15; yyy++) { if(NowBoard.sq_[yyy][xxx].piece_==1) PawnCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_==2) PawnCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_==3) KnightCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_==2203) KnightCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_==260) BishopCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_==4) BishopCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_==2204) BishopCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_==5) RookCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_==2205) RookCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_==6) RookCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_==9) QueenCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_==2209) QueenCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_==223) QueenCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_==224) QueenCount[NowBoard.sq_[yyy][xxx].side_]++; if(NowBoard.sq_[yyy][xxx].piece_ < 0) KingCount[NowBoard.sq_[yyy][xxx].side_]++; } } public void DesignateTheFineMoves(Chsq chsq) { if (tile_chess==true){return;} good_move=1; if((skipDtGM) | (depth > 1) | (worried)) return; if(chsq.file_ > 14) return; if(IsMySideInCheck(3-chsq.side_)) good_move +=5; if(chsq.strength() < NowBoard.sq_[d[depth]][c[depth]].strength()) good_move=(good_move+3 * NowBoard.sq_[d[depth]][c[depth]].strength())-chsq.strength(); if((Attackers[chsq.rank_][chsq.file_][3-chsq.side_] > 0) && (AmIUnderAttack(d[depth],c[depth],whoseMove)==false)) good_move +=5 * chsq.strength(); if((NowBoard.sq_[d[depth]][c[depth]].piece_ > 0) && (Attackers[d[depth]][c[depth]][chsq.side_] > Attackers[d[depth]][c[depth]][3-chsq.side_])) good_move +=3 * NowBoard.sq_[d[depth]][c[depth]].strength(); } public void DesignateGoodTileChessMoves(Chsq chsq){ if (NowBoard.sq_[d[depth]][c[depth]].piece_<0){AssignGoodMove10();} } public void DesignateTheGoodMoves(Chsq chsq) { if (tile_chess==true){DesignateGoodTileChessMoves(chsq);return;} if((whoseMove !=chsq.side_) | ((skipDtGM) | (depth > 1))) return; if(IsMySideInCheck(3-chsq.side_) && !IGaveEscapableCheck(chsq.side_)) { if (stochastic_chess==true){return;} if (stochastic_chess==false){goodmove10=moveCounter;} } IncrediblyGoodMove(chsq); if ((Attackers[chsq.rank_][chsq.file_][3-chsq.side_]>Attackers[chsq.rank_][chsq.file_][chsq.side_])) { if (AmIUnderAttack(d[depth],c[depth],3-chsq.side_)==true) AssignGoodMove1(); } if ((term_counts[chsq.side_]>term_counts[3-chsq.side_])&&(chsq.strength()<=NowBoard.sq_[d[depth]][c[depth]].strength())) { switch(chsq.strength()){ case 5:{AssignGoodMove9();break;} case 4:{AssignGoodMove8();break;} case 3:{AssignGoodMove6();break;} case 2:{AssignGoodMove4();break;} case 1:{AssignGoodMove1();break;} } } if ((chsq.file_> 14)&&(chsq.piece_<0)) { if ((d[depth]==1)|(d[depth]==10)){if (chex==0){AssignGoodMove1();}} } if((AmIUnderAttack(d[depth],c[depth],whoseMove)==false) && (NowBoard.sq_[d[depth]][c[depth]].strength() > 3) && Math.random() * 100D < 99D) AssignGoodMove9(); if(NowBoard.sq_[d[depth]][c[depth]].strength() > 1+chsq.strength() && Math.random() * 100D < 98D && !worried) AssignGoodMove9(); if(NowBoard.sq_[d[depth]][c[depth]].strength() > 2+chsq.strength() && !worried) AssignGoodMove9(); if((chsq.strength() > 3) && (Attackers[chsq.rank_][chsq.file_][3-chsq.side_] > 0) && (AmIUnderAttack(d[depth],c[depth],whoseMove)==false) && (Math.random() * 100D < 98D && !worried)) {AssignGoodMove8();if (NowBoard.sq_[d[depth]][c[depth]].piece_!=0){AssignGoodMove9();}} if((AmIUnderAttack(d[depth],c[depth],whoseMove)==false) && (NowBoard.sq_[d[depth]][c[depth]].strength() > 3) && (Math.random() * 100D <98D && !worried)) AssignGoodMove7(); if((chsq.strength() < 3) && (NowBoard.sq_[d[depth]][c[depth]].strength() > 3) && (Math.random() * 100D <98D && !worried)) AssignGoodMove6(); if((chsq.strength() > 2) && (Attackers[chsq.rank_][chsq.file_][3-chsq.side_] > 0) && (AmIUnderAttack(d[depth],c[depth],whoseMove)==false) && (Math.random() * 100D < 98D && !worried)) AssignGoodMove5(); if((AmIUnderAttack(d[depth],c[depth],whoseMove)==false) && (NowBoard.sq_[d[depth]][c[depth]].strength() > 1) && (Math.random() * 100D < 98D && !worried)) AssignGoodMove4(); if(chsq.strength() < NowBoard.sq_[d[depth]][c[depth]].strength() && Math.random() * 100D < 98D && !worried) AssignGoodMove3(); if((AmIUnderAttack(d[depth],c[depth],whoseMove)==false) && (IsMySideInCheck(3-chsq.side_)) && (Math.random() * 100D <98D && !worried)) AssignGoodMove2(); if ((StrongestAttacker[d[depth]][c[depth]][3-chsq.side_]==0) &&(NowBoard.sq_[d[depth]][c[depth]].piece_!=0) &&(Math.random() * 100D < 98D)) { switch(NowBoard.sq_[d[depth]][c[depth]].strength()) { case 5:{AssignGoodMove9();break;} case 4:{AssignGoodMove7();break;} case 3:{AssignGoodMove5();break;} case 2:{AssignGoodMove3();break;} case 1:{AssignGoodMove2();break;} } } if ((StrongestAttacker[chsq.rank_][chsq.file_][3-chsq.side_]>0) &&(StrongestAttacker[chsq.rank_][chsq.file_][3-chsq.side_]0) &&(Attackers[chsq.rank_][chsq.file_][chsq.side_]==0) &&(StrongestAttacker[d[depth]][c[depth]][3-chsq.side_]==0) &&(Math.random() * 100D < 98D) ) { switch(chsq.strength()){ case 5:{AssignGoodMove9();break;} case 4:{AssignGoodMove7();break;} case 3:{AssignGoodMove5();break;} case 2:{AssignGoodMove3();break;} case 1:{AssignGoodMove2();break;} } } if((fifty_move_rule > 4) && (chsq.pawn()) && (Math.random() * 100D < (double)(100-10 * PawnCount[chsq.side_])) && (!worried) && (AmIUnderAttack(d[depth],c[depth],whoseMove)==false)) AssignGoodMove1(); if((WeakestAttacker[d[depth]][c[depth]][3-chsq.side_]>=chsq.strength())&&(Attackers[d[depth]][c[depth]][3-chsq.side_] < Attackers[d[depth]][c[depth]][chsq.side_]) && (NowBoard.sq_[d[depth]][c[depth]].piece_ !=0) && (Math.random() * 100D <98D && !worried)) AssignGoodMove1(); MoreGoodMoves(chsq); NightMoves(chsq); } public void DidICheckOrStalemate(Graphics g, int i) { if (tile_chess==true){return;} human_chosen_rank=0; human_chosen_file=0; if((turncounter <=25)&&(stochastic_chess==false)&&(chex==0)) {return;} if ((turncounter<=32)&&(schach_plus==true)){return;} if(AnotherWayToEndGame(g, i)) { GameOver=true; return; } moveCounter=0; empty_is_moving_for=3-i; for(xx=1; (xx < 15) && (moveCounter==0); xx++) for(yy=1; (yy <15) && (moveCounter==0); yy++) if ( (NowBoard.sq_[yy][xx].side_==3-i) | ( (NowBoard.sq_[yy][xx].side_==0) && ((stochastic_chess==true)|(schach_plus==true)) ) ) findPieceMoves(g, NowBoard.sq_[yy][xx], NowBoard, MaybeBoard); if(IsMySideInCheck(3-i)) { if(moveCounter==0) { ShowStatusQ("Checkmate!"); GameOver=true; if ((stochastic_chess==true)&&(mover_file> 14)) {ShowStatusQ("Checkmate by drop! You lose!");wins[3-i]++;} else {wins[i]++;} return; } ShowStatusQ("Check!"); } else if(moveCounter==0) { if ((stochastic_chess==true)|(schach_plus==true)){return;} ShowStatusQ("Stalemate!"); GameOver=true; SettleADrawnGame(); return; } } public void DisplayRules(Graphics g) { LowRectangle(g); g.drawString("Popular American proprietary game by Jason Wittman. No starting ", 5, 465); g.drawString("kings adjacent to each other. Runners pass and check through ", 5, 465+16); g.drawString("friendly units. Breaking up the group of connected tiles is", 5, 465+16+16); g.drawString("absolutely forbidden. Whoever captures a king takes over that army.", 5, 465+16+16+16); g.drawString("I ignored the layered-check rule. Last player able to move wins. ", 5, 465+16+16+16+16); g.drawString("Draws are settled by Q=12, R=5, B=3, N=3, P=1, then who played first.", 5, 465+16+16+16+16+16); } public boolean DoesArchiveMatchNowBoard() { if(whoseMove !=ArchiveBoard[xxx].sq_[0][0].side_) return false; for(ff=1; ff <15; ff++) for(ee=1; ee <15; ee++) { if(NowBoard.sq_[ff][ee].piece_ !=ArchiveBoard[xxx].sq_[ff][ee].piece_) return false; if(NowBoard.sq_[ff][ee].piece_ !=ArchiveBoard[xxx].sq_[ff][ee].piece_) return false; } return true; } public void DrawMaybeBoard(Graphics g) { for(ee=1; ee < 9; ee++) for(ff=1; ff < 9; ff++) MaybeBoard.sq_[ff][ee].drawchsq2(g, 1); } public void DrawNowBoard(Graphics g) { if (making_rules==true){return;} for(ee=1; ee <23; ee++) for(ff=1; ff <15; ff++) NowBoard.sq_[ff][ee].DrawTileChssSquare(g, 1, icanmove[ff][ee]); } public void DrawPromotionOptions(Graphics g) { g.setColor(niceblue); g.fillRect(0, 331+120, 599, 94); g.setColor(Color.black); g.setFont(f2); g.drawString("Choose: ", 5, 380); happySquare.side_=whoseMove; happySquare.rank_=-1; happySquare.file_=3; happySquare.piece_=9; happySquare.DrawTileChssSquare(g, 11, false); happySquare.file_=4; happySquare.piece_=5; happySquare.DrawTileChssSquare(g, 11, false); happySquare.file_=5; happySquare.piece_=4; happySquare.DrawTileChssSquare(g, 11, false); happySquare.file_=6; happySquare.piece_=3; happySquare.DrawTileChssSquare(g, 11, false); } public void ForGambler(Graphics g) { } public void GenerateAttackersArrays() { for(zatt=1; zatt < 3; zatt++) for(yatt=1; yatt <15; yatt++) for(xatt=1; xatt <15; xatt++) { Attackers[yatt][xatt][zatt]=0; StrongestAttacker[yatt][xatt][zatt]=0; WeakestAttacker[yatt][xatt][zatt]=0; } for(yatt=1; yatt <15; yatt++) for(xatt=1; xatt <15; 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==2209) | (patt==-9) | (patt==-67) | (patt==-68) | (patt==57) | (patt==29) | (patt==28)) { catt=xatt; datt=yatt; for(; catt <15; 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 <15; 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==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 <15) && (datt <15); datt++) { AddAnAttacker(); if((catt !=xatt) && (NowBoard.sq_[datt][catt].side_ !=0)) catt=20; catt++; } catt=xatt; for(datt=yatt; (catt > 0) && (datt <15); datt++) { AddAnAttacker(); if((catt !=xatt) && (NowBoard.sq_[datt][catt].side_ !=0)) catt=-20; catt--; } catt=xatt; for(datt=yatt; (catt <15) && (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==-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 < 3; zatt++) for(yatt=1; yatt <15; yatt++) for(xatt=1; xatt <15; xatt++) CLCAttackers[yatt][xatt][zatt]=0; for(yatt=1; yatt <15; yatt++) for(xatt=1; xatt <15; 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==2209) | (patt==-9) | (patt==-67) | (patt==-68) | (patt==57) | (patt==29) | (patt==28)) { catt=xatt; datt=yatt; for(; catt <15; 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 <15; 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==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 <15) && (datt <15); 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 <15); 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 <15) && (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==-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(MaybeBoard.sq_[yatt+1][xatt].piece_==0) { datt=yatt+1; catt=xatt; AddACLCAttacker(); if((MaybeBoard.sq_[yatt+1][xatt].piece_==0) && (MaybeBoard.sq_[4][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(MaybeBoard.sq_[yatt-1][xatt].piece_==0) { datt=yatt-1; catt=xatt; AddACLCAttacker(); if((MaybeBoard.sq_[yatt-1][xatt].piece_==0) && (MaybeBoard.sq_[9][xatt].piece_==0) && (satt==2) && (yatt==9)) { datt=5; catt=xatt; AddACLCAttacker(); } } } } } public void HappyFiftyMoveRule() { if((NowBoard.sq_[moveto_rank][moveto_file].piece_ > 0) |((tile_chess==true)&&(turncounter<=pieces_per_side+pawns_per_side)) | ((NowBoard.sq_[mover_rank][mover_file].piece_==1)&&(tile_chess==false))) { fifty_move_rule=0; } else { fifty_move_rule++; if(fifty_move_rule > fifties_got_to) fifties_got_to=fifty_move_rule; } } public boolean HumanMoveAPiece(Graphics g, int i, int j) { if (i_just_made_a_square==true){markingAPiece=true;return true;} 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); IsTheGameOver(); 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 ((assailant_rank<1)|(assailant_file<1)|(assailant_rank>12)|(assailant_file>12)){return true;} 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; for(dee=assailant_rank; (cee !=KingFile[3-i]) | (dee !=KingRank[3-i]); dee +=yee) { if ((dee<1)|(dee> 14)|(cee<1)|(cee> 14)){return true;} if(CLCAttackers[dee][cee][3-i] > 0) return true; cee +=xee; } return false; } public void IncrediblyGoodMove(Chsq chsq) { } 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 <15; xxx++) for(yyy=1; yyy <15; 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(turncounter <=25) return false; if(GameOver) return true; CountAllThePieces(); if( (QueenCount[1]==0) && (QueenCount[2]==0) && (RookCount[1]==0) && (RookCount[2]==0) && ((PawnCount[1]==0)|(tile_chess==true)) && ((PawnCount[2]==0)|(tile_chess==true)) &&(QueenCount[3]==0) && (QueenCount[4]==0) && (RookCount[3]==0) && (RookCount[4]==0) && ((PawnCount[3]==0)|(tile_chess==true)) && ((PawnCount[4]==0)|(tile_chess==true)) &&(QueenCount[5]==0) && (QueenCount[6]==0) && (RookCount[5]==0) && (RookCount[6]==0) && ((PawnCount[5]==0)|(tile_chess==true)) && ((PawnCount[6]==0)|(tile_chess==true)) ) { if( (BishopCount[1]==0) && (BishopCount[2]==0) && (KnightCount[1] < 3) && (KnightCount[2] < 3) &&(BishopCount[3]==0) && (BishopCount[4]==0) && (KnightCount[3] < 3) && (KnightCount[4] < 3) &&(BishopCount[5]==0) && (BishopCount[6]==0) && (KnightCount[5] < 3) && (KnightCount[6] < 3) ) { GameOver=true; SettleADrawnGame(); ShowStatusQ("Lack of force!"); return true; } if( (BishopCount[1] < 2) && (BishopCount[2] < 2) && (KnightCount[1]==0) && (KnightCount[2]==0) &&(BishopCount[3] < 2) && (BishopCount[4] < 2) && (KnightCount[3]==0) && (KnightCount[4]==0) &&(BishopCount[5] < 2) && (BishopCount[6] < 2) && (KnightCount[5]==0) && (KnightCount[6]==0) ) { GameOver=true; SettleADrawnGame(); ShowStatusQ("Lack of force!"); return true; } if( (BishopCount[1]+KnightCount[1] < 2) && (BishopCount[2]+KnightCount[2] < 2) &&(BishopCount[3]+KnightCount[3] < 2) && (BishopCount[4]+KnightCount[4] < 2) &&(BishopCount[5]+KnightCount[5] < 2) && (BishopCount[6]+KnightCount[6] < 2) ) { GameOver=true; SettleADrawnGame(); ShowStatusQ("Lack of force!"); return true; } } return false; } public boolean KingCanEscape(int i) { if(cee > 14) return false; if(cee < 1) return false; if(dee > 14) 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, 331+120, 599, 94); g.fillRect(0, 0, 299, 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] <23; x_run[1]++) for(y_run[1]=1; y_run[1] <15; 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; if ((stochastic_chess==true)|(schach_plus==true)){ if (turncounter==1) { goodmove1=0; goodmove2=0; goodmove3=0; goodmove4=0; goodmove5=0; goodmove6=0; goodmove7=0; goodmove8=0; goodmove9=0; goodmove10=0; } if ((turncounter==1)| ((goodmove1==0)&&(goodmove2==0)&&(goodmove3==0)&& (goodmove4==0)&&(goodmove5==0)&&(goodmove6==0)&& (goodmove7==0)&&(goodmove8==0)&&(goodmove9==0)&& (goodmove10==0)&&(Math.random()*5<4)&&(drop_places_count>0)&& (dark_squares_unplaced[whoseMove]+light_squares_unplaced[whoseMove]>0)) ) { x=1+(int)Math.floor(Math.random() * (double)drop_places_count); moveto_rank=drop_here[x].rank_; moveto_file=drop_here[x].file_; NowBoard.sq_[moveto_rank][moveto_file].piece_=0; NowBoard.sq_[moveto_rank][moveto_file].side_=0; if ( (moveto_rank+moveto_file)%2==0){dark_squares_unplaced[whoseMove]--;} if ( (moveto_rank+moveto_file)%2==1){light_squares_unplaced[whoseMove]--;} DrawNowBoard(g); TotalMaybeBoard(NowBoard,MaybeBoard);DidICheckOrStalemate(g, i); return true; } } ShowStatusNothing(); if (moveCounter==0) { for(x_run[1]=1; x_run[1] <23; x_run[1]++) for(y_run[1]=1; y_run[1] <15; y_run[1]++) if(NowBoard.sq_[y_run[1]][x_run[1]].side_==0) findPieceMoves(g, NowBoard.sq_[y_run[1]][x_run[1]], NowBoard, MaybeBoard); } if(moveCounter==0) { System.out.println("No Moves turncounter="+turncounter+" whoseMove="+whoseMove);ShowStatusQ("No Moves"); if ((stochastic_chess==false)&&(schach_plus==false)){WhoIsHuman[1]=true;WhoIsHuman[2]=true;} else {GameOver=true;ShowStatusQ("Draw");SettleADrawnGame();} return false; } x=1+(int)Math.floor(Math.random() * (double)moveCounter); if (tile_chess==false){ if(Attackers[MaybeMoves[x].endingsquare_.rank_][MaybeMoves[x].endingsquare_.file_][3-i] > Attackers[MaybeMoves[x].endingsquare_.rank_][MaybeMoves[x].endingsquare_.file_][i]) x=1+(int)Math.floor(Math.random() * (double)moveCounter); if(Attackers[MaybeMoves[x].endingsquare_.rank_][MaybeMoves[x].endingsquare_.file_][3-i] > Attackers[MaybeMoves[x].endingsquare_.rank_][MaybeMoves[x].endingsquare_.file_][i]) x=1+(int)Math.floor(Math.random() * (double)moveCounter);} if(goodmove1 > 0) x=goodmove1; if(goodmove2 > 0) x=goodmove2; if(goodmove3 > 0) x=goodmove3; if(goodmove4 > 0) x=goodmove4; if(goodmove5 > 0) x=goodmove5; if(goodmove6 > 0) x=goodmove6; if(goodmove7 > 0) x=goodmove7; if(goodmove8 > 0) x=goodmove8; if(goodmove9 > 0) x=goodmove9; if(goodmove10 > 0) x=goodmove10; moveto_file=MaybeMoves[x].endingsquare_.file_; moveto_rank=MaybeMoves[x].endingsquare_.rank_; mover_file=MaybeMoves[x].startingsquare_.file_; mover_rank=MaybeMoves[x].startingsquare_.rank_; } NormalMove(g); NowBoard.sq_[mover_rank][mover_file].DrawTileChssSquare(g, 1, false); NowBoard.sq_[moveto_rank][moveto_file].DrawTileChssSquare(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!"); SettleADrawnGame(); GameOver=true; return false; } else { MachineMoveExtra(g, i); return true; } } public boolean MaybeAdd(Graphics g, Chsq chsq, CB16_23 cb16_23, CB16_23 cb16_23_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] > 14) | (d[depth] < 1) | (d[depth] > 14)) return false; if ((tile_chess==true)&&(turncounter==1)&&(WhoIsHuman[1]==false)&&(whoseMove==1)&& ((c[depth]<7)|(c[depth]>8)|(d[depth]<7)|(d[depth]>8)) ){return false;} if ((tile_chess==true)&&(chsq.side_==whoseMove)) { if ((turncounter14)&&(chsq.piece_<0)) { if ((d[depth]>1) &&(c[depth]<14)) {if (cb16_23.sq_[d[depth]-1][c[depth]+1].piece_<0){return false;}} if ( (c[depth]<14)) {if (cb16_23.sq_[d[depth] ][c[depth]+1].piece_<0){return false;}} if ((d[depth]<14)&&(c[depth]<14)) {if (cb16_23.sq_[d[depth]+1][c[depth]+1].piece_<0){return false;}} if ((d[depth]<14) ) {if (cb16_23.sq_[d[depth]+1][c[depth ]].piece_<0){return false;}} if ((d[depth]<14)&&(c[depth]>1)) {if (cb16_23.sq_[d[depth]+1][c[depth]-1].piece_<0){return false;}} if ( (c[depth]>1)) {if (cb16_23.sq_[d[depth] ][c[depth]-1].piece_<0){return false;}} if ((d[depth]>1) &&(c[depth]>1)) {if (cb16_23.sq_[d[depth]-1][c[depth]-1].piece_<0){return false;}} if ((d[depth]>1) ) {if (cb16_23.sq_[d[depth]-1][c[depth ]].piece_<0){return false;}} } } if ((cb16_23.sq_[d[depth]][c[depth]].piece_==74)){if (chsq.piece_!=0){return false;}} if(!PassedOtherRequirementsToKeep(chsq, cb16_23, cb16_23_1)) return false; if(NowBoard.sq_[d[depth]][c[depth]].side_==chsq.side_) { if (tile_chess==true){CheckSquare[depth]=true;} return false; } alterMaybeBoard(g, chsq, cb16_23.sq_[d[depth]][c[depth]], cb16_23, cb16_23_1); worried=AmIWorried(chsq.side_); if( (IsMySideInCheck(chsq.side_)) | (chex_unacceptable()) | ((chsq.side_==0)&&(IsMySideInCheck(empty_is_moving_for))) ) { unalterMaybeBoard(g, chsq, cb16_23.sq_[d[depth]][c[depth]], cb16_23, cb16_23_1); CheckSquare[depth]=true; if(NowBoard.sq_[d[depth]][c[depth]].piece_ !=0) SquatterOnCheckSquare[depth]=true; return false; } /* if ((how_deep_to_seek<4)&&(seek_sacrificial_wins==false)&&(WhoIsHuman[whoseMove]==false)&&(moveCounter>0)&&(chsq.side_==whoseMove)) { if ((Attackers[d[depth]][c[depth]][3-chsq.side_]>0)&&(chsq.strength()>NowBoard.sq_[d[depth]][c[depth]].strength())&& ( (WeakestAttacker[d[depth]][c[depth]][3-chsq.side_]Attackers[d[depth]][c[depth]][chsq.side_]-1) ) &&(IsMySideInCheck(3-chsq.side_)==false) /// HEEEERE ) { // SquatterOnCheckSquare[depth]=true; SquatterOnCheckSquare[depth]=false; if(NowBoard.sq_[d[depth]][c[depth]].piece_ !=0) SquatterOnCheckSquare[depth]=true; if (NowBoard.sq_[d[depth]][c[depth]].piece_==0){CheckSquare[depth]=true;} unalterMaybeBoard(g, chsq, cb16_23.sq_[d[depth]][c[depth]], cb16_23, cb16_23_1); return false; } } */ good_move=1; good_counter=1; if(moveCounter > 500) good_move=1; for(; good_counter <=good_move; good_counter++) { moveCounter++; if ((halt_if_king_taken==true)&&(tile_chess==false)&&(skipDtGM==false)&&(depth<2)&&(schach_plus==false)&&(chex==0)&&(stochastic_chess==false)&&(NowBoard.sq_[d[depth]][c[depth]].piece_<0)){goodmove10=moveCounter;System.out.print("King captured"); WhoIsHuman[1]=true;WhoIsHuman[2]=true;WhoIsHuman[3]=true;WhoIsHuman[4]=true;WhoIsHuman[5]=true;WhoIsHuman[6]=true;} MaybeMoves[moveCounter].startingsquare_=chsq; MaybeMoves[moveCounter].endingsquare_.rank_=cb16_23.sq_[d[depth]][c[depth]].rank_; MaybeMoves[moveCounter].endingsquare_.file_=cb16_23.sq_[d[depth]][c[depth]].file_; } if (moveCounter>1500){System.out.print(" "+moveCounter);} DesignateTheGoodMoves(chsq); if((worried) && (IsThisAGoodMove()==false) && (moveCounter > 1) && (!WhoIsHuman[whoseMove]) && (stochastic_chess==false)&&(schach_plus==false)) moveCounter--; unalterMaybeBoard(g, chsq, cb16_23.sq_[d[depth]][c[depth]], cb16_23, cb16_23_1); return NowBoard.sq_[d[depth]][c[depth]].side_==0; } public void MoreGoodMoves(Chsq chsq) { } public void AssignVariantName(){ variant_name="Tile Chess"; } public void NameThisChessVariant(Graphics g) { if (making_rules==true){return;} AssignVariantName(); g.setColor(niceblue); g.fillRect(0, 0, 599, 29); g.setColor(Color.black); g.setFont(f1);g.drawString(variant_name, 5, 15); g.drawString("About:", 420+120, 15); } public void NextOrdinaryPlayerTileChess(Graphics g) { last_player=whoseMove; do { whoseMove++; if (whoseMove==number_of_players+1){turncounter++;whoseMove=1;} moveCounter=0;skipDtGM=true; ff=1;while ((ff<15)&&(moveCounter==0)){ ee=1;while ((ee<23)&&(moveCounter==0)){ if (NowBoard.sq_[ff][ee].side_==whoseMove){findPieceMoves(g,NowBoard.sq_[ff][ee],NowBoard,MaybeBoard);} ee++;}ff++;} } while (moveCounter==0); skipDtGM=false; if (whoseMove==last_player) { GameOver=true; wins[whoseMove]++; switch(whoseMove){ case 1:{ShowStatusQ("Gotcha! Red wins!");break;} case 2:{ShowStatusQ("Gotcha! Gold wins!");break;} case 3:{ShowStatusQ("Gotcha! Blue wins!");break;} case 4:{ShowStatusQ("Gotcha! Black wins!");break;} case 5:{ShowStatusQ("Gotcha! White wins!");break;} case 6:{ShowStatusQ("Gotcha! Green wins!");break;} } return; } UnTwoThePawns(whoseMove); ShowStatusNothing(); whatpiecescanmove(g); TotalMaybeBoard(NowBoard, MaybeBoard); TotalMaybeBoard(MaybeBoard, TwoBoard); TotalMaybeBoard(TwoBoard, ThreeBoard); TotalMaybeBoard(ThreeBoard, FourBoard); GenerateAttackersArrays(); CountAllThePieces(); DrawNowBoard(g); return; } public void NextOrdinaryPlayer(Graphics g) { human_chosen_rank=0; human_chosen_file=0; i_just_made_a_square=false; IsTheGameOver(); if(GameOver) return; if (WhoIsHuman[whoseMove]==true){SayWhoIsHuman(g);} failsafe(g); if (tile_chess==true) { NextOrdinaryPlayerTileChess(g); return; } whoseMove++; if (whoseMove==3){whoseMove=1;} UnTwoThePawns(whoseMove); if(whoseMove==1) turncounter++; ShowStatusNothing(); one_of_my_pieces_can_move=false; for(ee=1; ee <23; ee++) for(ff=1; ff <15; ff++) { icanmove[ff][ee]=false; moveCounter=0; if(NowBoard.sq_[ff][ee].piece_ < 0) { KingRank[NowBoard.sq_[ff][ee].side_]=ff; KingFile[NowBoard.sq_[ff][ee].side_]=ee; } if(whoseMove==NowBoard.sq_[ff][ee].side_) { skipDtGM=true; findPieceMoves(g, NowBoard.sq_[ff][ee], NowBoard, MaybeBoard); skipDtGM=false; if(moveCounter > 0) { icanmove[ff][ee]=true; one_of_my_pieces_can_move=true; } } } DrawNowBoard(g); if((!one_of_my_pieces_can_move)&&(stochastic_chess==false)&&(schach_plus==false)&&(tile_chess==false)) { GameOver=true; wins[3-whoseMove]++; ShowStatusQ("No escape!"); return; } else { whatpiecescanmove(g); TotalMaybeBoard(NowBoard, MaybeBoard); TotalMaybeBoard(MaybeBoard, TwoBoard); TotalMaybeBoard(TwoBoard, ThreeBoard); TotalMaybeBoard(ThreeBoard, FourBoard); GenerateAttackersArrays(); CountAllThePieces(); DrawNowBoard(g); return; } } public void NightMoves(Chsq chsq) { if (tile_chess==true){return;} if ((goodmove1>0)|(goodmove2>0)|(goodmove3>0)|(goodmove4>0)|(goodmove5>0)|(goodmove6>0)|(goodmove7>0)|(goodmove8>0)|(goodmove9>0)|(goodmove10>0)){return;} if(worried) return; if(chsq.side_ !=whoseMove) return; if(turncounter < 33) return; if(chsq.piece_==9 && (KingRank[3-chsq.side_]==1) | (KingRank[3-chsq.side_]==10) && (KingFile[3-chsq.side_]==1) | (KingFile[3-chsq.side_]==10) && (KingRank[3-chsq.side_]-d[depth]) * (KingRank[3-chsq.side_]-d[depth])+(KingFile[3-chsq.side_]-c[depth]) * (KingFile[3-chsq.side_]-c[depth])==5) return; if((chsq.piece_==3) && (AmIUnderAttack(d[depth],c[depth],whoseMove)==false)) { knightforks(chsq); if(forked_royalty > 1 && Math.random() * 100D < 98D && !worried) AssignGoodMove8(); if(forked_rookage > 1 && Math.random() * 100D <98D && !worried) AssignGoodMove5(); } if((chsq.piece_==1) | (chsq.piece_==2) | (chsq.piece_==83) | (chsq.piece_==84) | (chsq.piece_==51) | (chsq.piece_==52)) { pawnforks(chsq); if(forked_royalty > 1 && Math.random() * 100D < 98D && !worried) AssignGoodMove8(); if(forked_rookage > 1 && Math.random() * 100D <98D) AssignGoodMove9(); if(forked_pieceage > 1 && Math.random() * 100D <98D && !worried) AssignGoodMove4(); } if((chsq.piece_==1) && (QueenCount[3-chsq.side_]+RookCount[3-chsq.side_]+KnightCount[3-chsq.side_]+BishopCount[3-chsq.side_] <=2)) { if(chsq.side_==1 && Attackers[d[depth]][c[depth]][2] <=Attackers[d[depth]][c[depth]][1] && Math.random() * 100D <98D) { AssignGoodMove8(); return; } if(chsq.side_==2 && Attackers[d[depth]][c[depth]][1] <=Attackers[d[depth]][c[depth]][2] && Math.random() * 100D <98D) { AssignGoodMove8(); return; } } if((d[depth]==undef_enemy_pawn_most_advanced_rank[chsq.side_]) && (c[depth]==undef_enemy_pawn_most_advanced_file[chsq.side_]) && Math.random() * 100D <98D) { AssignGoodMove7(); return; } if((d[depth]==undef_enemy_pawn_nearest_king_rank[chsq.side_]) && (c[depth]==undef_enemy_pawn_nearest_king_file[chsq.side_]) && Math.random() * 100D <98D) { AssignGoodMove7(); return; } if((Attackers[d[depth]][c[depth]][3-chsq.side_] < Attackers[d[depth]][c[depth]][chsq.side_]) && ((chsq.piece_==5) | (chsq.piece_==6) | (chsq.piece_==9) | (chsq.piece_==28) | (chsq.piece_==29) | (chsq.piece_==163) | (chsq.piece_==165))) { if(c[depth]==undef_enemy_pawn_most_advanced_file[chsq.side_]) { if(NowBoard.sq_[d[depth]][c[depth]].piece_ !=0 && Math.random() * 100D <98D) { AssignGoodMove7(); return; } if(chsq.side_==1 && (d[depth] < undef_enemy_pawn_most_advanced_rank[1]) && (NowBoard.sq_[undef_enemy_pawn_most_advanced_rank[1]-1][undef_enemy_pawn_most_advanced_file[1]].side_==0) && Math.random() * 100D < 80D) { AssignGoodMove6(); return; } if(chsq.side_==2 && (d[depth] > undef_enemy_pawn_most_advanced_rank[2]) && (NowBoard.sq_[undef_enemy_pawn_most_advanced_rank[2]+1][undef_enemy_pawn_most_advanced_file[2]].side_==0) && Math.random() * 100D < 80D) { AssignGoodMove6(); return; } if(chsq.side_==1 && d[depth] > undef_enemy_pawn_most_advanced_rank[1] && Math.random() * 100D < 80D) { AssignGoodMove6(); return; } if(chsq.side_==2 && d[depth] < undef_enemy_pawn_most_advanced_rank[2] && Math.random() * 100D < 80D) { AssignGoodMove6(); return; } } if(d[depth]==undef_enemy_pawn_most_advanced_rank[chsq.side_]) { if(NowBoard.sq_[d[depth]][c[depth]].piece_ !=0 && Math.random() * 100D <98D) { AssignGoodMove7(); return; } if(chsq.side_==1 && NowBoard.sq_[undef_enemy_pawn_most_advanced_rank[1]-1][undef_enemy_pawn_most_advanced_file[1]].side_ !=0 && Math.random() * 100D < 80D) { AssignGoodMove6(); return; } if(chsq.side_==2 && NowBoard.sq_[undef_enemy_pawn_most_advanced_rank[2]+1][undef_enemy_pawn_most_advanced_file[2]].side_ !=0 && Math.random() * 100D < 80D) { AssignGoodMove6(); return; } } if(c[depth]==undef_enemy_pawn_nearest_king_file[chsq.side_]) { if(NowBoard.sq_[d[depth]][c[depth]].piece_ !=0 && Math.random() * 100D <98D) { AssignGoodMove7(); return; } if(chsq.side_==1 && (d[depth] < undef_enemy_pawn_nearest_king_rank[1]) && (NowBoard.sq_[undef_enemy_pawn_nearest_king_rank[1]-1][undef_enemy_pawn_nearest_king_file[1]].side_==0) && Math.random() * 100D < 80D) { AssignGoodMove6(); return; } if(chsq.side_==2 && (d[depth] > undef_enemy_pawn_nearest_king_rank[2]) && (NowBoard.sq_[undef_enemy_pawn_nearest_king_rank[2]+1][undef_enemy_pawn_nearest_king_file[2]].side_==0) && Math.random() * 100D < 80D) { AssignGoodMove6(); return; } if(chsq.side_==1 && d[depth] > undef_enemy_pawn_nearest_king_rank[1] && Math.random() * 100D < 80D) { AssignGoodMove6(); return; } if(chsq.side_==2 && d[depth] < undef_enemy_pawn_nearest_king_rank[2] && Math.random() * 100D < 80D) { AssignGoodMove6(); return; } } if(d[depth]==undef_enemy_pawn_nearest_king_rank[chsq.side_]) { if(NowBoard.sq_[d[depth]][c[depth]].piece_ !=0 && Math.random() * 100D < 80D) { AssignGoodMove7(); return; } if(chsq.side_==1 && NowBoard.sq_[undef_enemy_pawn_nearest_king_rank[1]-1][undef_enemy_pawn_nearest_king_file[1]].side_ !=0 && Math.random() * 100D < 80D) { AssignGoodMove6(); return; } if(chsq.side_==2 && NowBoard.sq_[undef_enemy_pawn_nearest_king_rank[2]+1][undef_enemy_pawn_nearest_king_file[2]].side_ !=0 && Math.random() * 100D < 80D) { AssignGoodMove6(); return; } } } if((chsq.piece_ < 0) && (QueenCount[chsq.side_]+RookCount[chsq.side_]==0)) { if(NowBoard.sq_[d[depth]][c[depth]].piece_ !=0 && Math.random() * 100D < 80D) { AssignGoodMove7(); return; } if((((chsq.rank_-d[depth]) * (undef_enemy_pawn_nearest_king_rank[chsq.side_]-d[depth]) < 0) | (d[depth]==undef_enemy_pawn_nearest_king_rank[chsq.side_])) && (((chsq.file_-c[depth]) * (undef_enemy_pawn_nearest_king_file[chsq.side_]-c[depth]) < 0) | (c[depth]==undef_enemy_pawn_nearest_king_file[chsq.side_])) && Math.random() * 100D < 80D) { AssignGoodMove7(); return; } if(((chsq.rank_-d[depth]) * (undef_enemy_pawn_nearest_king_rank[chsq.side_]-d[depth]) <=0) && ((chsq.file_-c[depth]) * (undef_enemy_pawn_nearest_king_file[chsq.side_]-c[depth]) <=0) && Math.random() * 100D < 80D) { AssignGoodMove6(); return; } if((chsq.rank_-d[depth]) * (undef_enemy_pawn_nearest_king_rank[chsq.side_]-d[depth]) <=0 && Math.random() * 100D < 80D) { goodmove5=0; return; } if((chsq.file_-c[depth]) * (undef_enemy_pawn_nearest_king_file[chsq.side_]-c[depth]) <=0 && Math.random() * 100D < 80D) { goodmove5=0; return; } } if((ArchiveCounter > 0) && (chsq.piece_==1) && (Math.random() * 100D <98D) && !worried) AssignGoodMove1(); if(RookCount[3-chsq.side_]+BishopCount[3-chsq.side_]+QueenCount[3-chsq.side_]+KnightCount[3-chsq.side_] > 2) return; if((chsq.piece_==1) && (Attackers[d[depth]][c[depth]][3-chsq.side_] < Attackers[d[depth]][c[depth]][chsq.side_]) && (Math.random() * 100D < 70D && !worried)) AssignGoodMove1(); if(BishopCount[3-chsq.side_] > 0) return; if(KnightCount[3-chsq.side_] > 0) return; goodmove2=0; if((Attackers[d[depth]][c[depth]][3-chsq.side_] < Attackers[d[depth]][c[depth]][chsq.side_]) && ((chsq.piece_==5) | (chsq.piece_==6) | (chsq.piece_==9) | (chsq.piece_==28) | (chsq.piece_==29) | (chsq.piece_==163) | (chsq.piece_==165) | (chsq.piece_ < 0)) && (AmIUnderAttack(d[depth],c[depth],whoseMove)==false) && ((d[depth]-KingRank[3-chsq.side_]) * (d[depth]-KingRank[3-chsq.side_])+(c[depth]-KingFile[3-chsq.side_]) * (c[depth]-KingFile[3-chsq.side_]) > 2)) { AssignGoodMove1(); if((chsq.piece_==9) | (chsq.piece_==5) | (chsq.piece_==6) | (chsq.piece_==28) | (chsq.piece_==29) | (chsq.piece_==66) | (chsq.piece_==65)) { if((strategos==6) && (d[depth] < chsq.rank_) && (d[depth] > KingRank[3-chsq.side_]) && (d[depth] < KingRank[chsq.side_]) && !worried) AssignGoodMove8(); if((strategos==12) && (d[depth] > chsq.rank_) && (d[depth] < KingRank[3-chsq.side_]) && (d[depth] > KingRank[chsq.side_]) && !worried) AssignGoodMove8(); if((strategos==9) && (c[depth] < chsq.file_) && (c[depth] > KingFile[3-chsq.side_]) && (c[depth] < KingFile[chsq.side_]) && !worried) AssignGoodMove8(); if((strategos==3) && (c[depth] > chsq.file_) && (c[depth] < KingFile[3-chsq.side_]) && (c[depth] > KingFile[chsq.side_]) && !worried) AssignGoodMove8(); } if(chsq.piece_ < 0) { if((strategos==6) && (d[depth] < chsq.rank_) && (d[depth] >=KingRank[3-chsq.side_]+2) && ((c[depth]-chsq.file_) * (c[depth]-KingFile[3-chsq.side_]) <=0) && !worried) AssignGoodMove8(); if((strategos==12) && (d[depth] > chsq.rank_) && (d[depth] <=KingRank[3-chsq.side_]+2) && ((c[depth]-chsq.file_) * (c[depth]-KingFile[3-chsq.side_]) <=0) && !worried) AssignGoodMove8(); if((strategos==3) && (c[depth] < chsq.file_) && (c[depth] >=KingFile[3-chsq.side_]+2) && ((d[depth]-chsq.rank_) * (d[depth]-KingRank[3-chsq.side_]) <=0) && !worried) AssignGoodMove8(); if((strategos==9) && (c[depth] > chsq.file_) && (c[depth] <=KingFile[3-chsq.side_]+2) && ((d[depth]-chsq.rank_) * (d[depth]-KingRank[3-chsq.side_]) <=0) && !worried) AssignGoodMove8(); } if(chsq.piece_ > 0) { if((d[depth] < chsq.rank_) && (KingRank[3-chsq.side_] < d[depth]) && (KingRank[chsq.side_] > d[depth]) && ((strategos==6) | (strategos==0)) | (d[depth] > chsq.rank_) && (KingRank[3-chsq.side_] > d[depth]) && (KingRank[chsq.side_] < d[depth]) && ((strategos==12) | (strategos==0)) | (c[depth] < chsq.file_) && (KingFile[3-chsq.side_] < c[depth]) && (KingFile[chsq.side_] > c[depth]) && ((strategos==9) | (strategos==0)) | (c[depth] > chsq.file_) && (KingFile[3-chsq.side_] > c[depth]) && (KingFile[chsq.side_] < c[depth]) && ((strategos==3) | (strategos==0)) && !worried) AssignGoodMove9(); if((d[depth]==chsq.rank_) && (KingRank[3-chsq.side_] < d[depth]) && (KingRank[chsq.side_] > d[depth]) && ((strategos==6) | (strategos==0)) | (d[depth]==chsq.rank_) && (KingRank[3-chsq.side_] > d[depth]) && (KingRank[chsq.side_] < d[depth]) && ((strategos==12) | (strategos==0)) | (c[depth]==chsq.file_) && (KingFile[3-chsq.side_] < c[depth]) && (KingFile[chsq.side_] > c[depth]) && ((strategos==9) | (strategos==0)) | (c[depth]==chsq.file_) && (KingFile[3-chsq.side_] > c[depth]) && (KingFile[chsq.side_] < c[depth]) && ((strategos==3) | (strategos==0))) { AssignGoodMove6(); if(((KingRank[3-chsq.side_]-chsq.rank_) * (KingRank[3-chsq.side_]-chsq.rank_)+(KingFile[3-chsq.side_]-chsq.file_) * (KingFile[3-chsq.side_]-chsq.file_) <=2) && ((KingRank[3-chsq.side_]-d[depth]) * (KingRank[3-chsq.side_]-d[depth])+(KingFile[3-chsq.side_]-c[depth]) * (KingFile[3-chsq.side_]-c[depth]) > 2) && ((KingRank[chsq.side_]-chsq.rank_) * (KingRank[chsq.side_]-chsq.rank_)+(KingFile[chsq.side_]-chsq.file_) * (KingFile[chsq.side_]-chsq.file_) > 2)) { if((c[depth]==chsq.file_) && ((strategos==9) | (strategos==3) | (strategos==0)) && !worried) AssignGoodMove9(); if((d[depth]==chsq.rank_) && ((strategos==12) | (strategos==6) | (strategos==0)) && !worried) AssignGoodMove9(); } } if((d[depth] < chsq.rank_) && (KingRank[3-chsq.side_] < d[depth]) && (KingRank[chsq.side_] > d[depth]) && (strategos==0)) strategos=6; if((d[depth] > chsq.rank_) && (KingRank[3-chsq.side_] > d[depth]) && (KingRank[chsq.side_] < d[depth]) && (strategos==0)) strategos=12; if((c[depth] < chsq.file_) && (KingFile[3-chsq.side_] < c[depth]) && (KingFile[chsq.side_] > c[depth]) && (strategos==0)) strategos=9; if((c[depth] > chsq.file_) && (KingFile[3-chsq.side_] > c[depth]) && (KingFile[chsq.side_] < c[depth]) && (strategos==0)) strategos=3; if(((KingRank[3-chsq.side_] >=chsq.rank_) | (KingRank[chsq.side_] <=chsq.rank_)) && (strategos==6)) strategos=0; if(((KingRank[3-chsq.side_] <=chsq.rank_) | (KingRank[chsq.side_] >=chsq.rank_)) && (strategos==12)) strategos=0; if(((KingFile[3-chsq.side_] >=chsq.file_) | (KingFile[chsq.side_] <=chsq.file_)) && (strategos==9)) strategos=0; if(((KingFile[3-chsq.side_] <=chsq.file_) | (KingFile[chsq.side_] >=chsq.file_)) && (strategos==3)) strategos=0; } } } public void NormalMove(Graphics g) { picking_up_and_putting_down=false; //**System.out.println(""+NowBoard.sq_[mover_rank][mover_file].piece_+" "+mover_rank+""+mover_file+" "+moveto_rank+""+moveto_file); if(NowBoard.sq_[mover_rank][mover_file].piece_ < 0) { KingRank[whoseMove]=moveto_rank; KingFile[whoseMove]=moveto_file; } if(NowBoard.sq_[mover_rank][mover_file].piece_==0) { picking_up_and_putting_down=true; } NormalMoveExtra(); PawnStuff(g); HappyFiftyMoveRule(); NowBoard.sq_[moveto_rank][moveto_file].side_=NowBoard.sq_[mover_rank][mover_file].side_; NowBoard.sq_[moveto_rank][moveto_file].piece_=NowBoard.sq_[mover_rank][mover_file].piece_; SupplementForInsaneChess(); if(NowBoard.sq_[moveto_rank][moveto_file].piece_==6) NowBoard.sq_[moveto_rank][moveto_file].piece_=5; if(NowBoard.sq_[moveto_rank][moveto_file].piece_==-2) NowBoard.sq_[moveto_rank][moveto_file].piece_=-1; if(NowBoard.sq_[moveto_rank][moveto_file].piece_ < 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; } if (picking_up_and_putting_down==true) { NowBoard.sq_[mover_rank][mover_file].side_=3; NowBoard.sq_[mover_rank][mover_file].piece_=74; } NormalMoveFinale(g); if (((stochastic_chess==true)&&(schach_plus==true))&&(mover_file> 14)){men_unplaced[whoseMove]--;} 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 NormalMoveFinale(Graphics g) { if((mover_file > 14) && (NowBoard.sq_[moveto_rank][moveto_file].piece_==1)) my_pawn_on_this_file[moveto_file][whoseMove]=true; if((mover_file > 14) && (NowBoard.sq_[moveto_rank][moveto_file].piece_==4)) BishopColor[whoseMove][(moveto_file+moveto_rank) % 2]++; } public boolean PassedOtherRequirementsToKeep(Chsq chsq, CB16_23 cb16_23, CB16_23 cb16_23_1) { if ((turncounter==24)&&(depth<2)) { if ((KingFile[chsq.side_]> 14)&&(chsq.piece_>=0)){return false;} } if ((chsq.file_> 14)&&(NowBoard.sq_[d[depth]][c[depth]].piece_!=0)){return false;} if((chsq.file_ > 14) && (my_pawn_on_this_file[c[depth]][chsq.side_]) && (chsq.piece_==1) &&(stochastic_chess==false)&&(chex==0)&&(tile_chess==false)) return false; if((chsq.file_ <15) && (turncounter <=25) &&(stochastic_chess==false)&&(chex==0)&&(tile_chess==false)) return false; if (tile_chess==true){return true;} return !((chsq.file_ > 14) && (chsq.piece_==4) && (BishopColor[chsq.side_][(c[depth]+d[depth]) % 2]==2)); } 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].DrawTileChssSquare(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 (stochastic_chess==true){return;} if ((chex>0)|(tile_chess==true)){return;} if((moveto_rank==10) && (NowBoard.sq_[moveto_rank][moveto_file].side_==1) && ((NowBoard.sq_[moveto_rank][moveto_file].piece_==1) | (NowBoard.sq_[moveto_rank][moveto_file].piece_==51) | (NowBoard.sq_[moveto_rank][moveto_file].piece_==83) | (NowBoard.sq_[moveto_rank][moveto_file].piece_==140))) if(!WhoIsHuman[1]) { NowBoard.sq_[moveto_rank][moveto_file].piece_=9; } else { PromotingAPawn=true; queening_rank=moveto_rank; queening_file=moveto_file; DrawPromotionOptions(g); } if((moveto_rank==1) && (NowBoard.sq_[moveto_rank][moveto_file].side_==2) && ((NowBoard.sq_[moveto_rank][moveto_file].piece_==1) | (NowBoard.sq_[moveto_rank][moveto_file].piece_==51) | (NowBoard.sq_[moveto_rank][moveto_file].piece_==83))) if(!WhoIsHuman[2]) { NowBoard.sq_[moveto_rank][moveto_file].piece_=9; } else { PromotingAPawn=true; queening_rank=moveto_rank; queening_file=moveto_file; DrawPromotionOptions(g); } } public boolean PromotionClicks(int i, int j) { if(j < 360) return false; if(j > 390) return false; if(i < 90) return false; if(i > 210) return false; if(i < 120) xxx=9; else if(i < 150) xxx=5; else if(i < 180) xxx=4; else xxx=3; return true; } public void SaySomethingElseAboutWhoIsHuman(Graphics g) { } public void SayWhoIsHuman(Graphics g) { if (making_rules==true) { g.setColor(niceblue); g.fillRect(0,0,500,140); g.setColor(Color.black); g.setFont(f2); g.drawString("Tile Chess Setup",205,25); g.setFont(f2); g.drawString("Number of players:",5,65); g.drawString("2",190,65); g.drawString("3",220,65); g.drawString("4",250,65); g.drawString("5",280,65); g.drawString("6",310,65); g.drawString("Pawns per player:",5,95); g.drawString("0",190,95); g.drawString("1",220,95); g.drawString("2",250,95); g.drawString("3",280,95); g.drawString("4",310,95); g.drawString("5",340,95); g.drawString("6",370,95); g.drawString("7",400,95); g.drawString("8",430,95); g.drawString("OKAY",50, 180); g.drawString("Pieces per player:",5,125); g.drawString("8",190,125); g.drawString("5",220,125); if (number_of_players==2){g.drawRect(185,48,19,19);} if (number_of_players==3){g.drawRect(185+30,48,19,19);} if (number_of_players==4){g.drawRect(185+30+30,48,19,19);} if (number_of_players==5){g.drawRect(185+30+30+30,48,19,19);} if (number_of_players==6){g.drawRect(185+30+30+30+30,48,19,19);} if (number_of_players==2){g.drawRect(184,47,21,21);} if (number_of_players==3){g.drawRect(184+30,47,21,21);} if (number_of_players==4){g.drawRect(184+30+30,47,21,21);} if (number_of_players==5){g.drawRect(184+30+30+30,47,21,21);} if (number_of_players==6){g.drawRect(184+30+30+30+30,47,21,21);} if (pawns_per_side==0){g.drawRect(185,78,19,19);} if (pawns_per_side==1){g.drawRect(185+30,78,19,19);} if (pawns_per_side==2){g.drawRect(185+30+30,78,19,19);} if (pawns_per_side==3){g.drawRect(185+30+30+30,78,19,19);} if (pawns_per_side==4){g.drawRect(185+30+30+30+30,78,19,19);} if (pawns_per_side==5){g.drawRect(185+30+30+30+30+30,78,19,19);} if (pawns_per_side==6){g.drawRect(185+30+30+30+30+30+30,78,19,19);} if (pawns_per_side==7){g.drawRect(185+30+30+30+30+30+30+30,78,19,19);} if (pawns_per_side==8){g.drawRect(185+30+30+30+30+30+30+30+30,78,19,19);} if (pawns_per_side==0){g.drawRect(184,77,21,21);} if (pawns_per_side==1){g.drawRect(184+30,77,21,21);} if (pawns_per_side==2){g.drawRect(184+30+30,77,21,21);} if (pawns_per_side==3){g.drawRect(184+30+30+30,77,21,21);} if (pawns_per_side==4){g.drawRect(184+30+30+30+30,77,21,21);} if (pawns_per_side==5){g.drawRect(184+30+30+30+30+30,77,21,21);} if (pawns_per_side==6){g.drawRect(184+30+30+30+30+30+30,77,21,21);} if (pawns_per_side==7){g.drawRect(184+30+30+30+30+30+30+30,77,21,21);} if (pawns_per_side==8){g.drawRect(184+30+30+30+30+30+30+30+30,77,21,21);} if (pieces_per_side==8){g.drawRect(185,108,19,19);} if (pieces_per_side==5){g.drawRect(185+30,108,19,19);} if (pieces_per_side==8){g.drawRect(184,107,21,21);} if (pieces_per_side==5){g.drawRect(184+30,107,21,21);} g.setFont(f1); g.drawString("Most popular setups:",10,240); g.drawString("2 players, 8 pawns, 8 pieces",30,260); g.drawString("3 players, 6 pawns, 8 pieces",30,280); g.drawString("4 players, 4 pawns, 8 pieces",30,300); g.drawString("5 players, 4 pawns, 8 pieces",30,320); g.drawString("6 players, 4 pawns, 8 pieces",30,340); g.drawString("2 players, 3 pawns, 5 pieces",30,360); g.drawString("3 players, 4 pawns, 5 pieces",30,380); g.drawString("I have not yet implemented the",10,410); g.drawString("must-capture or friendly-fire options,",30,430); g.drawString("or any real machine strategy.",30,450); return; } if(PromotingAPawn) return; g.setColor(niceblue); g.fillRect(0, 331+120, 599, 94); g.setColor(Color.black); g.setFont(f1); g.drawString("Red:", 10, 350+120); g.drawString("Gold", 10, 370+120); if (number_of_players>2){g.drawString("Blue:", 10, 390+120);} g.drawString("Computer", 120, 350+120); g.drawString("Computer", 120, 370+120); if (number_of_players>2){g.drawString("Computer", 120, 390+120);} g.drawString("Human", 60, 350+120); g.drawString("Human", 60, 370+120); if (number_of_players>2){g.drawString("Human", 60, 390+120);} if (number_of_players>3){g.drawString("Black:", 10+210, 350+120);} if (number_of_players>4){g.drawString("White:", 10+210, 370+120);} if (number_of_players>5){g.drawString("Green:", 10+210, 390+120);} if (number_of_players>3){g.drawString("Computer", 120+210, 350+120);} if (number_of_players>4){g.drawString("Computer", 120+210, 370+120);} if (number_of_players>5){g.drawString("Computer", 120+210, 390+120);} if (number_of_players>3){g.drawString("Human", 60+210, 350+120);} if (number_of_players>4){g.drawString("Human", 60+210, 370+120);} if (number_of_players>5){g.drawString("Human", 60+210, 390+120);} g.setFont(f1);NameThisChessVariant(g); switch(who_is_winning) { case 1: // '\001' g.drawString("Red wins", 30, 390+120); break; case 2: // '\002' g.drawString("Gold wins", 30, 390+120); break; case 3: // '\002' g.drawString("Blue wins", 30, 390+120); break; case 4: // '\002' g.drawString("White wins", 30, 390+120); break; case 5: // '\002' g.drawString("Black wins", 30, 390+120); break; case 6: // '\002' g.drawString("Green wins", 30, 390+120); break; case 7: // '\003' g.drawString("Draw", 30, 390+120); break; } if(who_is_winning > 0) g.drawString("Continue Game", 150, 390+120); if(who_is_winning > 0) { if(accepted_terms) { g.drawRect(26, 376+120, 67, 18); g.drawRect(27, 377+120, 65, 16); } if(!accepted_terms) { g.drawRect(147, 376+120, 95, 18); g.drawRect(148, 377+120, 93, 16); } } g.drawString("Games Won: ",460,400+10); g.drawString("Red "+wins[1],460+20,400+30); g.drawString("Gold "+wins[2],460+60+20,400+30); if (number_of_players>2){g.drawString("Blue "+wins[3],460+60+60+20,400+30);} if (number_of_players>3){g.drawString("Black "+wins[4],460+20,400+20+30);} if (number_of_players>4){g.drawString("White "+wins[5],460+60+20,400+20+30);} if (number_of_players>5){g.drawString("Green "+wins[6],460+60+60+20,400+20+30);} // g.drawString("Drawn "+drawn_games,460+60+60+20,400+10); g.setFont(f3); g.drawString("--Ed Friedlander", 235, 420+420); g.setFont(f2); if(humanizing) g.drawString("OKAY", 210+150+60, 360+120); g.setColor(Color.red); if(WhoIsHuman[1]) { g.drawRect(56, 336+120, 48, 18); g.drawRect(57, 337+120, 46, 16); } if(!WhoIsHuman[1]) { g.drawRect(117, 336+120, 61, 18); g.drawRect(118, 337+120, 59, 16); } g.setColor(Color.yellow); if(WhoIsHuman[2]) { g.drawRect(56, 356+120, 48, 18); g.drawRect(57, 357+120, 46, 16); } if(!WhoIsHuman[2]) { g.drawRect(117, 356+120, 61, 18); g.drawRect(118, 357+120, 59, 16); } if (number_of_players>2){ g.setColor(Color.blue); if(WhoIsHuman[3]) { g.drawRect(56, 376+120, 48, 18); g.drawRect(57, 377+120, 46, 16); } if(!WhoIsHuman[3]) { g.drawRect(117, 376+120, 61, 18); g.drawRect(118, 377+120, 59, 16); }} if (number_of_players>3){ g.setColor(Color.black); if(WhoIsHuman[4]) { g.drawRect(56+210, 336+120, 48, 18); g.drawRect(57+210, 337+120, 46, 16); } if(!WhoIsHuman[4]) { g.drawRect(117+210, 336+120, 61, 18); g.drawRect(118+210, 337+120, 59, 16); } } if (number_of_players>4){ g.setColor(Color.white); if(WhoIsHuman[5]) { g.drawRect(56+210, 356+120, 48, 18); g.drawRect(57+210, 357+120, 46, 16); } if(!WhoIsHuman[5]) { g.drawRect(117+210, 356+120, 61, 18); g.drawRect(118+210, 357+120, 59, 16); }} if (number_of_players>5){ g.setColor(Color.green); if(WhoIsHuman[6]) { g.drawRect(56+210, 376+120, 48, 18); g.drawRect(57+210, 377+120, 46, 16); } if(!WhoIsHuman[6]) { g.drawRect(117+210, 376+120, 61, 18); g.drawRect(118+210, 377+120, 59, 16); } } SaySomethingElseAboutWhoIsHuman(g); if ((stochastic_chess==true)|(schach_plus==true)){oranges(g);} } public void ShowStatusNothing() { if(!GameOver) { ShowStatusQ(""); if ((stochastic_chess==true)|(schach_plus==true)) { if (whoseMove==1){ShowStatusQ("White moves");} if (whoseMove==2){ShowStatusQ("Red moves");} } } } public void isthisstochasticchess(){stochastic_chess=false;} public void isthischex(){chex=0;} public void StartUp(Graphics g) { whoseMove=1; ForGambler(g); PromotingAPawn=false; GameOver=false; fifty_move_rule=0; // System.out.println();System.out.println();System.out.println(); if (tile_chess==true){making_rules=true;SayWhoIsHuman(g);return;} PrepareTheBoard(g); } public void PrepareTheBoard(Graphics g){ human_chosen_rank=0; human_chosen_file=0; men_unplaced[1]=16; men_unplaced[2]=16; light_squares_unplaced[1]=16; light_squares_unplaced[2]=16; dark_squares_unplaced[1]=16; dark_squares_unplaced[2]=16; i_just_made_a_square=false; accepted_terms=false; who_is_winning=0; BishopColor[0][0]=0; BishopColor[0][1]=0; BishopColor[1][0]=0; BishopColor[1][1]=0; BishopColor[2][0]=0; BishopColor[2][1]=0; BishopColor[3][0]=0; BishopColor[3][1]=0; BishopColor[4][0]=0; BishopColor[4][1]=0; BishopColor[5][0]=0; BishopColor[5][1]=0; BishopColor[6][0]=0; BishopColor[6][1]=0; assailant_rank=0; assailant_file=0; assailant2_rank=0; assailant2_file=0; fifty_move_rule=0; turncounter=1;saved_fifty_move_rule=0;saved_turncounter=1;ShowStatusNothing(); markingAPiece=true; KingRank[0]=0; KingFile[0]=0; KingRank[1]=4; KingFile[1]=15; KingRank[2]=6; KingFile[2]=15; KingRank[3]=8; KingFile[3]=15; KingRank[4]=10; KingFile[4]=15; KingRank[5]=12; KingFile[5]=15; KingRank[6]=14; KingFile[6]=15; for(a=1; a <23; a++) for(b=1; b <15; b++) { NowBoard.sq_[b][a].piece_=0; NowBoard.sq_[b][a].side_=0; if((a > 14)&&(b>2)) { if (b==3){NowBoard.sq_[b][a].side_=6;} if (b==4){NowBoard.sq_[b][a].side_=6;} if (b==5){NowBoard.sq_[b][a].side_=5;} if (b==6){NowBoard.sq_[b][a].side_=5;} if (b==7){NowBoard.sq_[b][a].side_=4;} if (b==8){NowBoard.sq_[b][a].side_=4;} if (b==9){NowBoard.sq_[b][a].side_=3;} if (b==10){NowBoard.sq_[b][a].side_=3;} if (b==11){NowBoard.sq_[b][a].side_=2;} if (b==12){NowBoard.sq_[b][a].side_=2;} if (b==13){NowBoard.sq_[b][a].side_=1;} if (b==14){NowBoard.sq_[b][a].side_=1;} NowBoard.sq_[b][a].piece_=1; } } for(a=1; a <15; a++) { my_pawn_on_this_file[a][1]=false; my_pawn_on_this_file[a][2]=false; } x=1;while (x<7){ NowBoard.sq_[2*x+2][15].piece_=-1; NowBoard.sq_[2*x+2][16].piece_=9; NowBoard.sq_[2*x+2][17].piece_=5; NowBoard.sq_[2*x+2][18].piece_=4; NowBoard.sq_[2*x+2][19].piece_=3; NowBoard.sq_[2*x+2][20].piece_=5; NowBoard.sq_[2*x+2][21].piece_=4; NowBoard.sq_[2*x+2][22].piece_=3; x++;} x=15;while (x<23){ y=1;while (y<15){ if ( ((x-14>pawns_per_side)&&(NowBoard.sq_[y][x].piece_==1)) | (NowBoard.sq_[y][x].side_>number_of_players) | ((pieces_per_side==5)&&(x>19)&&(NowBoard.sq_[y][x].piece_!=1)) ) { NowBoard.sq_[y][x].piece_=0; NowBoard.sq_[y][x].side_=0; } y++;}x++;} SupplementalStartup(); DrawNowBoard(g); TotalMaybeBoard(NowBoard, MaybeBoard); TotalMaybeBoard(MaybeBoard, TwoBoard); TotalMaybeBoard(TwoBoard, ThreeBoard); TotalMaybeBoard(ThreeBoard, FourBoard); GenerateAttackersArrays(); SupplementalStartup(g); whoseMove=1;turncounter=1;saved_fifty_move_rule=0;saved_turncounter=1; whatpiecescanmove(g); 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, CB16_23 cb16_23, CB16_23 cb16_23_1) { } public void SupplementalStartup() { } public void SupplementalStartup(Graphics g) { if ((stochastic_chess==true)|(chex>0)|(schach_plus==true)) { x=1;while (x<23){ y=1;while (y<15){ if ((stochastic_chess==true)|(x> 14)|(schach_plus==true)) { NowBoard.sq_[y][x].piece_=74; NowBoard.sq_[y][x].side_=3; } y++;}x++;} NowBoard.sq_[10][11].piece_=-1;NowBoard.sq_[10][11].side_=2; NowBoard.sq_[10][12].piece_=9 ;NowBoard.sq_[10][12].side_=2; NowBoard.sq_[10][13].piece_=5 ;NowBoard.sq_[10][13].side_=2; NowBoard.sq_[10][14].piece_=5 ;NowBoard.sq_[10][14].side_=2; NowBoard.sq_[9][11].piece_=4 ;NowBoard.sq_[9][11].side_=2; NowBoard.sq_[9][12].piece_=4 ;NowBoard.sq_[9][12].side_=2; NowBoard.sq_[9][13].piece_=3 ;NowBoard.sq_[9][13].side_=2; NowBoard.sq_[9][14].piece_=3 ;NowBoard.sq_[9][14].side_=2; NowBoard.sq_[8][11].piece_=1 ;NowBoard.sq_[8][11].side_=2; NowBoard.sq_[8][12].piece_=1 ;NowBoard.sq_[8][12].side_=2; NowBoard.sq_[8][13].piece_=1 ;NowBoard.sq_[8][13].side_=2; NowBoard.sq_[8][14].piece_=1 ;NowBoard.sq_[8][14].side_=2; NowBoard.sq_[7][11].piece_=1 ;NowBoard.sq_[7][11].side_=2; NowBoard.sq_[7][12].piece_=1 ;NowBoard.sq_[7][12].side_=2; NowBoard.sq_[7][13].piece_=1 ;NowBoard.sq_[7][13].side_=2; NowBoard.sq_[7][14].piece_=1 ;NowBoard.sq_[7][14].side_=2; NowBoard.sq_[6][11].piece_=-1;NowBoard.sq_[6][11].side_=1; NowBoard.sq_[6][12].piece_=9 ;NowBoard.sq_[6][12].side_=1; NowBoard.sq_[6][13].piece_=5 ;NowBoard.sq_[6][13].side_=1; NowBoard.sq_[6][14].piece_=5 ;NowBoard.sq_[6][14].side_=1; NowBoard.sq_[5][11].piece_=4 ;NowBoard.sq_[5][11].side_=1; NowBoard.sq_[5][12].piece_=4 ;NowBoard.sq_[5][12].side_=1; NowBoard.sq_[5][13].piece_=3 ;NowBoard.sq_[5][13].side_=1; NowBoard.sq_[5][14].piece_=3 ;NowBoard.sq_[5][14].side_=1; NowBoard.sq_[4][11].piece_=1 ;NowBoard.sq_[4][11].side_=1; NowBoard.sq_[4][12].piece_=1 ;NowBoard.sq_[4][12].side_=1; NowBoard.sq_[4][13].piece_=1 ;NowBoard.sq_[4][13].side_=1; NowBoard.sq_[4][14].piece_=1 ;NowBoard.sq_[4][14].side_=1; NowBoard.sq_[3][11].piece_=1 ;NowBoard.sq_[3][11].side_=1; NowBoard.sq_[3][12].piece_=1 ;NowBoard.sq_[3][12].side_=1; NowBoard.sq_[3][13].piece_=1 ;NowBoard.sq_[3][13].side_=1; NowBoard.sq_[3][14].piece_=1 ;NowBoard.sq_[3][14].side_=1; if (chex==2) { y=1;while (y<1000){ mover_file=11+(int)Math.floor(Math.random() * 4); moveto_file=11+(int)Math.floor(Math.random() * 4); mover_rank=7+(int)Math.floor(Math.random() * 4); moveto_rank=7+(int)Math.floor(Math.random() * 4); a=NowBoard.sq_[mover_rank][mover_file].piece_; NowBoard.sq_[mover_rank][mover_file].piece_=NowBoard.sq_[moveto_rank][moveto_file].piece_; NowBoard.sq_[moveto_rank][moveto_file].piece_=a; mover_rank=3+(int)Math.floor(Math.random() * 4); moveto_rank=3+(int)Math.floor(Math.random() * 4); a=NowBoard.sq_[mover_rank][mover_file].piece_; NowBoard.sq_[mover_rank][mover_file].piece_=NowBoard.sq_[moveto_rank][moveto_file].piece_; NowBoard.sq_[moveto_rank][moveto_file].piece_=a; y++;} } TotalMaybeBoard(NowBoard,MaybeBoard); } } public void TotalMaybeBoard(CB16_23 cb16_23, CB16_23 cb16_23_1) { for(xxx=1; xxx <15; xxx++) for(yyy=1; yyy <15; yyy++) { cb16_23_1.sq_[yyy][xxx].side_=cb16_23.sq_[yyy][xxx].side_; cb16_23_1.sq_[yyy][xxx].piece_=cb16_23.sq_[yyy][xxx].piece_; } } public void UnTwoThePawns(int i) { if((mover_rank==moveto_rank) && (mover_file==moveto_file)) return; for(xq=1; xq <15; xq++) for(yq=1; yq <15; yq++) if((NowBoard.sq_[yq][xq].side_==i) && (NowBoard.sq_[yq][xq].piece_==2)) NowBoard.sq_[yq][xq].piece_=1; } public void ZeroAllFiveCounts() { x=0;while (x<7){ PawnCount[x]=0; QueenCount[x]=0; KingCount[x]=0; RookCount[x]=0; BishopCount[x]=0; KnightCount[x]=0;x++;} } public void alterMaybeBoard(Graphics g, Chsq chsq, Chsq chsq1, CB16_23 cb16_23, CB16_23 cb16_23_1) { cb16_23_1.sq_[chsq.rank_][chsq.file_].piece_=0; cb16_23_1.sq_[chsq.rank_][chsq.file_].side_=0; cb16_23_1.sq_[chsq1.rank_][chsq1.file_].piece_=cb16_23.sq_[chsq.rank_][chsq.file_].piece_; cb16_23_1.sq_[chsq1.rank_][chsq1.file_].side_=cb16_23.sq_[chsq.rank_][chsq.file_].side_; if (cb16_23.sq_[chsq.rank_][chsq.file_].piece_==0) { cb16_23_1.sq_[chsq.rank_][chsq.file_].piece_=74; cb16_23_1.sq_[chsq.rank_][chsq.file_].side_=3; } if((cb16_23.sq_[chsq.rank_][chsq.file_].piece_==1) && (cb16_23.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) && (cb16_23.sq_[chsq.rank_][chsq1.file_].piece_==2)) { cb16_23_1.sq_[chsq.rank_][chsq1.file_].piece_=0; cb16_23_1.sq_[chsq.rank_][chsq1.file_].side_=0; } } public void alterforked(Chsq chsq) { if((fork_c > 0) && (fork_c <=10) && (fork_d > 0) && (fork_d <=10)) { if(NowBoard.sq_[fork_d][fork_c].side_==chsq.side_) return; if((NowBoard.sq_[fork_d][fork_c].strength() > 3) | (NowBoard.sq_[fork_d][fork_c].piece_ < 0)) forked_royalty++; if((NowBoard.sq_[fork_d][fork_c].strength() > 2) | (NowBoard.sq_[fork_d][fork_c].piece_ < 0)) forked_rookage++; if((NowBoard.sq_[fork_d][fork_c].strength() > 1) | (NowBoard.sq_[fork_d][fork_c].piece_ < 0)) forked_pieceage++; } } public void failsafe(Graphics g) { } public boolean findPieceMoves(Graphics g, Chsq chsq, CB16_23 cb16_23, CB16_23 cb16_23_1) { if ((men_unplaced[chsq.side_]==1)&&(chsq.file_> 14)&&(dark_squares_unplaced[chsq.side_]+light_squares_unplaced[chsq.side_]>0)){return false;} if(chsq.file_ > 14) { for(c[depth]=1; c[depth] <15; c[depth]++) for(d[depth]=1; d[depth] <15; d[depth]++) if( ((d[depth] < 6) && (chsq.side_==1)) | ((d[depth] > 5) && (chsq.side_==2)) | (stochastic_chess==true)|(tile_chess==true)|(chex>0)|(schach_plus==true)) MaybeAdd(g, chsq, cb16_23, cb16_23_1); return true; } if((turncounter < 26)&&(stochastic_chess==false)&&(tile_chess==false)&&(chex==0)&&(schach_plus==false)) return false; CheckSquare[depth]=false; SquatterOnCheckSquare[depth]=false; SupplementalMovers(g, chsq, cb16_23, cb16_23_1); if (chsq.piece_==0) { if (men_unplaced[empty_is_moving_for]>0){return false;} if (chsq.file_> 14){return false;} c[depth]=1;while (c[depth]<15){ d[depth]=1;while (d[depth]<15){ if ((cb16_23.sq_[d[depth]][c[depth]].piece_==74)&&((chsq.rank_+chsq.file_)%2==(c[depth]+d[depth])%2)){ if (can_make_here(d[depth],c[depth])==true) { MaybeAdd(g, chsq, cb16_23, cb16_23_1); }} d[depth]++;}c[depth]++;} } if((chsq.piece_==60) | (chsq.piece_==260) | (chsq.piece_==224)) { c[depth]=chsq.file_-2; d[depth]=chsq.rank_-2; MaybeAdd(g, chsq, cb16_23, cb16_23_1); c[depth]=chsq.file_-2; d[depth]=chsq.rank_+2; MaybeAdd(g, chsq, cb16_23, cb16_23_1); c[depth]=chsq.file_+2; d[depth]=chsq.rank_-2; MaybeAdd(g, chsq, cb16_23, cb16_23_1); c[depth]=chsq.file_+2; d[depth]=chsq.rank_+2; MaybeAdd(g, chsq, cb16_23, cb16_23_1); } if((chsq.piece_==9) | (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, cb16_23, cb16_23_1)) | (CheckSquare[depth]) && (chsq.piece_ !=-9) && (chsq.piece_ !=-67) && (!SquatterOnCheckSquare[depth]); c[depth]=c[depth]-1); c[depth]=chsq.file_+1; for(d[depth]=chsq.rank_; (MaybeAdd(g, chsq, cb16_23, cb16_23_1)) | (CheckSquare[depth]) && (chsq.piece_ !=-9) && (chsq.piece_ !=-67) && (!SquatterOnCheckSquare[depth]); c[depth]++); c[depth]=chsq.file_; for(d[depth]=chsq.rank_-1; (MaybeAdd(g, chsq, cb16_23, cb16_23_1)) | (CheckSquare[depth]) && (chsq.piece_ !=-9) && (chsq.piece_ !=-67) && (!SquatterOnCheckSquare[depth]); d[depth]=d[depth]-1); c[depth]=chsq.file_; for(d[depth]=chsq.rank_+1; (MaybeAdd(g, chsq, cb16_23, cb16_23_1)) | (CheckSquare[depth]) && (chsq.piece_ !=-9) && (chsq.piece_ !=-67) && (!SquatterOnCheckSquare[depth]); d[depth]++); } if((chsq.piece_==9) | (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, cb16_23, cb16_23_1)) | (CheckSquare[depth]) && (chsq.piece_ !=-9) && (chsq.piece_ !=-67) && (!SquatterOnCheckSquare[depth]); d[depth]=d[depth]-1) c[depth]=c[depth]-1; c[depth]=chsq.file_-1; for(d[depth]=chsq.rank_+1; (MaybeAdd(g, chsq, cb16_23, cb16_23_1)) | (CheckSquare[depth]) && (chsq.piece_ !=-9) && (chsq.piece_ !=-67) && (!SquatterOnCheckSquare[depth]); d[depth]=d[depth]+1) c[depth]=c[depth]-1; c[depth]=chsq.file_+1; for(d[depth]=chsq.rank_-1; (MaybeAdd(g, chsq, cb16_23, cb16_23_1)) | (CheckSquare[depth]) && (chsq.piece_ !=-9) && (chsq.piece_ !=-67) && (!SquatterOnCheckSquare[depth]); d[depth]=d[depth]-1) c[depth]=c[depth]+1; c[depth]=chsq.file_+1; for(d[depth]=chsq.rank_+1; (MaybeAdd(g, chsq, cb16_23, cb16_23_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_==-13) | (chsq.piece_==-14) | (chsq.piece_==25)) { c[depth]=chsq.file_+1; d[depth]=chsq.rank_; MaybeAdd(g, chsq, cb16_23, cb16_23_1); c[depth]=chsq.file_; d[depth]=chsq.rank_+1; MaybeAdd(g, chsq, cb16_23, cb16_23_1); c[depth]=chsq.file_-1; d[depth]=chsq.rank_; MaybeAdd(g, chsq, cb16_23, cb16_23_1); c[depth]=chsq.file_; d[depth]=chsq.rank_-1; MaybeAdd(g, chsq, cb16_23, cb16_23_1); c[depth]=chsq.file_+1; d[depth]=chsq.rank_+1; MaybeAdd(g, chsq, cb16_23, cb16_23_1); c[depth]=chsq.file_+1; d[depth]=chsq.rank_-1; MaybeAdd(g, chsq, cb16_23, cb16_23_1); c[depth]=chsq.file_-1; d[depth]=chsq.rank_+1; MaybeAdd(g, chsq, cb16_23, cb16_23_1); c[depth]=chsq.file_-1; d[depth]=chsq.rank_-1; MaybeAdd(g, chsq, cb16_23, cb16_23_1); } 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, cb16_23, cb16_23_1); c[depth]=chsq.file_; d[depth]=chsq.rank_-1; if(NowBoard.sq_[d[depth]][c[depth]].piece_ !=0) MaybeAdd(g, chsq, cb16_23, cb16_23_1); c[depth]=chsq.file_+1; d[depth]=chsq.rank_+1; if(NowBoard.sq_[d[depth]][c[depth]].piece_==0) MaybeAdd(g, chsq, cb16_23, cb16_23_1); c[depth]=chsq.file_+1; d[depth]=chsq.rank_-1; if(NowBoard.sq_[d[depth]][c[depth]].piece_==0) MaybeAdd(g, chsq, cb16_23, cb16_23_1); c[depth]=chsq.file_-1; d[depth]=chsq.rank_+1; if(NowBoard.sq_[d[depth]][c[depth]].piece_==0) MaybeAdd(g, chsq, cb16_23, cb16_23_1); c[depth]=chsq.file_-1; d[depth]=chsq.rank_-1; if(NowBoard.sq_[d[depth]][c[depth]].piece_==0) MaybeAdd(g, chsq, cb16_23, cb16_23_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_ < 7) && (chsq.file_ < 7)) { c[depth]=chsq.file_+2; d[depth]=chsq.rank_+2; if(NowBoard.sq_[d[depth]][c[depth]].piece_==0) MaybeAdd(g, chsq, cb16_23, cb16_23_1); } if((NowBoard.sq_[chsq.rank_+1][chsq.file_-1].piece_==0) && (chsq.rank_ < 7) && (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, cb16_23, cb16_23_1); } if((NowBoard.sq_[chsq.rank_-1][chsq.file_+1].piece_==0) && (chsq.rank_ > 2) && (chsq.file_ < 7)) { c[depth]=chsq.file_+2; d[depth]=chsq.rank_-2; if(NowBoard.sq_[d[depth]][c[depth]].piece_==0) MaybeAdd(g, chsq, cb16_23, cb16_23_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, cb16_23, cb16_23_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, cb16_23, cb16_23_1); c[depth]=chsq.file_+1; d[depth]=chsq.rank_-1; MaybeAdd(g, chsq, cb16_23, cb16_23_1); c[depth]=chsq.file_-1; d[depth]=chsq.rank_+1; MaybeAdd(g, chsq, cb16_23, cb16_23_1); c[depth]=chsq.file_-1; d[depth]=chsq.rank_-1; MaybeAdd(g, chsq, cb16_23, cb16_23_1); } if((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, cb16_23, cb16_23_1); c[depth]=chsq.file_-2; d[depth]=chsq.rank_+1; MaybeAdd(g, chsq, cb16_23, cb16_23_1); c[depth]=chsq.file_+2; d[depth]=chsq.rank_-1; MaybeAdd(g, chsq, cb16_23, cb16_23_1); c[depth]=chsq.file_+2; d[depth]=chsq.rank_+1; MaybeAdd(g, chsq, cb16_23, cb16_23_1); c[depth]=chsq.file_-1; d[depth]=chsq.rank_-2; MaybeAdd(g, chsq, cb16_23, cb16_23_1); c[depth]=chsq.file_-1; d[depth]=chsq.rank_+2; MaybeAdd(g, chsq, cb16_23, cb16_23_1); c[depth]=chsq.file_+1; d[depth]=chsq.rank_-2; MaybeAdd(g, chsq, cb16_23, cb16_23_1); c[depth]=chsq.file_+1; d[depth]=chsq.rank_+2; MaybeAdd(g, chsq, cb16_23, cb16_23_1); } if ((chsq.piece_==1)&&(tile_chess==true)) { c[depth]=chsq.file_+1;d[depth]=chsq.rank_+1; if (cb16_23.sq_[d[depth]][c[depth]].piece_!=0){MaybeAdd(g, chsq, cb16_23, cb16_23_1);} c[depth]=chsq.file_+1;d[depth]=chsq.rank_-1; if (cb16_23.sq_[d[depth]][c[depth]].piece_!=0){MaybeAdd(g, chsq, cb16_23, cb16_23_1);} c[depth]=chsq.file_-1;d[depth]=chsq.rank_+1; if (cb16_23.sq_[d[depth]][c[depth]].piece_!=0){MaybeAdd(g, chsq, cb16_23, cb16_23_1);} c[depth]=chsq.file_-1;d[depth]=chsq.rank_-1; if (cb16_23.sq_[d[depth]][c[depth]].piece_!=0){MaybeAdd(g, chsq, cb16_23, cb16_23_1);} c[depth]=chsq.file_+1;d[depth]=chsq.rank_; if (cb16_23.sq_[d[depth]][c[depth]].piece_==0){MaybeAdd(g, chsq, cb16_23, cb16_23_1);} c[depth]=chsq.file_-1;d[depth]=chsq.rank_; if (cb16_23.sq_[d[depth]][c[depth]].piece_==0){MaybeAdd(g, chsq, cb16_23, cb16_23_1);} c[depth]=chsq.file_;d[depth]=chsq.rank_+1; if (cb16_23.sq_[d[depth]][c[depth]].piece_==0){MaybeAdd(g, chsq, cb16_23, cb16_23_1);} c[depth]=chsq.file_;d[depth]=chsq.rank_-1;; if (cb16_23.sq_[d[depth]][c[depth]].piece_==0){MaybeAdd(g, chsq, cb16_23, cb16_23_1);} } if((chsq.piece_==1)&&(tile_chess==false)) { if((chsq.side_==1) && (chsq.rank_ < 10)) { if(NowBoard.sq_[chsq.rank_+1][chsq.file_].piece_==0) { c[depth]=chsq.file_; d[depth]=chsq.rank_+1; MaybeAdd(g, chsq, cb16_23, cb16_23_1); } if(chsq.rank_ < 9 && (NowBoard.sq_[chsq.rank_+1][chsq.file_].piece_==0) && (NowBoard.sq_[chsq.rank_+2][chsq.file_].piece_==0)&&(stochastic_chess==false)&&(chex==0)&&(schach_plus==false)) { c[depth]=chsq.file_; d[depth]=chsq.rank_+2; MaybeAdd(g, chsq, cb16_23, cb16_23_1); } if(chsq.file_ > 1) { if((NowBoard.sq_[chsq.rank_+1][chsq.file_-1].side_ !=0) && (NowBoard.sq_[chsq.rank_+1][chsq.file_-1].side_ !=chsq.side_) && (NowBoard.sq_[chsq.rank_+1][chsq.file_-1].piece_ !=0)) { c[depth]=chsq.file_-1; d[depth]=chsq.rank_+1; MaybeAdd(g, chsq, cb16_23, cb16_23_1); } if((NowBoard.sq_[chsq.rank_+1][chsq.file_-1].side_==0) && (NowBoard.sq_[chsq.rank_][chsq.file_-1].side_ !=chsq.side_) && (NowBoard.sq_[chsq.rank_][chsq.file_-1].piece_==2)) { c[depth]=chsq.file_-1; d[depth]=chsq.rank_+1; MaybeAdd(g, chsq, cb16_23, cb16_23_1); } } if(chsq.file_ < 10) { if((NowBoard.sq_[chsq.rank_+1][chsq.file_+1].side_ !=0) && (NowBoard.sq_[chsq.rank_+1][chsq.file_+1].side_ !=chsq.side_) && (NowBoard.sq_[chsq.rank_+1][chsq.file_+1].piece_ !=0)) { c[depth]=chsq.file_+1; d[depth]=chsq.rank_+1; MaybeAdd(g, chsq, cb16_23, cb16_23_1); } if((NowBoard.sq_[chsq.rank_+1][chsq.file_+1].side_==0) && (NowBoard.sq_[chsq.rank_][chsq.file_+1].side_ !=chsq.side_) && (NowBoard.sq_[chsq.rank_][chsq.file_+1].piece_==2)) { c[depth]=chsq.file_+1; d[depth]=chsq.rank_+1; MaybeAdd(g, chsq, cb16_23, cb16_23_1); } } } if((chsq.side_==2) && (chsq.rank_ > 1)) { if(NowBoard.sq_[chsq.rank_-1][chsq.file_].piece_==0) { c[depth]=chsq.file_; d[depth]=chsq.rank_-1; MaybeAdd(g, chsq, cb16_23, cb16_23_1); } if(chsq.rank_ > 2 && (NowBoard.sq_[chsq.rank_-1][chsq.file_].piece_==0) && (NowBoard.sq_[chsq.rank_-2][chsq.file_].piece_==0)&&(stochastic_chess==false)&&(chex==0)&&(schach_plus==false)) { c[depth]=chsq.file_; d[depth]=chsq.rank_-2; MaybeAdd(g, chsq, cb16_23, cb16_23_1); } if(chsq.file_ > 1) { if((NowBoard.sq_[chsq.rank_-1][chsq.file_-1].side_ !=0) && (NowBoard.sq_[chsq.rank_-1][chsq.file_-1].side_ !=chsq.side_) && (NowBoard.sq_[chsq.rank_-1][chsq.file_-1].piece_ !=0)) { c[depth]=chsq.file_-1; d[depth]=chsq.rank_-1; MaybeAdd(g, chsq, cb16_23, cb16_23_1); } if((NowBoard.sq_[chsq.rank_-1][chsq.file_-1].side_==0) && (NowBoard.sq_[chsq.rank_][chsq.file_-1].side_ !=chsq.side_) && (NowBoard.sq_[chsq.rank_][chsq.file_-1].piece_==2)) { c[depth]=chsq.file_-1; d[depth]=chsq.rank_-1; MaybeAdd(g, chsq, cb16_23, cb16_23_1); } } if(chsq.file_ < 10) { if((NowBoard.sq_[chsq.rank_-1][chsq.file_+1].side_ !=0) && (NowBoard.sq_[chsq.rank_-1][chsq.file_+1].side_ !=chsq.side_) && (NowBoard.sq_[chsq.rank_-1][chsq.file_+1].piece_ !=0)) { c[depth]=chsq.file_+1; d[depth]=chsq.rank_-1; MaybeAdd(g, chsq, cb16_23, cb16_23_1); } if((NowBoard.sq_[chsq.rank_-1][chsq.file_+1].side_==0) && (NowBoard.sq_[chsq.rank_][chsq.file_+1].side_ !=chsq.side_) && (NowBoard.sq_[chsq.rank_][chsq.file_+1].piece_==2)) { c[depth]=chsq.file_+1; d[depth]=chsq.rank_-1; MaybeAdd(g, chsq, cb16_23, cb16_23_1); } } } } int _tmp=chsq.piece_; int _tmp1=chsq.piece_; int _tmp2=chsq.file_; return moveCounter !=0; } public void init() { number_of_players=2; seek_sacrificial_wins=false; isthisstochasticchess(); isthischex(); isthisschach_plus(); isthistile_chess(); if (tile_chess==true){ number_of_players=6; pawns_per_side=4; pieces_per_side=8; } connected=new boolean[16][16]; human_chosen_rank=0; human_chosen_file=0; drop_here=new Chsq[120]; for(a=0; a < 120; a++) drop_here[a]=new Chsq(0, 0, 0, 0); light_squares_unplaced=new int[7]; dark_squares_unplaced=new int[7]; men_unplaced=new int[7]; halt_if_king_taken=true; term_counts=new int[5]; best_four_count=new int[7]; MaybeMoves=new Chmo[2001]; for(a=1; a <=2000; a++) MaybeMoves[a]=new Chmo(); MaybeEmptySquareMoves=new Stomo[6001]; for (a=1; a<=6000;a++) MaybeEmptySquareMoves[a]=new Stomo(); undef_enemy_pawn_most_advanced_file=new int[7]; undef_enemy_pawn_most_advanced_rank=new int[7]; undef_enemy_pawn_nearest_king_file=new int[7]; undef_enemy_pawn_nearest_king_rank=new int[7]; distance_to_edible_pawn=new int[7]; niceblue=new Color(0, 192, 255); my_pawn_on_this_file=new boolean[15][7]; PawnCount=new int[8]; KingFile=new int[8]; KingRank=new int[8]; KnightCount=new int[8]; BishopCount=new int[8]; RookCount=new int[8]; QueenCount=new int[8]; KingCount=new int[8]; Attackers=new int[16][23][7]; CLCAttackers=new int[16][23][7]; StrongestAttacker=new int[16][23][7]; WeakestAttacker=new int[16][23][7]; NowBoard=new CB16_23(312); SaveBoard=new CB16_23(312); BackBoard=new CB16_23(312); MaybeBoard=new CB16_23(312); OneBoard=new CB16_23(312); TwoBoard=new CB16_23(312); ThreeBoard=new CB16_23(312); FourBoard=new CB16_23(312); icanmove=new boolean[16][23]; happySquare=new Chsq(1, 1, 5, 1); ArchiveBoard=new CB16_23[102]; 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[8]; wins=new int[7]; depth=0; WhoIsHuman[1]=true; WhoIsHuman[2]=false; WhoIsHuman[3]=false; WhoIsHuman[4]=false; WhoIsHuman[5]=false; WhoIsHuman[6]=false; SupplementalInit(); GameOver=false; PromotingAPawn=false; drawn_games=0; Graphics g=getGraphics(); setBackground(niceblue); markingAPiece=true; WhoIsHuman[0]=true; wins[0]=0; wins[1]=0; wins[2]=0; StartUp(g); millipede1=System.currentTimeMillis();for (xxx=0;xxx<102;xxx++){ArchiveBoard[xxx]=new CB16_23(312);} millipede2=System.currentTimeMillis(); how_deep_to_seek=1; } public void inquire_about_terms() { if (tile_chess==true){return;} who_is_winning=0; if(turncounter < 26) return; if((!WhoIsHuman[1]) && (!WhoIsHuman[2])) return; if(IsMySideInCheck(1)) return; if(IsMySideInCheck(2)) return; CountAllThePieces(); term_counts[1]=90 * QueenCount[1]+50 * RookCount[1]+30 * BishopCount[1]+30 * KnightCount[1]+10 * PawnCount[1]; term_counts[2]=90 * QueenCount[2]+50 * RookCount[2]+30 * BishopCount[2]+30 * KnightCount[2]+10 * PawnCount[2]; if((fifty_move_rule > 2) && (PawnCount[1]==0) && (PawnCount[2]==0) && (term_counts[1]==term_counts[2]) && (bestvcom1==0)) who_is_winning=3; if(!WhoIsHuman[whoseMove]) { if(((bestvcom1 >=0) | (bestvcom1==-5000) | (how_deep_to_seek < 4)) && (term_counts[whoseMove] >=30+term_counts[3-whoseMove])) who_is_winning=whoseMove; if(((bestvcom1 <=0) | (how_deep_to_seek < 4)) && (term_counts[3-whoseMove] >=30+term_counts[whoseMove])) who_is_winning=3-whoseMove; } if(WhoIsHuman[whoseMove]) { if((Attackers[moveto_rank][moveto_file][3-whoseMove]==0) && (term_counts[whoseMove] >=30+term_counts[3-whoseMove])) who_is_winning=whoseMove; if(term_counts[3-whoseMove] >=30+term_counts[whoseMove]) who_is_winning=3-whoseMove; } } public void knightforks(Chsq chsq) { forked_royalty=0; forked_rookage=0; forked_pieceage=0; fork_c=c[depth]+2; fork_d=d[depth]+1; alterforked(chsq); fork_c=c[depth]+2; fork_d=d[depth]-1; alterforked(chsq); fork_c=c[depth]-2; fork_d=d[depth]+1; alterforked(chsq); fork_c=c[depth]-2; fork_d=d[depth]-1; alterforked(chsq); fork_c=c[depth]+1; fork_d=d[depth]+2; alterforked(chsq); fork_c=c[depth]+1; fork_d=d[depth]-2; alterforked(chsq); fork_c=c[depth]-1; fork_d=d[depth]+2; alterforked(chsq); fork_c=c[depth]-1; fork_d=d[depth]-2; alterforked(chsq); } public boolean can_make_here(int i,int j){ if ((whoseMove==1)&&(turncounter==1)){return true;} if (i>1){if (NowBoard.sq_[i-1][j].piece_!=74){return true;}} if (j>1){if (NowBoard.sq_[i][j-1].piece_!=74){return true;}} if (i<10){if (NowBoard.sq_[i+1][j].piece_!=74){return true;}} if (j<10){if (NowBoard.sq_[i][j+1].piece_!=74){return true;}} return false; } public void oranges(Graphics g){ g.setColor(niceblue); g.fillRect(300,330+120,580,60); g.setColor(Color.black); g.setFont(f1); g.drawString("White holds "+light_squares_unplaced[1]+" light && "+dark_squares_unplaced[1]+" dark.",305,340); g.drawString("Red holds "+light_squares_unplaced[2]+" light && "+dark_squares_unplaced[2]+" dark.",305,360); } public boolean markAPiece(Graphics g, int i, int j) { if (human_chosen_rank!=0) { if ((i!=human_chosen_rank)|(j!=human_chosen_file)){return false;} } if ((stochastic_chess==false)&&(schach_plus==false)){ if(NowBoard.sq_[i][j].side_ !=whoseMove) return false;} if ((stochastic_chess==true)|(schach_plus==true)) { if (NowBoard.sq_[i][j].side_==3-whoseMove){return false;} if (NowBoard.sq_[i][j].piece_==74) { if (j> 14){return false;} if (( (i+j)%2==0) && (dark_squares_unplaced[whoseMove]==0)){return false;} if (( (i+j)%2==1) && (light_squares_unplaced[whoseMove]==0)){return false;} if (can_make_here(i,j)==false){return false;} } } if ((NowBoard.sq_[i][j].piece_==74)&&((turncounter!=24)|(KingFile[whoseMove]<15))) { TotalMaybeBoard(NowBoard,MaybeBoard); MaybeBoard.sq_[i][j].piece_=0;MaybeBoard.sq_[i][j].side_=0; if (IsMySideInCheck(whoseMove)==true) { MaybeBoard.sq_[i][j].piece_=74; MaybeBoard.sq_[i][j].side_=3; return false; } MaybeBoard.sq_[i][j].piece_=74; MaybeBoard.sq_[i][j].side_=3; i_just_made_a_square=true; if ( (i+j)%2==0){dark_squares_unplaced[whoseMove]--;} if ( (i+j)%2==1){light_squares_unplaced[whoseMove]--;} oranges(g); NowBoard.sq_[i][j].piece_=0; NowBoard.sq_[i][j].side_=0; DrawNowBoard(g); markingAPiece=false; return true; } empty_is_moving_for=whoseMove; 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].DrawTileChssSquare(g, 1, icanmove[i][j]); if ((mover_file> 14)&&(chex==2)) { SettleADrawnGame();GameOver=true; ShowStatusQ("Unit cannot be played! Draw!"); System.out.print("You tried to play "+NowBoard.sq_[i][j].piece_+" on "+i+""+j); } return false; } if ((mover_file> 14)&&(chex==2)) { human_chosen_rank=mover_rank; human_chosen_file=mover_file; x=1;while (x<15){ y=1;while (y<15){ icanmove[y][x]=false; y++;}x++;} icanmove[human_chosen_rank][human_chosen_file]=true; DrawNowBoard(g); } NowBoard.sq_[i][j].DrawTileChssSquare(g, 2, false); for(x=1; x <=moveCounter; x++) { MaybeMoves[x].endingsquare_.markchsqTileChss(g); } markingAPiece=false; return true; } public boolean mouseDown(Event event, int i, int j) { if(NowBoard==null) return true; Graphics g=getGraphics(); if (making_rules==true) { if (number_of_players==2){g.drawRect(184,47,21,21);} if ((i>=184)&&(j>=47)&&(i<=184+21)&&(j<=47+21)) { number_of_players=2;SayWhoIsHuman(g); } if ((i>=184+30)&&(j>=47)&&(i<=184+21+30)&&(j<=47+21)) { number_of_players=3;SayWhoIsHuman(g); } if ((i>=184+30+30)&&(j>=47)&&(i<=184+21+30+30)&&(j<=47+21)) { number_of_players=4;SayWhoIsHuman(g); } if ((i>=184+30+30+30)&&(j>=47)&&(i<=184+21+30+30+30)&&(j<=47+21)) { number_of_players=5;SayWhoIsHuman(g); } if ((i>=184+30+30+30+30)&&(j>=47)&&(i<=184+21+30+30+30+30)&&(j<=47+21)) { number_of_players=6;SayWhoIsHuman(g); } if ((i>=184)&&(j>=77)&&(i<=184+21)&&(j<=77+21)) { pawns_per_side=0;SayWhoIsHuman(g); } if ((i>=184+30)&&(j>=77)&&(i<=184+21+30)&&(j<=77+21)) { pawns_per_side=1;SayWhoIsHuman(g); } if ((i>=184+30+30)&&(j>=77)&&(i<=184+21+30+30)&&(j<=77+21)) { pawns_per_side=2;SayWhoIsHuman(g); } if ((i>=184+30+30+30)&&(j>=77)&&(i<=184+21+30+30+30)&&(j<=77+21)) { pawns_per_side=3;SayWhoIsHuman(g); } if ((i>=184+30+30+30+30)&&(j>=77)&&(i<=184+21+30+30+30+30)&&(j<=77+21)) { pawns_per_side=4;SayWhoIsHuman(g); } if ((i>=184+30+30+30+30+30)&&(j>=77)&&(i<=184+21+30+30+30+30+30)&&(j<=77+21)) { pawns_per_side=5;SayWhoIsHuman(g); } if ((i>=184+30+30+30+30+30+30)&&(j>=77)&&(i<=184+21+30+30+30+30+30+30)&&(j<=77+21)) { pawns_per_side=6;SayWhoIsHuman(g); } if ((i>=184+30+30+30+30+30+30+30)&&(j>=77)&&(i<=184+21+30+30+30+30+30+30+30)&&(j<=77+21)) { pawns_per_side=7;SayWhoIsHuman(g); } if ((i>=184+30+30+30+30+30+30+30+30)&&(j>=77)&&(i<=184+21+30+30+30+30+30+30+30+30)&&(j<=77+21)) { pawns_per_side=8;SayWhoIsHuman(g); } if ((i>=184)&&(j>=107)&&(i<=184+21)&&(j<=107+21)) { pieces_per_side=8;SayWhoIsHuman(g); } if ((i>=184+30)&&(j>=107)&&(i<=184+21+30)&&(j<=107+21)) { pieces_per_side=5;SayWhoIsHuman(g); } if ((i>50)&&(j>165)&&(i<100)&&(j<183)) { g.setColor(niceblue); g.fillRect(0,0,500,500); making_rules=false;repaint(); PrepareTheBoard(g);repaint(); return true; } SayWhoIsHuman(g); return true; } 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=15-j / 30; if(!PromotingAPawn) if((i >=56) && (j >=336+120) && (i <=104) && (j <=354+120)) { humanizing=true; WhoIsHuman[1]=true; SayWhoIsHuman(g); } else if((i >=117) && (j >=336+120) && (i <=178) && (j <=354+120)) { humanizing=true; WhoIsHuman[1]=false; SayWhoIsHuman(g); } else if((i >=56) && (j >=356+120) && (i <=104) && (j <=374+120)) { humanizing=true; WhoIsHuman[2]=true; SayWhoIsHuman(g); } else if((i >=117) && (j >=356+120) && (i <=178) && (j <=374+120)) { humanizing=true; WhoIsHuman[2]=false; SayWhoIsHuman(g); } else if((i >=56) && (j >=376+120) && (i <=104) && (j <=394+120)) { humanizing=true; WhoIsHuman[3]=true; SayWhoIsHuman(g); } else if((i >=117) && (j >=376+120) && (i <=178) && (j <=394+120)) { humanizing=true; WhoIsHuman[3]=false; SayWhoIsHuman(g); } else if((i >=56+210) && (j >=336+120) && (i <=104+210) && (j <=354+120)) { humanizing=true; WhoIsHuman[4]=true; SayWhoIsHuman(g); } else if((i >=117+210) && (j >=336+120) && (i <=178+210) && (j <=354+120)) { humanizing=true; WhoIsHuman[4]=false; SayWhoIsHuman(g); } else if((i >=56+210) && (j >=356+120) && (i <=104+210) && (j <=374+120)) { humanizing=true; WhoIsHuman[5]=true; SayWhoIsHuman(g); } else if((i >=117+210) && (j >=356+120) && (i <=178+210) && (j <=374+120)) { humanizing=true; WhoIsHuman[5]=false; SayWhoIsHuman(g); } else if((i >=56+210) && (j >=376+120) && (i <=104+210) && (j <=394+120)) { humanizing=true; WhoIsHuman[6]=true; SayWhoIsHuman(g); } else if((i >=117+210) && (j >=376+120) && (i <=178+210) && (j <=394+120)) { humanizing=true; WhoIsHuman[6]=false; SayWhoIsHuman(g); } else if((i >=26) && (j > 376+120) && (i <=93) && (j <=394+120)) { if(who_is_winning==0) return true; humanizing=true; accepted_terms=true; SayWhoIsHuman(g); } else if((i >=147) && (j >=376+120) && (i < 242) && (j < 394+120)) { if(who_is_winning==0) return true; humanizing=true; accepted_terms=false; SayWhoIsHuman(g); } else if((i >=210+150+60) && (j >=345+120) && (i < 270+150+60) && (j < 380+120)) { 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) SettleADrawnGame(); if(who_is_winning !=0) { StartUp(g); repaint(); markingAPiece=true; return true; } } } if(humanizing) return true; if((a < 1) | (a > 22) | (b < 1) | (b > 14) && !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].DrawTileChssSquare(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); if (i_just_made_a_square==true) { NextOrdinaryPlayer(g); if(WhoIsHuman[whoseMove]) markingAPiece=true; }} 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 boolean opening_library() { return false; } public void paint(Graphics g) { setBackground(niceblue); if(NowBoard==null) { g.setColor(Color.black); g.setFont(f1); AssignVariantName();g.drawString("Thank you for playing "+variant_name+"!", 5, 20); g.drawString("Final totals: White "+wins[1]+" Red "+wins[2]+" Drawn "+drawn_games, 5, 50); return; } paintSomethingElse(g); DrawNowBoard(g); g.setColor(niceblue); g.fillRect(0, 331+120, 599, 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].DrawTileChssSquare(g, 2, false); for(x=1; x <=moveCounter; x++) MaybeMoves[x].endingsquare_.markchsqTileChss(g); } paintSomethingElse2(g); } public void paintSomethingElse(Graphics g) { } public void paintSomethingElse2(Graphics g) { } public void pawnforks(Chsq chsq) { forked_royalty=0; forked_rookage=0; forked_pieceage=0; if(chsq.side_==1) { fork_c=c[depth]+1; fork_d=d[depth]+1; alterforked(chsq); fork_c=c[depth]-1; fork_d=d[depth]+1; alterforked(chsq); } if(chsq.side_==2) { fork_c=c[depth]+1; fork_d=d[depth]-1; alterforked(chsq); fork_c=c[depth]-1; fork_d=d[depth]-1; alterforked(chsq); } } 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, CB16_23 cb16_23, CB16_23 cb16_23_1) { cb16_23_1.sq_[chsq.rank_][chsq.file_].piece_=cb16_23.sq_[chsq.rank_][chsq.file_].piece_; cb16_23_1.sq_[chsq.rank_][chsq.file_].side_=cb16_23.sq_[chsq.rank_][chsq.file_].side_; cb16_23_1.sq_[chsq1.rank_][chsq1.file_].piece_=cb16_23.sq_[chsq1.rank_][chsq1.file_].piece_; cb16_23_1.sq_[chsq1.rank_][chsq1.file_].side_=cb16_23.sq_[chsq1.rank_][chsq1.file_].side_; cb16_23_1.sq_[chsq.rank_][chsq1.file_].side_=cb16_23.sq_[chsq.rank_][chsq1.file_].side_; cb16_23_1.sq_[chsq.rank_][chsq1.file_].piece_=cb16_23.sq_[chsq.rank_][chsq1.file_].piece_; } public void SupplementalAddACLCAttacker() { } public boolean FindEmptySquareMoves(Graphics g, Chsq chsq,int WhoWantsToKnow){ found_a_drop_for_this_one=false; TotalMaybeBoard(NowBoard,MaybeBoard); MaybeBoard.sq_[chsq.rank_][chsq.file_].piece_=74; MaybeBoard.sq_[chsq.rank_][chsq.file_].side_=3; x_sto=1;while (x_sto<15){ y_sto=1;while (y_sto<15){ if (MaybeBoard.sq_[y_sto][x_sto].piece_==74){ if (can_make_here(y_sto,x_sto)==true){ MaybeBoard.sq_[y_sto][x_sto].piece_=0; MaybeBoard.sq_[y_sto][x_sto].side_=0; if (IsMySideInCheck(WhoWantsToKnow)==false) { drop_places_count++;found_a_drop_for_this_one=true; MaybeEmptySquareMoves[drop_places_count].rankfrom=chsq.rank_; MaybeEmptySquareMoves[drop_places_count].filefrom=chsq.file_; MaybeEmptySquareMoves[drop_places_count].rankto=y_sto; MaybeEmptySquareMoves[drop_places_count].fileto=x_sto; } MaybeBoard.sq_[y_sto][x_sto].piece_=74; MaybeBoard.sq_[y_sto][x_sto].side_=3; }} y_sto++;}x_sto++;} TotalMaybeBoard(NowBoard,MaybeBoard); return found_a_drop_for_this_one; } public void whatpiecescanmove(Graphics g) { drop_places_count=0; for(ee=1; ee <23; ee++) for(ff=1; ff <15; 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; } if ( ((stochastic_chess==true)|(schach_plus==true)) &&(dark_squares_unplaced[whoseMove]==0) &&(light_squares_unplaced[whoseMove]==0) &&(men_unplaced[whoseMove]==0) &&(NowBoard.sq_[ff][ee].piece_==0)&&(ee<15)) { icanmove[ff][ee]=FindEmptySquareMoves(g, NowBoard.sq_[ff][ee], whoseMove); } if ( ((stochastic_chess==true)|(schach_plus==true)) &&(ee<15)&&(NowBoard.sq_[ff][ee].piece_==74)&&((turncounter!=24)|(KingFile[whoseMove]<10))) { if (can_make_here(ff,ee)==true) { if ( ((ff+ee)%2==0) && (dark_squares_unplaced[whoseMove]>0) | ((ff+ee)%2==1) && (light_squares_unplaced[whoseMove]>0) ) { TotalMaybeBoard(NowBoard,MaybeBoard); MaybeBoard.sq_[ff][ee].piece_=0;MaybeBoard.sq_[ff][ee].side_=0; if (IsMySideInCheck(whoseMove)==false) { icanmove[ff][ee]=true; drop_places_count++; drop_here[drop_places_count].rank_=ff; drop_here[drop_places_count].file_=ee; } MaybeBoard.sq_[ff][ee].piece_=74;MaybeBoard.sq_[ff][ee].side_=3; } } } } DrawNowBoard(g); } static String variant_name; int term_counts[]; static boolean accepted_terms; static int who_is_winning; static int how_deep_to_seek; public static long millipede1; public static long millipede2; static int gametreecounter; int best_four_count[]; static int vcom1; static int vcom2; static int vcom3; static int vcom4; static int bestvcom1; static int bestvcom2; static int bestvcom3; static int bestvcom4; static boolean skipDtGM; static boolean worried; Chmo MaybeMoves[]; Stomo MaybeEmptySquareMoves[]; static int forked_royalty; static int forked_rookage; static int forked_pieceage; static int fork_c; static int fork_d; int undef_enemy_pawn_most_advanced_file[]; int undef_enemy_pawn_most_advanced_rank[]; int undef_enemy_pawn_nearest_king_file[]; int undef_enemy_pawn_nearest_king_rank[]; int distance_to_edible_pawn[]; static int pawnowner; static int strategos; static int BishopColor[][]=new int[7][2]; Color niceblue; static boolean one_of_my_pieces_can_move; boolean my_pawn_on_this_file[][]; 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 PawnCount[]; int KingFile[]; int KingRank[]; int KnightCount[]; int BishopCount[]; int RookCount[]; int QueenCount[]; int KingCount[]; int Attackers[][][]; int StrongestAttacker[][][]; int WeakestAttacker[][][]; int CLCAttackers[][][]; CB16_23 NowBoard; CB16_23 BackBoard; CB16_23 SaveBoard; CB16_23 MaybeBoard; CB16_23 OneBoard; CB16_23 TwoBoard; CB16_23 ThreeBoard; CB16_23 FourBoard; boolean icanmove[][]; Chsq happySquare; CB16_23 ArchiveBoard[]; 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 int mover_rank; static int mover_file; static int moveto_rank; static int moveto_file; static int queening_rank; static int queening_file; Font f1; Font f2; Font f3; static int drawn_games; static int fifty_move_rule; static int whoseMove; boolean WhoIsHuman[]; int wins[]; static String stringy; static boolean halt_if_king_taken; static boolean stochastic_chess; static boolean i_just_made_a_square; int light_squares_unplaced[]; int dark_squares_unplaced[]; int men_unplaced[]; Chsq drop_here[]; int drop_places_count; int x_sto; int y_sto; static boolean found_a_drop_for_this_one; int empty_is_moving_for; static boolean picking_up_and_putting_down; static int chex; static int human_chosen_rank; static int human_chosen_file; static boolean schach_plus; static boolean tile_chess; static Color scotchpurple = new Color(128, 0, 255); static int x_chex; static int y_chex; boolean connected[][]; static boolean found_first_unit; static boolean found_a_connection; static int number_of_players; static int pawns_per_side; static Color darkgreeen = new Color(0, 192, 0); static int last_player; static int screen_color; static int loser_color; static boolean making_rules; static int winner; static int pieces_per_side; static boolean seek_sacrificial_wins; static char oopsKey; static char loadKey; static char saveKey; static int who_backed; static int who_saved;static int when_saved; }