Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
41
Task/Damm-algorithm/M2000-Interpreter/damm-algorithm.m2000
Normal file
41
Task/Damm-algorithm/M2000-Interpreter/damm-algorithm.m2000
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
Module Damm_Algorithm{
|
||||
Function Prepare {
|
||||
function OperationTable {
|
||||
data (0, 3, 1, 7, 5, 9, 8, 6, 4, 2)
|
||||
data (7, 0, 9, 2, 1, 5, 4, 8, 6, 3)
|
||||
data (4, 2, 0, 6, 8, 7, 1, 3, 5, 9)
|
||||
data (1, 7, 5, 0, 9, 8, 3, 4, 2, 6)
|
||||
data (6, 1, 2, 3, 0, 4, 5, 9, 7, 8)
|
||||
data (3, 6, 7, 4, 2, 0, 9, 5, 8, 1)
|
||||
data (5, 8, 6, 9, 7, 2, 0, 1, 3, 4)
|
||||
data (8, 9, 4, 5, 3, 6, 2, 0, 1, 7)
|
||||
data (9, 4, 3, 8, 6, 1, 7, 2, 0, 5)
|
||||
data (2, 5, 8, 1, 4, 3, 6, 7, 9, 0)
|
||||
=array([])
|
||||
}
|
||||
Digits= Lambda (d) ->{
|
||||
d$=str$(d,"")
|
||||
for i=1 to len(d$)
|
||||
data val(mid$(d$,i,1))
|
||||
next
|
||||
=Array([])
|
||||
}
|
||||
=Lambda a()=OperationTable(), Digits (N) -> {
|
||||
dim b()
|
||||
b()=Digits(N)
|
||||
m=0
|
||||
for i=0 to len(b())-1
|
||||
m=a(m)(b(i))
|
||||
next i
|
||||
=m
|
||||
}
|
||||
}
|
||||
Damm=Prepare()
|
||||
Data 5724, 5727, 112946, 112940
|
||||
while not empty
|
||||
over ' double the top of stack
|
||||
over
|
||||
Print number, Damm(number), Damm(number)=0
|
||||
End While
|
||||
}
|
||||
Damm_Algorithm
|
||||
Loading…
Add table
Add a link
Reference in a new issue