Created
March 26, 2020 22:16
-
-
Save heathhenley/bc6b23b5049bd7a1b29c988cfe781076 to your computer and use it in GitHub Desktop.
GoTutorialPic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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