Skip to content

Instantly share code, notes, and snippets.

@freeformz
Created July 13, 2012 22:50
Show Gist options
  • Save freeformz/3108052 to your computer and use it in GitHub Desktop.
Save freeformz/3108052 to your computer and use it in GitHub Desktop.
My GoTour Exercise #46 (http://tour.golang.org/#46) solution
package main
import (
"code.google.com/p/go-tour/pic"
)
func Pic(dx, dy int) [][]uint8 {
s := make([][]uint8, dy)
for y := range s {
s[y] = make([]uint8, dx)
for x := range s[y] {
if (x+1) % (y+1) == 0 {
s[y][x] = 192
}
}
}
return s
}
func main() {
pic.Show(Pic)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment