| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- package game
- import "github.com/gdamore/tcell/v3"
- // Directions for movement and actions
- const (
- up = iota
- left
- right
- down
- upleft
- upright
- downleft
- downright
- action
- rotateleft
- rotateright
- )
- const (
- updown = 1
- leftright = 2
- )
- // Styles holds the different styles for the game elements
- type Styles struct {
- text tcell.Style
- sea tcell.Style
- ship tcell.Style
- miss tcell.Style
- hit tcell.Style
- incorrect tcell.Style
- }
- // board stores the different boards, both water and ships.
- type board [][]int
- // Collection of ships
- type ships [][]string
- // Collection of ships
- type pieces struct {
- name string
- length int
- abreviation string
- }
- // Game holds the state of the game
- type Game struct {
- screen tcell.Screen
- style Styles
- keypresses chan int
- score int
- leftBoard board
- leftShips ships
- rightBoard board
- rightShips ships
- shipsets []pieces
- gameover int
- stats_score int
- stats_miss int
- stats_hits int
- logs []string
- }
|