Skip to content

Instantly share code, notes, and snippets.

@sglyon
Created March 29, 2014 04:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sglyon/9848763 to your computer and use it in GitHub Desktop.
Save sglyon/9848763 to your computer and use it in GitHub Desktop.
Gotour
package main
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
a := make([][]uint8, dy)
// allocate inner dimension
for i:=0; i < dy; i++ {
a[i] = make([]uint8, dx)
}
// Fill it in
for i:=0; i < dy; i++ {
for j:=0; j < dx; j++ {
a[i][j] = uint8(i^j)
}
}
return a
}
func main() {
pic.Show(Pic)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment