2021-12-22 00:57:16 +02:00
|
|
|
package board
|
|
|
|
|
2021-12-22 05:33:54 +02:00
|
|
|
import (
|
|
|
|
"github.com/maaslalani/gambit/piece"
|
|
|
|
)
|
2021-12-22 00:57:16 +02:00
|
|
|
|
|
|
|
type Board struct {
|
|
|
|
// The board is represented as a 2D array of cells.
|
|
|
|
// The first index is the row, the second is the column.
|
2021-12-22 08:30:33 +02:00
|
|
|
Grid [8][8]piece.Piece
|
2021-12-22 05:33:54 +02:00
|
|
|
reversed bool
|
2021-12-22 08:30:33 +02:00
|
|
|
Turn piece.Color
|
2021-12-22 05:33:54 +02:00
|
|
|
}
|
|
|
|
|
2021-12-22 07:17:50 +02:00
|
|
|
func New() Board {
|
2021-12-22 07:21:14 +02:00
|
|
|
ep := piece.Empty()
|
|
|
|
er := [8]piece.Piece{ep, ep, ep, ep, ep, ep, ep, ep}
|
2021-12-22 08:30:33 +02:00
|
|
|
return Board{
|
|
|
|
Grid: [8][8]piece.Piece{er, er, er, er, er, er, er, er},
|
|
|
|
Turn: piece.White,
|
|
|
|
}
|
2021-12-22 00:57:16 +02:00
|
|
|
}
|