Created
September 26, 2014 11:23
-
-
Save dybber/b4e76a2720ffeeb3a29b to your computer and use it in GitHub Desktop.
InstagraML chess board
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
fun chess idim = | |
let val dim = Real.fromInt idim | |
fun rep3 v = (v,v,v) | |
fun chess' (ii, ij) = | |
let val (i,j) = (Real.fromInt ii, | |
Real.fromInt (idim-ij)) | |
val s = 3.0/(j+99.0) | |
in (Real.round((i+dim)*s+j*s) mod 2 + | |
Real.round((dim*2.0-i)*s+j*s) mod 2)*127 | |
end | |
in InstagraML.fromFunction (idim, idim, rep3 o chess') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
InstagraML.writeBMP ("chess.bmp", chess 1024);