From b9a520f96ddb03a62934f60c26b10c9dc50f4aa9 Mon Sep 17 00:00:00 2001 From: Kevin Lyda <kevin@ie.suberic.net> Date: Thu, 9 Mar 2017 09:18:37 +0000 Subject: [PATCH] Tests now pass. --- sidecheck.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sidecheck.go b/sidecheck.go index 2fedfaa..d19198f 100644 --- a/sidecheck.go +++ b/sidecheck.go @@ -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) -- GitLab