Commit b9a520f9 authored by Kevin Lyda's avatar Kevin Lyda 💬

Tests now pass.

parent 40a00da1
Pipeline #1344 passed with stage
in 36 seconds
......@@ -4,6 +4,7 @@ import (
"strings"
)
// Constants for the different board piece types.
const (
BOARD int = iota
PIECE
......@@ -27,11 +28,13 @@ func coordsAround(x, y int) []coords {
}
}
// Board defines a square or rectangular grid to represent a chess-style board.
type Board struct {
rows, cols int
board [][]int
}
// NewBoard creates an empty Board with the given size.
func NewBoard(rows, cols int) *Board {
board := Board{
rows, cols,
......@@ -43,6 +46,7 @@ func NewBoard(rows, cols int) *Board {
return &board
}
// StringToBoard creates a Board from a string.
func StringToBoard(b string) *Board {
rows := strings.Split(b, "\n")
rowMax := len(rows)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment