connect4

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OutcomeNoOutcome     = 0
	OutcomePlayer1Win    = 1
	OutcomePlayer2Win    = 2
	OutcomePlayer1Resign = -1
	OutcomePlayer2Resign = -2
	OutcomeDraw          = 3

	Player1 = 1
	Player2 = 2
)

Variables

This section is empty.

Functions

func EncodeBoard

func EncodeBoard(w io.Writer, board [][]int, lastMovement int)

Types

type Game

type Game interface {
	SetPostID(pID string)
	Outcome() int
	GetTurnPlayer() string
	Move(movement int) error
	Resign(player int) error
	ToJSON() []byte
	GetMetadata() (string, string, string, string)
	EncodeBoard(w io.Writer)
	ValidMovements() []int
}

func GameFromJSON

func GameFromJSON(b []byte) (Game, error)

func NewGame

func NewGame(p1, p2, channelID string) Game

Jump to

Keyboard shortcuts

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