Instantly share code, notes, and snippets.
http://go-tour-jp.appspot.com/
のエクササイズのコードメモ
http://go-tour-jp.appspot.com/#36
package main import ( "code.google.com/p/go-tour/pic" // "log" ) func Pic(dx, dy int) [][]uint8 { data := make([][]uint8, dy) for i := range data { data[i] = make([]uint8, dx) } for y := 0; y < dy; y++ { for x := 0; x < dx; x++ { data[y][x] = getValue(x, y) } } return data } func getValue(x, y int) uint8 { return uint8(x^y/2) } func main() { pic.Show(Pic) //log.Println(Pic(3,4)) }
Sorry, something went wrong.
http://go-tour-jp.appspot.com/#36