예제 #1
0
 public bool pieceClick(int column, int row)
 {
     if (getPlayer() != board.getPlayer())
     {
         return(false);
     }
     //MessageBox.Show(board.toJson());
     if (!board.getGameStatus())//If game over ignore anything
     {
         return(false);
     }
     //In console, row: 1-9,column: a-i
     if (board.getSelectedX() == -1)//If not selected, select
     {
         board.boolSelectPiece(intArrtoStr(column, row));
     }
     else
     {
         if (board.boolMovePiece(intArrtoStr(column, row)))//If move success, change the player
         {
             board.SwitchPlayer();
             if (board.getSelectedX() != column || board.getSelectedY() != row)
             {
                 updateJson();
             }
         }
     }
     return(true);
 }
예제 #2
0
 public virtual bool pieceClick(int column, int row)
 {
     //MessageBox.Show(board.toJson());
     if (!board.getGameStatus())//If game over ignore anything
     {
         return(false);
     }
     //In console, row: 1-9,column: a-i
     if (board.getSelectedX() == -1)//If not selected, select
     {
         board.boolSelectPiece(intArrtoStr(column, row));
     }
     else
     {
         if (board.boolMovePiece(intArrtoStr(column, row)))//If move success, change the player
         {
             Console.WriteLine(board.outputFENFile(board));
             board.SwitchPlayer();
             boardHistory.Add(board.toJson());
         }
     }
     return(true);
 }