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

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

public getMove ( GameState state, int x, int y ) : GameState
state AIMA.Core.Search.Adversarial.GameState
x int
y int
Результат AIMA.Core.Search.Adversarial.GameState
	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;
	}