# Main Command: Go # Hexagrams by Guy Walker # www.logoarts.co.uk to new # set default screen, pen and turtle ResetAll SetScreenSize [400 400] HideTurtle SetSC Black SetPC Green SetPS 1 PenUp end to stick :w SetPC [255 102 51] # orange Right 90 PenDown Forward 7 If (Item :W :BinList) = 0 [PenUp] Forward 9 PenDown Forward 7 PenUp Back 23 Left 90 Forward 5 end to hex :m :n Make "Count (8*:M)+:N Make "BinList Dec2Bin :Count SetPC White Label :Count Forward 14 For [W 3 8] [Stick :W] end to gridd For [M 0 7][ For [N 0 7][ Make "X :N*48-182 Make "Y :M*48-188 SetXY :X :Y Hex :M :N]] end To Dec2Bin :Num # convert decimal number Num to an 8 item binary list If :Num >255 [Print [Rule is too large!] Stop] LocalMake "Bin [] For [C 7 0 -1] [ LocalMake "Bin LPut (Quotient :Num Power 2 :C) :Bin LocalMake "Num :Num -((Power 2 :C) *Last :Bin)] Output :Bin End to go New Gridd end