game

package
v0.0.0-...-ddaa528 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PlayerChar = []string{"\\//\\", "/\\\\/"}

PlayerChar defines how should each player entries rendered

Functions

This section is empty.

Types

type Game

type Game struct {
	State         [][]int
	CurrentPlayer int
	Width         int
	Height        int

	Winner int

	Cancel        context.CancelFunc
	PlayerOneWins int
	PlayerTwoWins int
	// contains filtered or unexported fields
}

Game defines the state of the game and arena details

func NewGame

func NewGame(width, height, playerOneWins, playerTwoWins int) *Game

NewGame return a new instance of game

func (*Game) Draw

func (g *Game) Draw()

Draw is the main routine which paints the current state

func (*Game) Input

func (g *Game) Input(col int)

Input adds an input to game

func (*Game) SplashScreen

func (g *Game) SplashScreen()

SplashScreen will render splash screen animation

func (*Game) StateString

func (g *Game) StateString() string

func (*Game) WriteState

func (g *Game) WriteState(w io.Writer)

type Manager

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

func NewManager

func NewManager() *Manager

func (*Manager) NewGame

func (m *Manager) NewGame(game *Game) *Game

NewGame instantiates a new game using the current count of previous wins.

Jump to

Keyboard shortcuts

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