Created
November 8, 2014 10:48
-
-
Save sysatom/bf534e6ef02ccac7a19c to your computer and use it in GitHub Desktop.
Tweetable Mathematical Art
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 ( | |
"fmt" | |
"os" | |
) | |
const ( | |
DIM = 1024 | |
DM1 = DIM - 1 | |
) | |
var ( | |
f *os.File | |
) | |
func RD(i, j int) uint8 { | |
// YOUR CODE HERE | |
} | |
func GR(i, j int) uint8 { | |
// YOUR CODE HERE | |
} | |
func BL(i, j int) uint8 { | |
// YOUR CODE HERE | |
} | |
func main() { | |
f, _ = os.Create("MathPic.ppm") | |
fmt.Fprintf(f, "P6\n%d %d\n255\n", DIM, DIM) | |
for j := 0; j < DIM; j++ { | |
for i := 0; i < DIM; i++ { | |
pixel_write(i, j) | |
} | |
} | |
f.Close() | |
} | |
func pixel_write(i, j int) { | |
var color []byte | |
color = append(color, RD(i, j)&255) | |
color = append(color, GR(i, j)&255) | |
color = append(color, BL(i, j)&255) | |
f.Write(color) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment