Method | Description | |
---|---|---|
GetBoardFromString ( string boardString ) : ].SquareTypes[ |
Takes a string description of a game board and returns the board array. A valid board example is: X|O|X |X| O|X|O Note that there should be a space in blank squares.
|
|
GetRandomBoard ( int moves ) : ].SquareTypes[ |
Gets a random game board played for a specified number of moves.
|
|
GetWinner ( ) : SquareTypes |
Gets the winner of the current game.
|
|
GetWinner ( SquareTypes Board ) : SquareTypes |
Gets the winner based on the specified board.
|
|
IsEmpty ( int x, int y ) : bool |
Checks if the square located at [x,y] on the game board is empty.
|
|
PlayGameToEnd ( IPlayer xPlayer, IPlayer oPlayer ) : SquareTypes |
A helper method for competing two players against each other.
|
|
ResetGame ( ) : void |
Resets the current game by clearing the game board.
|
|
TicTacToeGame ( ) : System |
Method | Description | |
---|---|---|
getSquareType ( string squareString ) : SquareTypes |
public static GetBoardFromString ( string boardString ) : ].SquareTypes[ | ||
boardString | string | |
return | ].SquareTypes[ |
public static GetRandomBoard ( int moves ) : ].SquareTypes[ | ||
moves | int | |
return | ].SquareTypes[ |
public static GetWinner ( SquareTypes Board ) : SquareTypes | ||
Board | SquareTypes | |
return | SquareTypes |
public static PlayGameToEnd ( IPlayer xPlayer, IPlayer oPlayer ) : SquareTypes | ||
xPlayer | IPlayer | The player to act first. |
oPlayer | IPlayer | The player to act second. |
return | SquareTypes |