gungi_model

package
v0.0.0-...-66fd3a7 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: CC0-1.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BoardRows   = 9
	BoardCols   = 9
	BoardLevels = 3
)
View Source
const (
	White color = iota
	Black
)
View Source
const (
	Setup phase = iota
	Prepare
	Play
	End
)
View Source
const (
	Marshal           pieceType = iota // 帥
	General                            // 大
	LieutenantGeneral                  // 中
	MajorGeneral                       // 小
	Samurai                            // 侍
	Lancer                             // 槍
	Knight                             // 馬
	Spy                                // 忍
	Fortress                           // 砦
	Pawn                               // 兵
	Cannon                             // 砲
	Musketeer                          // 筒
	Archer                             // 弓
	Captain                            // 謀
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Board

type Board interface {
	Board() [9][9][3]Piece
	Get(loc Vector3D) Piece
	GetLocation(piece Piece) Vector3D
	Set(loc Vector3D, piece Piece)
	Take(piece Piece)
}

func NewBoard

func NewBoard() Board

type Color

type Color interface {
	Other() Color
	// contains filtered or unexported methods
}

func Colors

func Colors() []Color

Colors returns the colors of the game.

type Game

type Game interface {
	// Id returns the id of the game.
	Id() uint
	// SetId sets the id of the game.
	SetId(id uint)
	// Board returns the board of the game.
	Board() Board
	// Reserve returns the reserve of the game.
	Reserve(color Color) PieceArea
	// Discard returns the discard area of the game.
	Discard(color Color) PieceArea
	// Player returns the player of the game.
	Player(color Color) Player
	// Join adds a player to the game.
	Join(color Color, player Player) error
	// Leave removes a player from the game.
	Leave(player Player) error
	// CurrentTurn returns the color of the player whose turn it is.
	CurrentTurn() Color
	// SetCurrentTurn sets the color of the player whose turn it is.
	SetCurrentTurn(color Color)
	// Phase returns the current phase of the game.
	Phase() Phase
	// SetPhase sets the current phase of the game.
	SetPhase(phase Phase)
}

func NewGame

func NewGame() (g Game)

type Phase

type Phase interface {
	// contains filtered or unexported methods
}

type Piece

type Piece interface {
	// Id returns the id of the piece.
	Id() uint
	// Type returns the type of the piece.
	Type() PieceType
	// Color returns the color of the piece.
	Color() Color
}

func NewPiece

func NewPiece(id uint, pieceType PieceType, color Color) Piece

type PieceArea

type PieceArea interface {
	// Add adds a piece to the area.
	Add(piece Piece) error
	// Remove removes a piece from the area.
	Remove(piece Piece) error
	// Contains returns whether the area contains the piece.
	Contains(piece Piece) bool
	// Pieces returns the pieces in the area.
	Pieces() []Piece
}

func NewPieceArea

func NewPieceArea() PieceArea

type PieceType

type PieceType interface {
	// contains filtered or unexported methods
}

func PieceTypes

func PieceTypes() []PieceType

type Player

type Player interface {
	Id() uint
	SetId(id uint)
	Name() string
	SetName(name string)
}

func NewPlayer

func NewPlayer(name string) Player

type Vector2D

type Vector2D interface {
	X() int
	Y() int
}

func NewVector2D

func NewVector2D(x, y int) Vector2D

type Vector2DImpl

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

func (Vector2DImpl) X

func (v Vector2DImpl) X() int

func (Vector2DImpl) Y

func (v Vector2DImpl) Y() int

type Vector3D

type Vector3D interface {
	Vector2D
	Z() int
}

func NewVector3D

func NewVector3D(x, y, z int) Vector3D

type Vector3DImpl

type Vector3DImpl struct {
	Vector2DImpl
	// contains filtered or unexported fields
}

func (Vector3DImpl) Z

func (v Vector3DImpl) Z() int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳