Skip to content

Instantly share code, notes, and snippets.

@m-ender
Created July 2, 2014 12:44
Show Gist options
  • Save m-ender/dcb1e5efcc1a03c2b83f to your computer and use it in GitHub Desktop.
Save m-ender/dcb1e5efcc1a03c2b83f to your computer and use it in GitHub Desktop.
I'm using this Mathematica snippet to generate tie breaker tracks based on the given tie-breaker. I sometimes need to add or remove a few more rows/columns to/from the boundary to ensure square sizes. Otherwise the track is used as is.
res = 290;
Riffle[
(*remove road cells around the border*)
(Drop[#, 4]) & /@ (Drop[#, -4] &) /@ Most@Rest@
ImageData[
Binarize@Rasterize[
Import["path\\to\\tie-breaker.pdf"],
ImageSize -> res + 8
]
] /. {0 -> "#", 1 -> "."},
"\n"] <> ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment