1
0
mirror of https://github.com/maaslalani/gambit.git synced 2024-12-30 21:19:52 +02:00

refactor: remove players

This commit is contained in:
Maas Lalani 2021-11-27 14:51:50 -05:00
parent 17ed9f5096
commit 82c54e7919
No known key found for this signature in database
GPG Key ID: F53774FA051C052A
3 changed files with 6 additions and 17 deletions

View File

@ -22,7 +22,7 @@ const (
)
type Board struct {
Players []Player
Pieces []*Piece
Grid [dimensions][dimensions]*Piece
flipped bool
}
@ -42,11 +42,9 @@ func (b *Board) Move(from, to position) {
}
func (b *Board) Draw() {
for _, player := range b.Players {
for _, piece := range player.Pieces {
p := piece
b.Grid[piece.Position[0]-1][piece.Position[1]-1] = p
}
for _, piece := range b.Pieces {
p := piece
b.Grid[piece.Position[0]-1][piece.Position[1]-1] = p
}
}

View File

@ -9,10 +9,8 @@ import (
func main() {
m := model{}
m.Board.Players = []Player{
{Pieces: BlackPieces()},
{Pieces: WhitePieces()},
}
m.Board.Pieces = append(m.Board.Pieces, WhitePieces()...)
m.Board.Pieces = append(m.Board.Pieces, BlackPieces()...)
p := tea.NewProgram(m, tea.WithMouseAllMotion())
if err := p.Start(); err != nil {
log.Fatal(err)

View File

@ -1,7 +0,0 @@
package main
type Player struct {
Points int
Pieces []*Piece
Captured []*Piece
}