Skip to content

Instantly share code, notes, and snippets.

@jadeallenx
Created July 17, 2012 21:34
Show Gist options
  • Save jadeallenx/3132261 to your computer and use it in GitHub Desktop.
Save jadeallenx/3132261 to your computer and use it in GitHub Desktop.
learngo slices solutions (#60)
package main
import "tour/pic"
func Pic(dx, dy int) [][]uint8 {
outer := make([][]uint8, dy)
for i := 0; i < dy; i++ {
inner := make([]uint8, dx)
for j := 0; j < dx; j++ {
inner[j] = uint8((j^i)-1)
}
outer[i] = inner
}
return outer
}
func main() {
pic.Show(Pic)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment