// 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: BombChss.java import java.applet.Applet; import java.awt.*; public class BombChss extends Pegasi { public BombChss() { } public void SomethingElseForTotalBackBoard() { backbeirut[yyy][xxx]=beirut[yyy][xxx]; back_icanbomboff=icanbomboff; } public void SomethingElseForTotalSaveBoard() { savebeirut[yyy][xxx]=beirut[yyy][xxx]; save_icanbomboff=icanbomboff; } public void SomethingElseForUnBackBoard() { beirut[yyy][xxx]=backbeirut[yyy][xxx]; icanbomboff=back_icanbomboff; } public void SomethingElseForLoadSavedBoard() { beirut[yyy][xxx]=savebeirut[yyy][xxx]; icanbomboff=save_icanbomboff; } public void SupplementalInit(){ beirut=new boolean[10][10]; backbeirut=new boolean[10][10]; savebeirut=new boolean[10][10]; } public void DisplayRules(Graphics g) { LowRectangle(g); g.drawString("The Queen's Rook moves as a king, and ", 5, 285); g.drawString("is carrying a bomb. Duncan Suttles, 1973.", 5, 301); } public void DrawNowBoard(Graphics g) { for(ee=1; ee < 9; ee++) for(ff=1; ff < 9; ff++) { super.NowBoard.sq_[ff][ee].drawchsq(g, 1, super.icanmove[ff][ee]); if(beirut[ff][ee]) super.NowBoard.sq_[ff][ee].drawredball(g, 308); } } public boolean IsTheGameOver() { if(GameOver) return true; CountAllThePieces(); if((super.QueenCount[1] == 0) & (super.QueenCount[2] == 0) & (super.RookCount[1] == 0) & (super.RookCount[2] == 0) & (super.PawnCount[1] == 0) & (super.PawnCount[2] == 0)) { for(ff=1; ff < 9; ff++) for(ee=1; ee < 9; ee++) if(beirut[ff][ee]) return false; if((super.BishopCount[1] == 0) & (super.BishopCount[2] == 0) & (super.KnightCount[1] < 3) & (super.KnightCount[2] < 3)) { GameOver=true; drawn_games++; ShowStatusQ("Lack of force"); return true; } if((super.BishopCount[1] < 2) & (super.BishopCount[2] < 2) & (super.KnightCount[1] == 0) & (super.KnightCount[2] == 0)) { GameOver=true; drawn_games++; ShowStatusQ("Lack of force"); return true; } if((super.BishopCount[1] + super.KnightCount[1] < 2) & (super.BishopCount[2] + super.KnightCount[2] < 2)) { GameOver=true; drawn_games++; ShowStatusQ("Lack of force"); return true; } } return false; } public boolean MachineMoves(Graphics g, int i) { if(icanbomboff && (super.NowBoard.sq_[beirut_y + 1][beirut_x].piece_ < 0) | (super.NowBoard.sq_[beirut_y + 1][beirut_x + 1].piece_ < 0) | (super.NowBoard.sq_[beirut_y][beirut_x + 1].piece_ < 0) | (super.NowBoard.sq_[beirut_y - 1][beirut_x + 1].piece_ < 0) | (super.NowBoard.sq_[beirut_y - 1][beirut_x].piece_ < 0) | (super.NowBoard.sq_[beirut_y - 1][beirut_x - 1].piece_ < 0) | (super.NowBoard.sq_[beirut_y][beirut_x - 1].piece_ < 0) | (super.NowBoard.sq_[beirut_y + 1][beirut_x - 1].piece_ < 0)) { super.NowBoard.sq_[beirut_y + 1][beirut_x].piece_=0; super.NowBoard.sq_[beirut_y + 1][beirut_x + 1].piece_=0; super.NowBoard.sq_[beirut_y][beirut_x + 1].piece_=0; super.NowBoard.sq_[beirut_y - 1][beirut_x + 1].piece_=0; super.NowBoard.sq_[beirut_y - 1][beirut_x].piece_=0; super.NowBoard.sq_[beirut_y - 1][beirut_x - 1].piece_=0; super.NowBoard.sq_[beirut_y][beirut_x - 1].piece_=0; super.NowBoard.sq_[beirut_y + 1][beirut_x - 1].piece_=0; super.NowBoard.sq_[beirut_y + 1][beirut_x].side_=0; super.NowBoard.sq_[beirut_y + 1][beirut_x + 1].side_=0; super.NowBoard.sq_[beirut_y][beirut_x + 1].side_=0; super.NowBoard.sq_[beirut_y - 1][beirut_x + 1].side_=0; super.NowBoard.sq_[beirut_y - 1][beirut_x].side_=0; super.NowBoard.sq_[beirut_y - 1][beirut_x - 1].side_=0; super.NowBoard.sq_[beirut_y][beirut_x - 1].side_=0; super.NowBoard.sq_[beirut_y + 1][beirut_x - 1].side_=0; DrawNowBoard(g); super.wins[whoseMove]++; GameOver=true; ShowStatusQ("Boom! I win!"); return true; } 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; UnTwoThePawns(i); moveCounter=0; if(!opening_library()) { gametreecounter=0; if(how_deep_to_seek > 3) depth=1; bestvcom1=-5000; for(super.x_run[1]=1; super.x_run[1] < 9; super.x_run[1]++) for(super.y_run[1]=1; super.y_run[1] < 9; super.y_run[1]++) if(super.NowBoard.sq_[super.y_run[1]][super.x_run[1]].side_ == i) findPieceMoves(g, super.NowBoard.sq_[super.y_run[1]][super.x_run[1]], super.NowBoard, super.MaybeBoard); depth=0; ShowStatusNothing(); ShowStatusNothing(); if(moveCounter == 0) { System.out.println("No Moves");WhoIsHuman[1]=true;WhoIsHuman[2]=true;ShowStatusQ("No Moves"); return false; } x=1 + (int)Math.floor(Math.random() * (double)moveCounter); if(super.Attackers[super.MaybeMoves[x].endingsquare_.rank_][super.MaybeMoves[x].endingsquare_.file_][3 - i] > super.Attackers[super.MaybeMoves[x].endingsquare_.rank_][super.MaybeMoves[x].endingsquare_.file_][i]) x=1 + (int)Math.floor(Math.random() * (double)moveCounter); if(super.Attackers[super.MaybeMoves[x].endingsquare_.rank_][super.MaybeMoves[x].endingsquare_.file_][3 - i] > super.Attackers[super.MaybeMoves[x].endingsquare_.rank_][super.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=super.MaybeMoves[x].endingsquare_.file_; moveto_rank=super.MaybeMoves[x].endingsquare_.rank_; mover_file=super.MaybeMoves[x].startingsquare_.file_; mover_rank=super.MaybeMoves[x].startingsquare_.rank_; RedCastleCheat(); } NormalMove(g); super.NowBoard.sq_[mover_rank][mover_file].drawchsq(g, 1, false); super.NowBoard.sq_[moveto_rank][moveto_file].drawchsq(g, 1, false); super.MaybeBoard.sq_[mover_rank][mover_file].side_=super.NowBoard.sq_[mover_rank][mover_file].side_; super.MaybeBoard.sq_[moveto_rank][moveto_file].side_=super.NowBoard.sq_[moveto_rank][moveto_file].side_; super.MaybeBoard.sq_[mover_rank][mover_file].piece_=super.NowBoard.sq_[mover_rank][mover_file].piece_; super.MaybeBoard.sq_[moveto_rank][moveto_file].piece_=super.NowBoard.sq_[moveto_rank][moveto_file].piece_; TotalMaybeBoard(NowBoard,MaybeBoard);DidICheckOrStalemate(g, i); if(GameOver) return true; if(fifty_move_rule>100) { fifty_move_rule=0; DrawNowBoard(g);ShowStatusQ("Fifty move rule!"); drawn_games++; GameOver=true; return false; } else { MachineMoveExtra(g, i); return true; } } public void MoreGoodMoves(Chsq chsq) { if((beirut[chsq.rank_][chsq.file_]) & (super.Attackers[super.d[depth]][super.c[depth]][3 - chsq.side_] == 1) & (super.Attackers[super.d[depth]][super.c[depth]][chsq.side_] > 0) & ((super.KingRank[3 - chsq.side_] - super.d[depth]) * (super.KingRank[3 - chsq.side_] - super.d[depth]) <= 1) & ((super.KingFile[3 - chsq.side_] - super.c[depth]) * (super.KingFile[3 - chsq.side_] - super.c[depth]) <= 1)) goodmove10=moveCounter; } public void AssignVariantName(){ variant_name="Bomb Chess"; } public void NextOrdinaryPlayer(Graphics g) { IsTheGameOver(); if(GameOver) { return; } else { failsafe(g); whoseMove=3 - whoseMove; if (whoseMove==1){turncounter++;} UnTwoThePawns(whoseMove); canibomboff(); if (WhoIsHuman[whoseMove]==true){SayWhoIsHuman(g);} whatpiecescanmove(g); TotalMaybeBoard(super.NowBoard, super.MaybeBoard); TotalMaybeBoard(super.MaybeBoard, super.TwoBoard); TotalMaybeBoard(super.TwoBoard, super.ThreeBoard); TotalMaybeBoard(super.ThreeBoard, super.FourBoard); GenerateAttackersArrays(); DrawNowBoard(g); return; } } public void NormalMoveExtra() { beirut[moveto_rank][moveto_file]=beirut[mover_rank][mover_file]; beirut[mover_rank][mover_file]=false; } public void NullifySomethingElse() { beirut=null; } public void SayWhoIsHuman(Graphics g) { if(PromotingAPawn) return; g.setColor(super.niceblue); g.fillRect(0, 271, 300, 94); g.setColor(Color.black); g.setFont(super.f1); g.setColor(super.niceblue); g.fillRect(0, 271, 300, 94); g.setColor(Color.black); g.setFont(super.f1); g.drawString("White:", 10, 290); g.drawString("Red:", 10, 310); g.drawString("Computer", 120, 290); g.drawString("Computer", 120, 310); g.drawString("Human", 60, 290); g.drawString("Human", 60, 310); g.setFont(f1);NameThisChessVariant(g); g.drawString("White " + super.wins[1] + " Red " + super.wins[2] + " Drawn " + drawn_games, 5, 346); switch(who_is_winning) { case 1: // '\001' g.drawString("White wins", 30, 330); break; case 2: // '\002' g.drawString("Red wins", 30, 330); break; case 3: // '\003' g.drawString("Draw", 30, 330); break; } if(who_is_winning > 0) g.drawString("Continue Game", 150, 330); if(who_is_winning > 0) { if(accepted_terms) { g.drawRect(26, 316, 67, 18); g.drawRect(27, 317, 65, 16); } if(!accepted_terms) { g.drawRect(147, 316, 95, 18); g.drawRect(148, 317, 93, 16); } } g.setFont(super.f2); if((icanbomboff) & (!humanizing)) g.drawString("BOOM!", 210, 300); g.setFont(super.f3); g.drawString("--Ed Friedlander", 235, 360); g.setFont(super.f2); if(humanizing) g.drawString("OKAY", 210, 300); g.setColor(Color.white); if(super.WhoIsHuman[1]) { g.drawRect(56, 276, 48, 18); g.drawRect(57, 277, 46, 16); } if(!super.WhoIsHuman[1]) { g.drawRect(117, 276, 61, 18); g.drawRect(118, 277, 59, 16); } g.setColor(Color.red); if(super.WhoIsHuman[2]) { g.drawRect(56, 296, 48, 18); g.drawRect(57, 297, 46, 16); } if(!super.WhoIsHuman[2]) { g.drawRect(117, 296, 61, 18); g.drawRect(118, 297, 59, 16); } SaySomethingElseAboutWhoIsHuman(g); } public void SupplementalStartup() { super.WhoIsHuman[2]=false; for(ee=1; ee < 9; ee++) for(ff=1; ff < 9; ff++) beirut[ff][ee]=false; beirut[1][1]=true; beirut[8][1]=true; super.NowBoard.sq_[1][1].piece_=25; super.NowBoard.sq_[8][1].piece_=25; canibomboff(); } public void canibomboff() { icanbomboff=false; for(ff=1; ff < 9; ff++) for(ee=1; ee < 9; ee++) if((beirut[ff][ee]) & (super.NowBoard.sq_[ff][ee].side_ == whoseMove)) { icanbomboff=true; if((super.NowBoard.sq_[ff + 1][ee].piece_ < 0) & (super.NowBoard.sq_[ff + 1][ee].side_ == whoseMove)) icanbomboff=false; if((super.NowBoard.sq_[ff + 1][ee + 1].piece_ < 0) & (super.NowBoard.sq_[ff + 1][ee + 1].side_ == whoseMove)) icanbomboff=false; if((super.NowBoard.sq_[ff][ee + 1].piece_ < 0) & (super.NowBoard.sq_[ff][ee + 1].side_ == whoseMove)) icanbomboff=false; if((super.NowBoard.sq_[ff - 1][ee + 1].piece_ < 0) & (super.NowBoard.sq_[ff - 1][ee + 1].side_ == whoseMove)) icanbomboff=false; if((super.NowBoard.sq_[ff - 1][ee].piece_ < 0) & (super.NowBoard.sq_[ff - 1][ee].side_ == whoseMove)) icanbomboff=false; if((super.NowBoard.sq_[ff - 1][ee - 1].piece_ < 0) & (super.NowBoard.sq_[ff - 1][ee - 1].side_ == whoseMove)) icanbomboff=false; if((super.NowBoard.sq_[ff][ee - 1].piece_ < 0) & (super.NowBoard.sq_[ff][ee - 1].side_ == whoseMove)) icanbomboff=false; if((super.NowBoard.sq_[ff + 1][ee - 1].piece_ < 0) & (super.NowBoard.sq_[ff + 1][ee - 1].side_ == whoseMove)) icanbomboff=false; beirut_x=ee; beirut_y=ff; } if(icanbomboff) { TotalMaybeBoard(super.NowBoard, super.MaybeBoard); TotalMaybeBoard(super.MaybeBoard, super.TwoBoard); TotalMaybeBoard(super.TwoBoard, super.ThreeBoard); TotalMaybeBoard(super.ThreeBoard, super.FourBoard); for(ee=beirut_x - 1; ee <= beirut_x + 1; ee++) for(ff=beirut_y - 1; ff <= beirut_y + 1; ff++) { super.MaybeBoard.sq_[ff][ee].piece_=0; super.MaybeBoard.sq_[ff][ee].side_=0; } if(IsMySideInCheck(whoseMove)) icanbomboff=false; TotalMaybeBoard(super.NowBoard, super.MaybeBoard); TotalMaybeBoard(super.MaybeBoard, super.TwoBoard); TotalMaybeBoard(super.TwoBoard, super.ThreeBoard); TotalMaybeBoard(super.ThreeBoard, super.FourBoard); } } public boolean mouseDown(Event event, int i, int j) { if(super.NowBoard == null) return true; Graphics g=getGraphics(); ShowStatusNothing(); if(j < 30) if((humanizing) | (PromotingAPawn)) { return true; } else { DisplayRules(g); return true; } if(!PromotingAPawn) SayWhoIsHuman(g); if(PromotingAPawn) DrawPromotionOptions(g); if(GameOver) { GameOver=false; StartUp(g); repaint(); return true; } a=i / 30; b=9 - j / 30; if((i >= 210) & (j >= 285) & (i < 270) & (j < 320) & (icanbomboff) & (!humanizing)) { TotalMaybeBoard(super.NowBoard, super.MaybeBoard); TotalMaybeBoard(super.MaybeBoard, super.TwoBoard); TotalMaybeBoard(super.TwoBoard, super.ThreeBoard); TotalMaybeBoard(super.ThreeBoard, super.FourBoard); for(ff=beirut_y - 1; ff <= beirut_y + 1; ff++) for(ee=beirut_x - 1; ee <= beirut_x + 1; ee++) { if(super.NowBoard.sq_[ff][ee].piece_ < 0) { if(whoseMove == 1) ShowStatusQ("White wins!"); if(whoseMove == 2) ShowStatusQ("Red wins!"); } super.NowBoard.sq_[ff][ee].piece_=0; super.NowBoard.sq_[ff][ee].side_=0; } beirut[beirut_y][beirut_x]=false; NextOrdinaryPlayer(g); TotalMaybeBoard(super.NowBoard, super.MaybeBoard); TotalMaybeBoard(super.MaybeBoard, super.TwoBoard); TotalMaybeBoard(super.TwoBoard, super.ThreeBoard); TotalMaybeBoard(super.ThreeBoard, super.FourBoard); if(super.WhoIsHuman[whoseMove]) { markingAPiece=true; return true; } } if(PromotingAPawn) { if(!PromotionClicks(i, j)) return true; super.NowBoard.sq_[queening_rank][queening_file].piece_=xxx; super.MaybeBoard.sq_[queening_rank][queening_file].piece_=xxx; super.NowBoard.sq_[queening_rank][queening_file].drawchsq(g, 1, false); TotalMaybeBoard(NowBoard,MaybeBoard);DidICheckOrStalemate(g, whoseMove); PromotingAPawn=false; if (WhoIsHuman[whoseMove]==true){SayWhoIsHuman(g);} NextOrdinaryPlayer(g); if(super.WhoIsHuman[whoseMove]) { markingAPiece=true; return true; } } UnTwoThePawns(whoseMove); if(!PromotingAPawn) if((i >= 56) & (j >= 276) & (i <= 104) & (j <= 294)) { humanizing=true; super.WhoIsHuman[1]=true; SayWhoIsHuman(g); } else if((i >= 117) & (j >= 276) & (i <= 178) & (j <= 294)) { humanizing=true; super.WhoIsHuman[1]=false; SayWhoIsHuman(g); } else if((i >= 56) & (j >= 296) & (i <= 104) & (j <= 314)) { humanizing=true; super.WhoIsHuman[2]=true; SayWhoIsHuman(g); } else if((i >= 117) & (j >= 296) & (i <= 178) & (j <= 314)) { humanizing=true; super.WhoIsHuman[2]=false; SayWhoIsHuman(g); } else if((i >= 26) & (j > 316) & (i <= 93) & (j <= 334)) { if(who_is_winning == 0) return true; humanizing=true; accepted_terms=true; SayWhoIsHuman(g); } else if((i >= 147) & (j >= 316) & (i < 242) & (j < 334)) { if(who_is_winning == 0) return true; humanizing=true; accepted_terms=false; SayWhoIsHuman(g); } else if((i >= 210) & (j >= 285) & (i < 270) & (j < 320)) { humanizing=false; SayWhoIsHuman(g); if(accepted_terms) { if(who_is_winning != 0) GameOver=true; if(who_is_winning == 1) super.wins[1]++; if(who_is_winning == 2) super.wins[2]++; if(who_is_winning == 3) drawn_games++; if(who_is_winning != 0) { StartUp(g); repaint(); markingAPiece=true; return true; } } } if(humanizing) return true; if((a < 1) | (a > 8) | (b < 1) | (b > 8) && super.WhoIsHuman[whoseMove]) return true; if(super.WhoIsHuman[whoseMove]) if(markingAPiece) markAPiece(g, b, a); else if(HumanMoveAPiece(g, b, a)) { if(GameOver) return true; if(PromotingAPawn) return true; NextOrdinaryPlayer(g); } while((!super.WhoIsHuman[whoseMove]) & (!GameOver) & (!PromotingAPawn)) { MachineMoves(g, whoseMove); if(GameOver) return true; NextOrdinaryPlayer(g); UnTwoThePawns(whoseMove); if(super.WhoIsHuman[whoseMove]) markingAPiece=true; } return true; } public boolean opening_library() { return false; } boolean beirut[][]; boolean backbeirut[][]; boolean savebeirut[][]; static boolean icanbomboff; static boolean back_icanbomboff; static boolean save_icanbomboff; static int beirut_x; static int beirut_y; }