Created
March 27, 2010 23:31
-
-
Save mnemnion/346422 to your computer and use it in GitHub Desktop.
Asymptote code that renders a Goban
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
// now a function, also, can draw to any picture not just currentpicture | |
void drawgoban(picture pic=currentpicture, int gobansize, int gobanlines=19) { | |
int gobancounter=gobanlines + 1; | |
unitsize(pic,gobansize/(gobancounter+1)); | |
//Bounding Box and background | |
filldraw(pic,box((0,0),(gobancounter,gobancounter)),white,white); | |
//Draw grid | |
for(int i=1; i < gobancounter; ++i) { | |
draw(pic,(i,1)--(i,gobanlines)); | |
} | |
for(int i=1; i < gobancounter; ++i) { | |
draw(pic,(1,i)--(gobanlines,i)); | |
} | |
//Hoshi! | |
if(gobanlines > 5) { | |
if (gobansize<70) { // muck about with this until the hoshi look right | |
dotfactor = 4; | |
} | |
dot(pic,(4,4)); | |
dot(pic,(gobancounter-4,4)); | |
dot(pic,(gobancounter-4,gobancounter-4)); | |
dot(pic,(4,gobancounter-4)); | |
dotfactor = 6; // hard coded, should restore to default, fix later | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment