Created
May 23, 2024 16:29
-
-
Save ryanfrance/f333abd6bde8d1d5741b588e1d7443fc to your computer and use it in GitHub Desktop.
Integer interpretation for bluescale picture
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
package main | |
import ( | |
"golang.org/x/tour/pic" | |
) | |
func Pic(dx, dy int) [][]uint8 { | |
picture := make([][]uint8, dy) | |
for y := 0; y < dy; y++ { | |
row := make([]uint8, dx) | |
for x := 0; x < dx; x++ { | |
row[x] = uint8((x+y) / 2) | |
} | |
picture[y] = row | |
} | |
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