Skip to content

Instantly share code, notes, and snippets.

@eminetto
Created June 4, 2019 02:13
Show Gist options
  • Save eminetto/a8cd02dd0588bbdc9019b4a80b027fde to your computer and use it in GitHub Desktop.
Save eminetto/a8cd02dd0588bbdc9019b4a80b027fde to your computer and use it in GitHub Desktop.
package chess
import "bytes"
type board struct {
data [][]string
}
func NewBoard(data [][]string) *board {
return &board{data: data}
}
func (b *board) Board() string {
var buffer = &bytes.Buffer{}
// level 0
for i := 0; i < 10; i++ {
// level 1
for j := 0; j < 10; j++ {
// level 2
buffer.WriteString(b.data[i][j])
}
buffer.WriteString("\n")
}
return buffer.String()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment