Skip to content

Instantly share code, notes, and snippets.

@dybber
Created September 26, 2014 11:23
Show Gist options
  • Save dybber/b4e76a2720ffeeb3a29b to your computer and use it in GitHub Desktop.
Save dybber/b4e76a2720ffeeb3a29b to your computer and use it in GitHub Desktop.
InstagraML chess board
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
@dybber
Copy link
Author

dybber commented Sep 26, 2014

InstagraML.writeBMP ("chess.bmp", chess 1024);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment