AIMA.Core.Environment.TicTacToe.TicTacToeBoard.markX C# (CSharp) Метод

markX() публичный Метод

public markX ( int row, int col ) : void
row int
col int
Результат void
	public void markX(int row, int col) {
		mark(row, col, X);
	}

Usage Example

Пример #1
0
        public GameState getMove(GameState state, int x, int y)
        {
            GameState  retVal   = null;
            XYLocation loc      = new XYLocation(x, y);
            List       moves    = getMoves(state);
            List       newMoves = (List)moves.clone();

            if (moves.contains(loc))
            {
                int index = newMoves.indexOf(loc);
                newMoves.remove(index);

                retVal = new GameState();

                retVal.put("moves", newMoves);
                TicTacToeBoard newBoard = getBoard(state).cloneBoard();
                if (getPlayerToMove(state) == "X")
                {
                    newBoard.markX(x, y);
                    retVal.put("player", "O");
                }
                else
                {
                    newBoard.markO(x, y);
                    retVal.put("player", "X");
                }
                retVal.put("board", newBoard);
                retVal.put("utility", new int(computeUtility(newBoard,
                                                             getPlayerToMove(getState()))));
                retVal.put("level", new int(getLevel(state) + 1));
                // presentState = retVal;
            }
            return(retVal);
        }