Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFirstPlayer ¶
Types ¶
type Board ¶
func (*Board) GetValidMoves ¶
type BoardToPlay ¶
type BoardToPlay interface {
PlayMove(int, string)
GetValidMoves() []int
Winner(string) bool
GameOver() bool
WhoseTurn() string
Print()
Clone() Board
}
Interface for Player and ComputerPlayer to take to represent a Board
type ComputerPlayer ¶
type ComputerPlayer struct {
// Simple AI for tic-tac-toe. Uses the minimax algorithm to choose moves
Symbol string
Board BoardToPlay
NextMove int
}
func NewComputer ¶
func NewComputer(board BoardToPlay) *ComputerPlayer
func (*ComputerPlayer) ComputerMove ¶
func (c *ComputerPlayer) ComputerMove()
type Player ¶
type Player struct {
// Struct for the player. Lets the player play a move and that is it.
Symbol string
Board BoardToPlay
}
func NewPlayer ¶
func NewPlayer(board BoardToPlay) *Player
func (*Player) PlayerMove ¶
Click to show internal directories.
Click to hide internal directories.