domain

package
v0.0.0-...-92e9287 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CELL_BOMB     = "X"
	CELL_EMPTY    = "-"
	CELL_REVEALED = "O"

	CELL_BOMB_HIDED = "-"
)
View Source
const (
	GAME_STATE_WON  = "won"
	GAME_STATE_LOST = "lost"
	GAME_STATE_NEW  = "new"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Board

type Board [][]string

func NewBoard

func NewBoard(size uint, bombs uint) Board

func NewEmptyBoard

func NewEmptyBoard(size uint) Board

func (Board) Contains

func (board Board) Contains(row uint, col uint, element string) bool

func (Board) FillWithBombs

func (board Board) FillWithBombs(bombs uint)

func (Board) HasEmptyCells

func (board Board) HasEmptyCells() bool

func (Board) HideBombs

func (board Board) HideBombs() Board

func (Board) IsValidPosition

func (board Board) IsValidPosition(row uint, col uint) bool

func (Board) Set

func (board Board) Set(row uint, col uint, element string)

type BoardSettings

type BoardSettings struct {
	Size  uint `json:"size"`
	Bombs uint `json:"bombs"`
}

type Game

type Game struct {
	ID            string        `json:"id"`
	Name          string        `json:"name"`
	State         string        `json:"state"`
	BoardSettings BoardSettings `json:"board_settings"`
	Board         Board         `json:"board"`
}

func NewGame

func NewGame(id string, name string, size uint, bombs uint) Game

func (*Game) IsOver

func (game *Game) IsOver() bool

Jump to

Keyboard shortcuts

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