2021-12-21 17:57:16 -05:00
|
|
|
package board
|
|
|
|
|
2021-12-21 22:33:54 -05:00
|
|
|
import (
|
|
|
|
"github.com/maaslalani/gambit/piece"
|
|
|
|
)
|
2021-12-21 17:57:16 -05: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-21 22:33:54 -05:00
|
|
|
grid [8][8]piece.Piece
|
|
|
|
reversed bool
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewBoard() Board {
|
|
|
|
grid := [8][8]piece.Piece{
|
|
|
|
{piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty()},
|
|
|
|
{piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty()},
|
|
|
|
{piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty()},
|
|
|
|
{piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty()},
|
|
|
|
{piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty()},
|
|
|
|
{piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty()},
|
|
|
|
{piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty()},
|
|
|
|
{piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty(), piece.Empty()},
|
|
|
|
}
|
|
|
|
return Board{grid: grid}
|
2021-12-21 17:57:16 -05:00
|
|
|
}
|