othello

package
v0.0.0-...-e8f802b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoardToString

func BoardToString(board *[8][8]Tile) string

func ClearLegalMoves

func ClearLegalMoves(board *[8][8]Tile, legalMoves []Move)

func EndOfTurn

func EndOfTurn(board *[8][8]Tile, legalMoves []Move, currentPlayer Tile) ([]Move, Tile, bool)

func GetStartingBoard

func GetStartingBoard() *[8][8]Tile

func PlaceTile

func PlaceTile(move Move, board *[8][8]Tile, currentPlayer Tile)

PlaceTile changes state of Tile of board at move to currentPlayer, and calls flipWalk to "flip" all opposite Tiles to the state of currentPlayer, in accordance with the game rules (https://wikipedia.org/wiki/Reversi#Rules).

func PlayerString

func PlayerString(player Tile) string

func PropagateLegalMoves

func PropagateLegalMoves(board *[8][8]Tile, legalMoves []Move)

Types

type Move

type Move struct {
	// contains filtered or unexported fields
}

func CalcLegalMoves

func CalcLegalMoves(board *[8][8]Tile, currentPlayer Tile) []Move

Need to document

type Tile

type Tile int
const (
	Empty Tile = iota
	Dark
	Light
	Legal
)

func CalcWinner

func CalcWinner(board *[8][8]Tile) Tile

CalcWinner counts the tiles of each colour on the board and determines who has the most pieces. Returns Empty if scores are the same, otherwise returns the color of the winner.

func OppositePlayer

func OppositePlayer(player Tile) Tile

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL