Cistercian numerals: Difference between revisions
m
syntax highlighting fixup automation
Alpha bravo (talk | contribs) (Added AutoHotkey) |
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
||
Line 38:
=={{header|68000 Assembly}}==
This Sega Genesis cartridge can be compiled with VASM and run in the Fusion emulator.
<
VFLIP equ %0001000000000000
HFLIP equ %0000100000000000
Line 312:
DC.B $80 ;23 DMA source address high (C=CMD) CCHHHHHH
VDPSettingsEnd:
even</
{{out}}
Line 318:
=={{header|Action!}}==
<
BYTE c2
Line 424:
DO UNTIL CH#$FF OD
CH=$FF
RETURN</
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Cistercian_numerals.png Screenshot from Atari 8-bit computer]
=={{header|AutoHotkey}}==
<
x := []
;UPPER LEFT 0 1 2 3 4 5 6 7 8 9
Line 466:
res := StrReplace(res, 1, "#")
return Trim(res, "`n")
}</
Examples:<
Gui, add, Text, vE1 w150 r12
Gui, show, x0 y0
Line 475:
MsgBox % num
}
return</
{{out}}
<pre> 0 1 20 300 4000 5555 6789 2022
Line 493:
=={{header|AWK}}==
<
# syntax: GAWK -f CISTERCIAN_NUMERALS.AWK [-v debug={0|1}] [-v xc=anychar] numbers 0-9999 ...
#
Line 567:
if (debug == 1) { printf("%s\n",header) }
}
</syntaxhighlight>
{{out}}
<pre style="height: 60ex; overflow: scroll">
Line 713:
=={{header|C}}==
{{trans|C#}}
<
#define GRID_SIZE 15
Line 959:
return 0;
}</
{{out}}
<pre>0:
Line 1,106:
=={{header|C++}}==
{{trans|Go}}
<
#include <iostream>
Line 1,360:
return 0;
}</
{{out}}
<pre>0:
Line 1,500:
=={{header|D}}==
{{trans|Java}}
<
class Cistercian {
Line 1,711:
writeln(c);
}
}</
{{out}}
<pre>0:
Line 1,849:
=={{header|F_Sharp|F#}}==
<
// Cistercian numerals. Nigel Galloway: February 2nd., 2021
let N=[|[[|' ';' ';' '|];[|' ';' ';' '|];[|' ';' ';' '|]];
Line 1,867:
[(0,0,0,0);(0,0,0,1);(0,0,2,0);(0,3,0,0);(4,0,0,0);(5,5,5,5);(6,7,8,9)]|>List.iter(fun(i,g,e,l)->printfn "\n%d%d%d%d\n____" i g e l; fN i g e l)
</syntaxhighlight>
{{out}}
<pre>
Line 1,943:
=={{header|Factor}}==
{{works with|Factor|0.99 2020-08-14}}
<
literals math.order math.text.utils multiline sequences
splitting ;
Line 1,989:
with-datastack [ ] [ overwrite ] map-reduce [ print ] each ;
{ 0 1 20 300 4000 5555 6789 8015 } [ .cistercian nl ] each</
{{out}}
<pre style="height: 60ex; overflow: scroll">
Line 2,075:
=={{header|Go}}==
{{trans|Wren}}
<
import "fmt"
Line 2,197:
printNumeral()
}
}</
{{out}}
Line 2,212:
</pre>
The <tt>rc</tt> verb writes <tt>RC=. 0 1 20 300 666 4000 5555 6789</tt>
<syntaxhighlight lang=J>
NB. http://rosettacode.org/wiki/Cistercian_numerals
NB. converted from
Line 2,394:
'open browser to {}{}{}' format~ (pwd'') ; PATHJSEP_j_ ; y
)
</syntaxhighlight>
=={{header|Java}}==
{{trans|Kotlin}}
<
import java.util.List;
Line 2,607:
}
}
}</
{{out}}
<pre>0:
Line 2,747:
=={{header|JavaScript}}==
Using a canvas.
<
// html
document.write(`
Line 2,850:
}
}
</syntaxhighlight>
{{out}}<pre>
https://jsfiddle.net/43tsmn9z</pre>
Line 2,856:
=={{header|Julia}}==
Gtk graphic version.
<
const can = GtkCanvas(800, 100)
Line 2,913:
mooncipher()
</syntaxhighlight>
=={{header|Kotlin}}==
{{trans|C++}}
<
class Cistercian() {
Line 3,140:
}
}</
{{out}}
<pre>0:
Line 3,280:
=={{header|Lua}}==
{{trans|Go}}
<
local n = {}
for i=1,15 do
Line 3,399:
end
main()</
{{out}}
<pre>0:
Line 3,538:
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<
\[Delta] = 0.25;
CistercianNumberEncodeHelper[0] := {}
Line 3,578:
CistercianNumberEncode[5555]
CistercianNumberEncode[6789]
CistercianNumberEncode[1337]</
{{out}}
A set of Graphics is shown for each of the numerals.
Line 3,584:
=={{header|Nim}}==
{{trans|Kotlin}}
<
type Canvas = array[Size, array[Size, char]]
Line 3,742:
for number in [0, 1, 20, 300, 4000, 5555, 6789, 9999]:
echo number, ':'
echo cistercian(number)</
{{out}}
Line 3,883:
=={{header|Perl}}==
<
use strict; # https://rosettacode.org/wiki/Cistercian_numerals
Line 3,927:
}
return $_;
}</
{{out}}
<pre>
Line 3,946:
=={{header|Phix}}==
<!--<
<span style="color: #000080;font-style:italic;">--
-- Define each digit as {up-down multiplier, left-right multiplier, char},
Line 4,007:
<span style="color: #000000;">cisterian</span><span style="color: #0000FF;">({</span><span style="color: #000000;">0</span><span style="color: #0000FF;">,</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">2</span><span style="color: #0000FF;">,</span><span style="color: #000000;">3</span><span style="color: #0000FF;">,</span><span style="color: #000000;">4</span><span style="color: #0000FF;">,</span><span style="color: #000000;">5</span><span style="color: #0000FF;">,</span><span style="color: #000000;">6</span><span style="color: #0000FF;">,</span><span style="color: #000000;">7</span><span style="color: #0000FF;">,</span><span style="color: #000000;">8</span><span style="color: #0000FF;">,</span><span style="color: #000000;">9</span><span style="color: #0000FF;">,</span><span style="color: #000000;">20</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">300</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">4000</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">5555</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">6789</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">9394</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">7922</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">9999</span><span style="color: #0000FF;">})</span>
<!--</
{{out}}
<pre>
Line 4,030:
=={{header|Plain English}}==
<
Start up.
Show some example Cistercian numbers.
Line 4,167:
To stroke nine:
Stroke 1.
Stroke 8.</
{{out}}
https://commons.wikimedia.org/wiki/File:Cistercian_numerals.png
Line 4,173:
=={{header|Python}}==
I tried to create a three-line font from UTF8 characters taking three lines per Cistercian number.
<
"""
Some UTF-8 chars used:
Line 4,258:
for n in numbers[1:]:
lines = cjoin(lines, num_to_lines(n))
print('\n'.join(lines))</
{{out}}
Line 4,298:
Handles 0 through 9999 only. No error trapping. If you feed it an unsupported number it will truncate to maximum 4 digits.
<syntaxhighlight lang=raku
(0, 0, 35, 0), (0, 35, 35, 35), (0, 0, 35, 35), (0, 35, 35, 0), ( 35, 0, 35, 35),
(0, 0,-35, 0), (0, 35,-35, 35), (0, 0,-35, 35), (0, 35,-35, 0), (-35, 0,-35, 35),
Line 4,347:
}
$out.say: q|</svg>|; # insert footer</
[https://github.com/thundergnat/rc/blob/master/img/Cistercian-raku.svg See sample SVG image: (offsite link)]
Line 4,355:
Comprehensive error checking was also included.
<
parse arg m /*obtain optional arguments from the CL*/
if m='' | m="," then m= 0 1 20 300 4000 5555 6789 9393 /*Not specified? Use defaults.*/
Line 4,438:
if q==2 then call p -5, 5, '└', -5, 9, "┌"
if q==3 then call p 5, 0, '┘', 5, 4, "┐"
if q==4 then call p -5, 0, '└', -5, 4, "┌"; return</
{{out|output|text= when using the default inputs:}}
(Shown at three-quarter size.)
Line 4,462:
=={{header|Ruby}}==
{{trans|Lua}}
<
n = Array.new(15){Array.new(11, ' ')}
for i in 1..15
Line 4,625:
end
printNumeral(n)
end</
{{out}}
<pre>0:
Line 4,766:
{{libheader|Wren-fmt}}
This draws each Cistercian numeral on the terminal within a grid of 15 rows by 11 columns. The vertical line segment is drawn at column 5 (zero indexed) so there are 5 columns at either side.
<
var n
Line 4,887:
Fmt.mprint(n, 1, 0, "")
System.print()
}</
{{out}}
|