Created
July 17, 2012 21:34
-
-
Save jadeallenx/3132261 to your computer and use it in GitHub Desktop.
learngo slices solutions (#60)
This file contains hidden or 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 "tour/pic" | |
func Pic(dx, dy int) [][]uint8 { | |
outer := make([][]uint8, dy) | |
for i := 0; i < dy; i++ { | |
inner := make([]uint8, dx) | |
for j := 0; j < dx; j++ { | |
inner[j] = uint8((j^i)-1) | |
} | |
outer[i] = inner | |
} | |
return outer | |
} | |
func main() { | |
pic.Show(Pic) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment