Cistercian numerals: Difference between revisions

Content added Content deleted
m (syntax highlighting fixup automation)
m (Automated syntax highlighting fixup (second round - minor fixes))
Line 34: Line 34:
:* '''[https://www.youtube.com/watch?v=9p55Qgt7Ciw Numberphile - The Forgotten Number System]'''
:* '''[https://www.youtube.com/watch?v=9p55Qgt7Ciw Numberphile - The Forgotten Number System]'''
:* '''[https://www.dcode.fr/cistercian-numbers dcode.fr - Online Cistercian numeral converter]'''
:* '''[https://www.dcode.fr/cistercian-numbers dcode.fr - Online Cistercian numeral converter]'''


=={{header|68000 Assembly}}==
=={{header|68000 Assembly}}==
This Sega Genesis cartridge can be compiled with VASM and run in the Fusion emulator.
This Sega Genesis cartridge can be compiled with VASM and run in the Fusion emulator.
<syntaxhighlight lang=68000devpac>;CONSTANTS
<syntaxhighlight lang="68000devpac">;CONSTANTS
VFLIP equ %0001000000000000
VFLIP equ %0001000000000000
HFLIP equ %0000100000000000
HFLIP equ %0000100000000000
Line 316: Line 314:
{{out}}
{{out}}
[https://ibb.co/Fz11L4w Screenshot of emulator]
[https://ibb.co/Fz11L4w Screenshot of emulator]

=={{header|Action!}}==
=={{header|Action!}}==
<syntaxhighlight lang=Action!>BYTE FUNC AtasciiToInternal(CHAR c)
<syntaxhighlight lang="action!">BYTE FUNC AtasciiToInternal(CHAR c)
BYTE c2
BYTE c2


Line 427: Line 424:
{{out}}
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Cistercian_numerals.png Screenshot from Atari 8-bit computer]
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Cistercian_numerals.png Screenshot from Atari 8-bit computer]

=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==
<syntaxhighlight lang=AutoHotkey>CistercianNumerals(num){
<syntaxhighlight lang="autohotkey">CistercianNumerals(num){
x := []
x := []
;UPPER LEFT 0 1 2 3 4 5 6 7 8 9
;UPPER LEFT 0 1 2 3 4 5 6 7 8 9
Line 467: Line 463:
return Trim(res, "`n")
return Trim(res, "`n")
}</syntaxhighlight>
}</syntaxhighlight>
Examples:<syntaxhighlight lang=AutoHotkey>Gui, font, S24, Consolas
Examples:<syntaxhighlight lang="autohotkey">Gui, font, S24, Consolas
Gui, add, Text, vE1 w150 r12
Gui, add, Text, vE1 w150 r12
Gui, show, x0 y0
Gui, show, x0 y0
Line 491: Line 487:
   #       #       #       ##    # #     # # #  #  #  #    #   
   #       #       #       ##    # #     # # #  #  #  #    #   
   #       #       #       #    #  #    ####### #  ####    #   </pre>
   #       #       #       #    #  #    ####### #  ####    #   </pre>

=={{header|AWK}}==
=={{header|AWK}}==
<syntaxhighlight lang=AWK>
<syntaxhighlight lang="awk">
# syntax: GAWK -f CISTERCIAN_NUMERALS.AWK [-v debug={0|1}] [-v xc=anychar] numbers 0-9999 ...
# syntax: GAWK -f CISTERCIAN_NUMERALS.AWK [-v debug={0|1}] [-v xc=anychar] numbers 0-9999 ...
#
#
Line 710: Line 705:
invalid
invalid
</pre>
</pre>

=={{header|C}}==
=={{header|C}}==
{{trans|C#}}
{{trans|C#}}
<syntaxhighlight lang=c>#include <stdio.h>
<syntaxhighlight lang="c">#include <stdio.h>


#define GRID_SIZE 15
#define GRID_SIZE 15
Line 1,103: Line 1,097:
x x x
x x x
xxxxxxxxxxx</pre>
xxxxxxxxxxx</pre>

=={{header|C++}}==
=={{header|C++}}==
{{trans|Go}}
{{trans|Go}}
<syntaxhighlight lang=cpp>#include <array>
<syntaxhighlight lang="cpp">#include <array>
#include <iostream>
#include <iostream>


Line 1,497: Line 1,490:
x x x
x x x
xxxxxxxxxxx</pre>
xxxxxxxxxxx</pre>

=={{header|D}}==
=={{header|D}}==
{{trans|Java}}
{{trans|Java}}
<syntaxhighlight lang=d>import std.stdio;
<syntaxhighlight lang="d">import std.stdio;


class Cistercian {
class Cistercian {
Line 1,847: Line 1,839:
x x x
x x x
xxxxxxxxxxx</pre>
xxxxxxxxxxx</pre>

=={{header|F_Sharp|F#}}==
=={{header|F_Sharp|F#}}==
<syntaxhighlight lang=fsharp>
<syntaxhighlight lang="fsharp">
// Cistercian numerals. Nigel Galloway: February 2nd., 2021
// Cistercian numerals. Nigel Galloway: February 2nd., 2021
let N=[|[[|' ';' ';' '|];[|' ';' ';' '|];[|' ';' ';' '|]];
let N=[|[[|' ';' ';' '|];[|' ';' ';' '|];[|' ';' ';' '|]];
Line 1,940: Line 1,931:
# O###
# O###
</pre>
</pre>

=={{header|Factor}}==
=={{header|Factor}}==
{{works with|Factor|0.99 2020-08-14}}
{{works with|Factor|0.99 2020-08-14}}
<syntaxhighlight lang=factor>USING: combinators continuations formatting grouping io kernel
<syntaxhighlight lang="factor">USING: combinators continuations formatting grouping io kernel
literals math.order math.text.utils multiline sequences
literals math.order math.text.utils multiline sequences
splitting ;
splitting ;
Line 2,064: Line 2,054:
+ +
+ +
</pre>
</pre>

=={{header|Fōrmulæ}}==
=={{header|Fōrmulæ}}==


Line 2,072: Line 2,061:


In '''[https://formulae.org/?example=Cistercian_numerals this]''' page you can see the program(s) related to this task and their results.
In '''[https://formulae.org/?example=Cistercian_numerals this]''' page you can see the program(s) related to this task and their results.

=={{header|Go}}==
=={{header|Go}}==
{{trans|Wren}}
{{trans|Wren}}
<syntaxhighlight lang=go>package main
<syntaxhighlight lang="go">package main


import "fmt"
import "fmt"
Line 2,203: Line 2,191:
Same as Wren example.
Same as Wren example.
</pre>
</pre>

=={{header|J}}==
=={{header|J}}==
Program writes a scalable vector graphics file containing all composable numbers. J code is alongside the original python source.
Program writes a scalable vector graphics file containing all composable numbers. J code is alongside the original python source.
Line 2,212: Line 2,199:
</pre>
</pre>
The <tt>rc</tt> verb writes <tt>RC=. 0 1 20 300 666 4000 5555 6789</tt>
The <tt>rc</tt> verb writes <tt>RC=. 0 1 20 300 666 4000 5555 6789</tt>
<syntaxhighlight lang=J>
<syntaxhighlight lang="j">
NB. http://rosettacode.org/wiki/Cistercian_numerals
NB. http://rosettacode.org/wiki/Cistercian_numerals
NB. converted from
NB. converted from
Line 2,395: Line 2,382:
)
)
</syntaxhighlight>
</syntaxhighlight>

=={{header|Java}}==
=={{header|Java}}==
{{trans|Kotlin}}
{{trans|Kotlin}}
<syntaxhighlight lang=java>import java.util.Arrays;
<syntaxhighlight lang="java">import java.util.Arrays;
import java.util.List;
import java.util.List;


Line 2,744: Line 2,730:
x x x
x x x
xxxxxxxxxxx </pre>
xxxxxxxxxxx </pre>

=={{header|JavaScript}}==
=={{header|JavaScript}}==
Using a canvas.
Using a canvas.
<syntaxhighlight lang=javaScript>
<syntaxhighlight lang="javascript">
// html
// html
document.write(`
document.write(`
Line 2,853: Line 2,838:
{{out}}<pre>
{{out}}<pre>
https://jsfiddle.net/43tsmn9z</pre>
https://jsfiddle.net/43tsmn9z</pre>

=={{header|Julia}}==
=={{header|Julia}}==
Gtk graphic version.
Gtk graphic version.
<syntaxhighlight lang=julia>using Gtk, Cairo
<syntaxhighlight lang="julia">using Gtk, Cairo


const can = GtkCanvas(800, 100)
const can = GtkCanvas(800, 100)
Line 2,914: Line 2,898:
mooncipher()
mooncipher()
</syntaxhighlight>
</syntaxhighlight>

=={{header|Kotlin}}==
=={{header|Kotlin}}==
{{trans|C++}}
{{trans|C++}}
<syntaxhighlight lang=scala>import java.io.StringWriter
<syntaxhighlight lang="scala">import java.io.StringWriter


class Cistercian() {
class Cistercian() {
Line 3,277: Line 3,260:
x x x
x x x
xxxxxxxxxxx </pre>
xxxxxxxxxxx </pre>

=={{header|Lua}}==
=={{header|Lua}}==
{{trans|Go}}
{{trans|Go}}
<syntaxhighlight lang=lua>function initN()
<syntaxhighlight lang="lua">function initN()
local n = {}
local n = {}
for i=1,15 do
for i=1,15 do
Line 3,536: Line 3,518:
x x x
x x x
x x x x x x x x x x x</pre>
x x x x x x x x x x x</pre>

=={{header|Mathematica}}/{{header|Wolfram Language}}==
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<syntaxhighlight lang=Mathematica>ClearAll[CistercianNumberEncodeHelper, CistercianNumberEncode]
<syntaxhighlight lang="mathematica">ClearAll[CistercianNumberEncodeHelper, CistercianNumberEncode]
\[Delta] = 0.25;
\[Delta] = 0.25;
CistercianNumberEncodeHelper[0] := {}
CistercianNumberEncodeHelper[0] := {}
Line 3,581: Line 3,562:
{{out}}
{{out}}
A set of Graphics is shown for each of the numerals.
A set of Graphics is shown for each of the numerals.

=={{header|Nim}}==
=={{header|Nim}}==
{{trans|Kotlin}}
{{trans|Kotlin}}
<syntaxhighlight lang=Nim>const Size = 15
<syntaxhighlight lang="nim">const Size = 15


type Canvas = array[Size, array[Size, char]]
type Canvas = array[Size, array[Size, char]]
Line 3,881: Line 3,861:
xxxxxxxxxxx
xxxxxxxxxxx
</pre>
</pre>

=={{header|Perl}}==
=={{header|Perl}}==
<syntaxhighlight lang=perl>#!/usr/bin/perl
<syntaxhighlight lang="perl">#!/usr/bin/perl


use strict; # https://rosettacode.org/wiki/Cistercian_numerals
use strict; # https://rosettacode.org/wiki/Cistercian_numerals
Line 3,944: Line 3,923:
# # # # # # ######### # ##### #######
# # # # # # ######### # ##### #######
</pre>
</pre>

=={{header|Phix}}==
=={{header|Phix}}==
<!--<syntaxhighlight lang=Phix>(phixonline)-->
<!--<syntaxhighlight lang="phix">(phixonline)-->
<span style="color: #000080;font-style:italic;">--
<span style="color: #000080;font-style:italic;">--
-- Define each digit as {up-down multiplier, left-right multiplier, char},
-- Define each digit as {up-down multiplier, left-right multiplier, char},
Line 4,028: Line 4,006:
| + / | +-+-+ | +-+ +-+ +-+-+ +-+-+
| + / | +-+-+ | +-+ +-+ +-+-+ +-+-+
</pre>
</pre>

=={{header|Plain English}}==
=={{header|Plain English}}==
<syntaxhighlight lang=plainenglish>To run:
<syntaxhighlight lang="plainenglish">To run:
Start up.
Start up.
Show some example Cistercian numbers.
Show some example Cistercian numbers.
Line 4,170: Line 4,147:
{{out}}
{{out}}
https://commons.wikimedia.org/wiki/File:Cistercian_numerals.png
https://commons.wikimedia.org/wiki/File:Cistercian_numerals.png

=={{header|Python}}==
=={{header|Python}}==
I tried to create a three-line font from UTF8 characters taking three lines per Cistercian number.
I tried to create a three-line font from UTF8 characters taking three lines per Cistercian number.
<syntaxhighlight lang=python># -*- coding: utf-8 -*-
<syntaxhighlight lang="python"># -*- coding: utf-8 -*-
"""
"""
Some UTF-8 chars used:
Some UTF-8 chars used:
Line 4,294: Line 4,270:
The pre tag may have to shift from one monospace font to a second that contains a character missing from the first. Those two individually monospaced fonts may have differing character widths between fonts (although consistent within individual monospaced fonts).<br>
The pre tag may have to shift from one monospace font to a second that contains a character missing from the first. Those two individually monospaced fonts may have differing character widths between fonts (although consistent within individual monospaced fonts).<br>
Paste the output into a monospace code editor and the stems of each number might well align!
Paste the output into a monospace code editor and the stems of each number might well align!

=={{header|Raku}}==
=={{header|Raku}}==
Handles 0 through 9999 only. No error trapping. If you feed it an unsupported number it will truncate to maximum 4 digits.
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 line>my @line-segments = (0, 0, 0, 100),
<syntaxhighlight lang="raku" line>my @line-segments = (0, 0, 0, 100),
(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),
(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,349: Line 4,324:
$out.say: q|</svg>|; # insert footer</syntaxhighlight>
$out.say: q|</svg>|; # insert footer</syntaxhighlight>
[https://github.com/thundergnat/rc/blob/master/img/Cistercian-raku.svg See sample SVG image: (offsite link)]
[https://github.com/thundergnat/rc/blob/master/img/Cistercian-raku.svg See sample SVG image: (offsite link)]

=={{header|REXX}}==
=={{header|REXX}}==
A fair amount of code dealt with displaying multiple Cistercian numerals on the terminal, &nbsp; and also trying to present
A fair amount of code dealt with displaying multiple Cistercian numerals on the terminal, &nbsp; and also trying to present
Line 4,355: Line 4,329:


Comprehensive error checking was also included.
Comprehensive error checking was also included.
<syntaxhighlight lang=rexx>/*REXX program displays a (non-negative 4-digit) integer in Cistercian (monk) numerals.*/
<syntaxhighlight lang="rexx">/*REXX program displays a (non-negative 4-digit) integer in Cistercian (monk) numerals.*/
parse arg m /*obtain optional arguments from the CL*/
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.*/
if m='' | m="," then m= 0 1 20 300 4000 5555 6789 9393 /*Not specified? Use defaults.*/
Line 4,459: Line 4,433:
│ │ │ │/ / │ ─────┴───── │ └────┘ └────┘/
│ │ │ │/ / │ ─────┴───── │ └────┘ └────┘/
</pre>
</pre>

=={{header|Ruby}}==
=={{header|Ruby}}==
{{trans|Lua}}
{{trans|Lua}}
<syntaxhighlight lang=ruby>def initN
<syntaxhighlight lang="ruby">def initN
n = Array.new(15){Array.new(11, ' ')}
n = Array.new(15){Array.new(11, ' ')}
for i in 1..15
for i in 1..15
Line 4,762: Line 4,735:
x x x
x x x
xxxxxxxxxxx</pre>
xxxxxxxxxxx</pre>

=={{header|Wren}}==
=={{header|Wren}}==
{{libheader|Wren-fmt}}
{{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.
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.
<syntaxhighlight lang=ecmascript>import "/fmt" for Fmt
<syntaxhighlight lang="ecmascript">import "/fmt" for Fmt


var n
var n