C# Класс TicTacToeLib.TicTacToeGame

A simple game of Tic-Tac-Toe.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
getSquareType ( string squareString ) : SquareTypes

Описание методов

GetBoardFromString() публичный статический Метод

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.
public static GetBoardFromString ( string boardString ) : ].SquareTypes[
boardString string
Результат ].SquareTypes[

GetRandomBoard() публичный статический Метод

Gets a random game board played for a specified number of moves.
public static GetRandomBoard ( int moves ) : ].SquareTypes[
moves int
Результат ].SquareTypes[

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

Gets the winner of the current game.
public GetWinner ( ) : SquareTypes
Результат SquareTypes

GetWinner() публичный статический Метод

Gets the winner based on the specified board.
public static GetWinner ( SquareTypes Board ) : SquareTypes
Board SquareTypes
Результат SquareTypes

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

Checks if the square located at [x,y] on the game board is empty.
public IsEmpty ( int x, int y ) : bool
x int
y int
Результат bool

PlayGameToEnd() публичный статический Метод

A helper method for competing two players against each other.
public static PlayGameToEnd ( IPlayer xPlayer, IPlayer oPlayer ) : SquareTypes
xPlayer IPlayer The player to act first.
oPlayer IPlayer The player to act second.
Результат SquareTypes

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

Resets the current game by clearing the game board.
public ResetGame ( ) : void
Результат void

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

public TicTacToeGame ( ) : System
Результат System