model

package
v0.0.0-...-cdb0739 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2015 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDoubleShot = errors.New("Already shoot there")
)

Functions

This section is empty.

Types

type Board

type Board struct {
	Board [][]State
	// contains filtered or unexported fields
}

func NewBoard

func NewBoard(h, w int, hidden bool) *Board

func (*Board) GenerateShips

func (b *Board) GenerateShips() error

func (Board) HasShipsAlive

func (b Board) HasShipsAlive() bool

func (Board) Height

func (b Board) Height() int

func (*Board) Shoot

func (b *Board) Shoot(y, x int) error

func (Board) StateOf

func (b Board) StateOf(y, x int) (st State)

func (Board) String

func (b Board) String() (repr string)

func (Board) Width

func (b Board) Width() int

type Result

type Result int
const (
	Continue Result = iota
	Win
	Loose
)

func (Result) String

func (r Result) String() (repr string)

type State

type State int
const (
	Sea State = iota
	Ship
	Shot
	Injured
	Killed
)

func (State) Shooted

func (s State) Shooted() bool

func (State) String

func (s State) String() string

Jump to

Keyboard shortcuts

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