Documentation ¶
Overview ¶
Package tictactoe is a Tic-Tac-Toe game engine.
Index ¶
Constants ¶
View Source
const ( //SIZE is the size of the board SIZE = 3 //X represents player X X = 'x' //O represents player O O = 'o' )
Variables ¶
View Source
var ( //ErrGameNotOver error ErrGameNotOver = errors.New("Game is not finished") //ErrInvalidMove error ErrInvalidMove = errors.New("Move is invalid") )
Functions ¶
This section is empty.
Types ¶
type Game ¶
type Game struct {
// contains filtered or unexported fields
}
Game represents the current game state.
func (Game) ApplyAction ¶
ApplyAction takes a Move and applies the action to the current game state.
Returns the new game state and an error if any occurred.
func (Game) GetActions ¶
GetActions returns a list of moves that can be made by the current player.
func (Game) IsTerminal ¶
IsTerminal returns whether the game is finished or not.
Click to show internal directories.
Click to hide internal directories.