Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,18 +0,0 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
|
||||
procedure Thue_Morse is
|
||||
|
||||
function Replace(S: String) return String is
|
||||
-- replace every "0" by "01" and every "1" by "10"
|
||||
(if S'Length = 0 then ""
|
||||
else (if S(S'First) = '0' then "01" else "10") &
|
||||
Replace(S(S'First+1 .. S'Last)));
|
||||
|
||||
function Sequence (N: Natural) return String is
|
||||
(if N=0 then "0" else Replace(Sequence(N-1)));
|
||||
|
||||
begin
|
||||
for I in 0 .. 6 loop
|
||||
Ada.Text_IO.Put_Line(Integer'Image(I) & ": " & Sequence(I));
|
||||
end loop;
|
||||
end Thue_Morse;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
thueMorse: function [maxSteps][
|
||||
result: new []
|
||||
result: []
|
||||
val: [0]
|
||||
count: new 0
|
||||
count: 0
|
||||
while [true][
|
||||
'result ++ join to [:string] val
|
||||
inc 'count
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. THUE-MORSE.
|
||||
|
||||
DATA DIVISION.
|
||||
WORKING-STORAGE SECTION.
|
||||
01 STRINGS.
|
||||
03 CURRENT-STATE PIC X(64).
|
||||
03 TEMP PIC X(64).
|
||||
|
||||
PROCEDURE DIVISION.
|
||||
BEGIN.
|
||||
MOVE "0" TO CURRENT-STATE.
|
||||
PERFORM THUE-MORSE-STEP 8 TIMES.
|
||||
DISPLAY CURRENT-STATE.
|
||||
STOP RUN.
|
||||
|
||||
THUE-MORSE-STEP.
|
||||
MOVE CURRENT-STATE TO TEMP.
|
||||
INSPECT TEMP REPLACING ALL '0' BY 'X'.
|
||||
INSPECT TEMP REPLACING ALL '1' BY '0'.
|
||||
INSPECT TEMP REPLACING ALL 'X' BY '1'.
|
||||
STRING CURRENT-STATE DELIMITED BY SPACE,
|
||||
TEMP DELIMITED BY SPACE
|
||||
INTO CURRENT-STATE.
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import extensions;
|
||||
import system'text;
|
||||
|
||||
sequence(int steps)
|
||||
Sequence(int steps)
|
||||
{
|
||||
var sb1 := TextBuilder.load("0");
|
||||
var sb2 := TextBuilder.load("1");
|
||||
|
|
@ -11,10 +11,10 @@ sequence(int steps)
|
|||
sb1.write(sb2);
|
||||
sb2.write(tmp)
|
||||
};
|
||||
console.printLine(sb1).readLine()
|
||||
Console.printLine(sb1).readLine()
|
||||
}
|
||||
|
||||
public program()
|
||||
public Program()
|
||||
{
|
||||
sequence(6)
|
||||
Sequence(6)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
(phixonline)-->
|
||||
<span style="color: #004080;">string</span> <span style="color: #000000;">tm</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">"0"</span>
|
||||
<span style="color: #008080;">for</span> <span style="color: #000000;">i</span><span style="color: #0000FF;">=</span><span style="color: #000000;">1</span> <span style="color: #008080;">to</span> <span style="color: #000000;">8</span> <span style="color: #008080;">do</span>
|
||||
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"%s\n"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">tm</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #000000;">tm</span> <span style="color: #0000FF;">&=</span> <span style="color: #7060A8;">sq_sub</span><span style="color: #0000FF;">(</span><span style="color: #008000;">'0'</span><span style="color: #0000FF;">+</span><span style="color: #008000;">'1'</span><span style="color: #0000FF;">,</span><span style="color: #000000;">tm</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span>
|
||||
<!--
|
||||
string tm = "0"
|
||||
for i=1 to 8 do
|
||||
printf(1,"%s\n",tm)
|
||||
tm &= sq_sub('0'+'1',tm)
|
||||
end for
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
function New-ThueMorse ( $Digits )
|
||||
{
|
||||
# Start with seed 0
|
||||
$ThueMorse = "0"
|
||||
|
||||
# Decrement digits remaining
|
||||
$Digits--
|
||||
|
||||
# While we still have digits to calculate...
|
||||
While ( $Digits -gt 0 )
|
||||
{
|
||||
# Number of digits we'll get this loop (what we still need up to the maximum available), corrected to 0 base
|
||||
$LastDigit = [math]::Min( $ThueMorse.Length, $Digits ) - 1
|
||||
|
||||
# Loop through each digit
|
||||
ForEach ( $i in 0..$LastDigit )
|
||||
{
|
||||
# Append the twos complement
|
||||
$ThueMorse += ( 1 - $ThueMorse.Substring( $i, 1 ) )
|
||||
}
|
||||
|
||||
# Calculate the number of digits still remaining
|
||||
$Digits = $Digits - $LastDigit - 1
|
||||
}
|
||||
|
||||
return $ThueMorse
|
||||
}
|
||||
|
||||
New-ThueMorse 5
|
||||
New-ThueMorse 16
|
||||
New-ThueMorse 73
|
||||
Loading…
Add table
Add a link
Reference in a new issue