Skip to content

Instantly share code, notes, and snippets.

@slawosz
Created June 24, 2013 18:00
Show Gist options
  • Save slawosz/5852093 to your computer and use it in GitHub Desktop.
Save slawosz/5852093 to your computer and use it in GitHub Desktop.
Go pictures
// http://tour.golang.org/#35
package main
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
picture := make([][]uint8, dx)
for i := 0; i < dx; i++ {
picture[i] = make([]uint8, dy)
}
for i := 1; i < dx; i++ {
for j := 1; j < dy; j++ {
picture[i][j] = uint8(i + j)
}
}
return picture
}
func main() {
pic.Show(Pic)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment