Created
March 30, 2016 22:47
-
-
Save piecedigital/7cf2dec0ea2567b464d42faa68da5277 to your computer and use it in GitHub Desktop.
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 { | |
// this makes "s" a slice ready to hold slices | |
s := make([][]uint8, dy) | |
// iterate through "y", slices in "s" | |
for y := range s { | |
// this makes the slices IN "s" ready to hold unsigned 8-bit integers | |
s[y] = make([]uint8, dx) | |
// iterrate through "x", the integers in "y" | |
for x := range s[y] { | |
s[y][x] = uint8(x/(4)^y/(4)) | |
} | |
} | |
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