Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/Roman-numerals-Encode/Logo/roman-numerals-encode-1.logo
Normal file
12
Task/Roman-numerals-Encode/Logo/roman-numerals-encode-1.logo
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
make "roman.rules [
|
||||
[1000 M] [900 CM] [500 D] [400 CD]
|
||||
[ 100 C] [ 90 XC] [ 50 L] [ 40 XL]
|
||||
[ 10 X] [ 9 IX] [ 5 V] [ 4 IV]
|
||||
[ 1 I]
|
||||
]
|
||||
|
||||
to roman :n [:rules :roman.rules] [:acc "||]
|
||||
if empty? :rules [output :acc]
|
||||
if :n < first first :rules [output (roman :n bf :rules :acc)]
|
||||
output (roman :n - first first :rules :rules word :acc last first :rules)
|
||||
end
|
||||
18
Task/Roman-numerals-Encode/Logo/roman-numerals-encode-2.logo
Normal file
18
Task/Roman-numerals-Encode/Logo/roman-numerals-encode-2.logo
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
make "patterns [[?] [? ?] [? ? ?] [? ?2] [?2] [?2 ?] [?2 ? ?] [?2 ? ? ?] [? ?3]]
|
||||
|
||||
to digit :d :numerals
|
||||
if :d = 0 [output "||]
|
||||
output apply (sentence "\( "word (item :d :patterns) "\)) :numerals
|
||||
end
|
||||
to digits :n :numerals
|
||||
output word ifelse :n < 10 ["||] [digits int :n/10 bf bf :numerals] ~
|
||||
digit modulo :n 10 :numerals
|
||||
end
|
||||
to roman :n
|
||||
if or :n < 0 :n >= 4000 [output [EX MODVS!]]
|
||||
output digits :n [I V X L C D M]
|
||||
end
|
||||
|
||||
print roman 1999 ; MCMXCIX
|
||||
print roman 25 ; XXV
|
||||
print roman 944 ; CMXLIV
|
||||
Loading…
Add table
Add a link
Reference in a new issue