Cistercian numerals: Difference between revisions
Added AutoHotkey
Puppydrum64 (talk | contribs) m (→{{header|68000 Assembly}}: removed a little extra whitespace to make this more compact) |
Alpha bravo (talk | contribs) (Added AutoHotkey) |
||
Line 427:
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Cistercian_numerals.png Screenshot from Atari 8-bit computer]
=={{header|AutoHotkey}}==
<lang AutoHotkey>CistercianNumerals(num){
x := []
;UPPER LEFT 0 1 2 3 4 5 6 7 8 9
x[1, "UL"] := ["000","111","000","000","100","111","100","111","100","111"]
x[2, "UL"] := ["000","000","000","001","010","010","100","100","100","100"]
x[3, "UL"] := ["000","000","000","010","001","001","100","100","100","100"]
x[4, "UL"] := ["000","000","111","100","000","000","100","100","111","111"]
;UPPER RIGHT 0 1 2 3 4 5 6 7 8 9
x[1, "UR"] := ["000","111","000","000","001","111","001","111","001","111"]
x[2, "UR"] := ["000","000","000","100","010","010","001","001","001","001"]
x[3, "UR"] := ["000","000","000","010","100","100","001","001","001","001"]
x[4, "UR"] := ["000","000","111","001","000","000","001","001","111","111"]
;BOTTOM LEFT 0 1 2 3 4 5 6 7 8 9
x[1, "BL"] := ["000","000","111","100","000","000","100","100","111","111"]
x[2, "BL"] := ["000","000","000","010","001","001","100","100","100","100"]
x[3, "BL"] := ["000","000","000","001","010","010","100","100","100","100"]
x[4, "BL"] := ["000","111","000","000","100","111","100","111","100","111"]
;BOTTOM RIGHT 0 1 2 3 4 5 6 7 8 9
x[1, "BR"] := ["000","000","111","001","000","000","001","001","111","111"]
x[2, "BR"] := ["000","000","000","010","100","100","001","001","001","001"]
x[3, "BR"] := ["000","000","000","100","010","010","001","001","001","001"]
x[4, "BR"] := ["000","111","000","000","001","111","001","111","001","111"]
num := SubStr("0000" num, -3)
n := StrSplit(num) ; n.1*1000 + n.2*100 + n.3*10 + n.4
loop 4
res .= x[A_Index, "UL", 1+n.3] . "1" . x[A_Index, "UR", 1+n.4] . "`n"
loop 4
res .= "0001`n"
loop 4
res .= x[A_Index, "BL", 1+n.1] . "1" . x[A_Index, "BR", 1+n.2] . "`n"
res := StrReplace(res, 0, " ")
res := StrReplace(res, 1, "#")
return Trim(res, "`n")
}</lang>
Examples:<lang AutoHotkey>Gui, font, S24, Consolas
Gui, add, Text, vE1 w150 r12
Gui, show, x0 y0
for i, num in [0, 1, 20, 300, 4000, 5555, 6789, 2022]
{
GuiControl,, E1, % CistercianNumerals(num)
MsgBox % num
}
return</lang>
{{out}}
<pre> 0 1 20 300 4000 5555 6789 2022
# #### # # # ####### # #### #
# # # # # # # # # # # #
# # # # # ### # # # #
# # #### # # # ####### #######
# # # # # # # #
# # # # # # # #
# # # # # # # #
# # # # # # # #
# # # # # # # # # # ####
# # # # # ## ### # # # #
# # # ## # # # # # # # # #
# # # # # # ####### # #### # </pre>
=={{header|AWK}}==
|