Documentation
¶
Index ¶
- Constants
- Variables
- func DecodeIntFromBase64(s string) (int64, error)
- func DecodeStringToInt(s string) (int64, error)
- func EncodeIntToBase64(v int64) string
- func EncodeIntToString(v int64) string
- func VerifyBoardTranscript(b Board, t Transcript) error
- type Address
- type Board
- func (b Board) DisksCount() int
- func (b Board) DrawBoard(black, white, possibleMove string, colSeparator, rowSeparator string) string
- func (b Board) DrawBoardAsEmoji(black, white, possibleMove string) string
- func (b Board) DrawBoardAsText(possibleMove string) string
- func (b Board) IsCompleted() bool
- func (b Board) IsEmpty() bool
- func (b Board) MakeMove(player Disk, a Address) (board Board, err error)
- func (b Board) NextPlayer() Disk
- func (b Board) Rows(black, white, possibleMove, empty string) (rows [8][8]string)
- func (b Board) Score(player Disk) int
- func (b Board) Scores() (black, white int)
- func (b Board) ToBase64() string
- func (b Board) ToBytes() []byte
- func (b Board) Turns() int
- func (b Board) UndoMove(a, prevMove Address) (board Board)
- type Disk
- type Disks
- type Mode
- type Move
- type SimpleAI
- type Transcript
Constants ¶
View Source
const ( BoardSize = 8 BoardCellsCount = BoardSize * BoardSize )
Variables ¶
View Source
var EmptyAddress = Address{-127, -127}
View Source
var ErrAlreadyOccupied = errors.New("cell already occupied")
View Source
var ErrNotOccupied = errors.New("cell is not occupied")
View Source
var ErrNotValidMove = errors.New("not valid move")
View Source
var ErrNotValidTranscript = errors.New("not valid transcript")
View Source
var OthelloBoard = Board{ Last: Address{4, 4}, Blacks: (1 << (3*8 + 4)) | (1 << (4*8 + 3)), Whites: (1 << (3*8 + 3)) | (1 << (4*8 + 4)), }
Functions ¶
func DecodeIntFromBase64 ¶
func DecodeStringToInt ¶
func EncodeIntToBase64 ¶
func EncodeIntToString ¶
func VerifyBoardTranscript ¶
func VerifyBoardTranscript(b Board, t Transcript) error
Types ¶
type Address ¶
type Address struct {
X, Y int8
}
func CellAddressToRevAddress ¶
func CellAddressToRevAddress(ca turnbased.CellAddress) Address
func (Address) ToCellAddress ¶
func (a Address) ToCellAddress() turnbased.CellAddress
type Board ¶
func NewBoardFromBase64 ¶
func NewBoardFromBytes ¶
func (Board) DisksCount ¶
func (Board) DrawBoardAsEmoji ¶
func (Board) DrawBoardAsText ¶
func (Board) IsCompleted ¶
func (Board) NextPlayer ¶
type Mode ¶
type Mode string
const ( SinglePlayer Mode = "s" // WithAI Mode = "ai" MultiPlayer = "m" )
type Transcript ¶
type Transcript []byte
func AddMove ¶
func AddMove(transcript Transcript, backSteps int, a Address) (Transcript, int)
func EmptyTranscript ¶
func EmptyTranscript() Transcript
func NewTranscript ¶
func NewTranscript(s string) (transcript Transcript)
func NewTranscriptFromHumanReadable ¶
func NewTranscriptFromHumanReadable(s string) (transcript Transcript)
func (Transcript) Equal ¶
func (t Transcript) Equal(t2 Transcript) bool
func (Transcript) LastMove ¶
func (t Transcript) LastMove() Move
func (Transcript) NextMove ¶
func (t Transcript) NextMove() (Move, Transcript)
func (Transcript) Pop ¶
func (t Transcript) Pop() (Move, Transcript)
func (Transcript) String ¶
func (t Transcript) String() string
func (Transcript) ToBase64 ¶
func (t Transcript) ToBase64() string
Click to show internal directories.
Click to hide internal directories.