Created
June 4, 2019 02:13
-
-
Save eminetto/a8cd02dd0588bbdc9019b4a80b027fde to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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