Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Kevin Lyda
sidecheck
Commits
b9a520f9
Commit
b9a520f9
authored
Mar 09, 2017
by
Kevin Lyda
💬
Browse files
Tests now pass.
parent
40a00da1
Pipeline
#1344
passed with stage
in 36 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
sidecheck.go
View file @
b9a520f9
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment