示例#1
0
 protected static nPiece[] GetLine(nBoard board, int line, char XYD)
 {
     nPiece[] retValue = new nPiece[3];
     if (XYD == 'X')
     {
         retValue[0] = board[0, line];
         retValue[1] = board[1, line];
         retValue[2] = board[2, line];
     }
     else if (XYD == 'Y')
     {
         retValue[0] = board[line, 0];
         retValue[1] = board[line, 1];
         retValue[2] = board[line, 2];
     }
     else if (XYD == 'D')
     {
         if (line == 0)
         {
             retValue[0] = board[0, 0];
             retValue[1] = board[1, 1];
             retValue[2] = board[2, 2];
         }
         else if (line == 1)
         {
             retValue[0] = board[2, 0];
             retValue[1] = board[1, 1];
             retValue[2] = board[0, 2];
         }
     }
     return(retValue);
 }
示例#2
0
 public nBoard()
 {
     Tool.DoTicTacToeArray((x, y) =>
     {
         pieces[x, y]          = new nPiece();
         pieces[x, y].position = new nPoint(x, y);
         pieces[x, y].player   = Players.NULL;
         return(true);
     });
 }
示例#3
0
        public nBoard(nBoard board)
        {
            Tool.DoTicTacToeArray((x, y) =>
            {
                pieces[x, y]          = new nPiece();
                pieces[x, y].position = new nPoint(x, y);
                pieces[x, y].player   = board[x, y].player;


                lastPutPosition = new nPoint(board.lastPutPosition.x, board.lastPutPosition.y);
                return(true);
            });
        }