Skip to content

Instantly share code, notes, and snippets.

@heathhenley
Created March 26, 2020 22:16
Show Gist options
  • Save heathhenley/bc6b23b5049bd7a1b29c988cfe781076 to your computer and use it in GitHub Desktop.
Save heathhenley/bc6b23b5049bd7a1b29c988cfe781076 to your computer and use it in GitHub Desktop.
GoTutorialPic
import "golang.org/x/tour/pic"
func Pic(dx, dy int) [][]uint8 {
var pic [][] uint8
for x := 0; x < dx; x++ {
pic = append(pic, make([]uint8, dy))
for y := 0; y < dy; y++ {
pic[x][y] = uint8((x*x + y*y + x + y )/2)
}
}
return pic
}
func main() {
pic.Show(Pic)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment