Skip to content

Instantly share code, notes, and snippets.

@yeonsh
Last active August 29, 2015 14:06
Show Gist options
  • Save yeonsh/18fc264cb3582ab8c1ee to your computer and use it in GitHub Desktop.
Save yeonsh/18fc264cb3582ab8c1ee to your computer and use it in GitHub Desktop.
Tour of Go exercise solutions
// #38
package main
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
board := make([][]uint8, dx)
for i := 0; i < dx; i++ {
board[i] = make([]uint8, dy)
}
for x := 0; x < dx; x++ {
for y := 0; y < dy; y++ {
board[x][y] = uint8(x^y);
}
}
return board
}
func main() {
pic.Show(Pic)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment