mirror of
https://github.com/maaslalani/gambit.git
synced 2025-01-16 02:33:26 +02:00
27 lines
1.3 KiB
Go
27 lines
1.3 KiB
Go
package board
|
|
|
|
import (
|
|
"github.com/maaslalani/gambit/piece"
|
|
)
|
|
|
|
type Board struct {
|
|
// The board is represented as a 2D array of cells.
|
|
// The first index is the row, the second is the column.
|
|
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}
|
|
}
|