lineThroughBoard() public method

public lineThroughBoard ( ) : bool
return bool
Esempio n. 1
0
        public override bool terminalTest(GameState state)
        {
            TicTacToeBoard board  = (TicTacToeBoard)state.get("board");
            bool           line   = board.lineThroughBoard();
            bool           filled = board.getNumberOfMarkedPositions() == 9;

            return(line || filled);
        }
Esempio n. 2
0
        //
        // PRIVATE METHODS
        //
        private int computeUtility(TicTacToeBoard aBoard, String playerToMove)
        {
            int retVal = 0;

            if (aBoard.lineThroughBoard())
            {
                if (playerToMove.Equals("X"))
                {
                    retVal = -1;
                }
                else
                {
                    retVal = 1;
                }
            }
            return(retVal);
        }
Esempio n. 3
0
	//
	// PRIVATE METHODS
	//
	private int computeUtility(TicTacToeBoard aBoard, String playerToMove) {
		int retVal = 0;
		if (aBoard.lineThroughBoard()) {
			if (playerToMove.Equals("X")) {
				retVal = -1;
			} else {
				retVal = 1;
			}

		}
		return retVal;
	}