Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,53 +0,0 @@
|
|||
with Ada.Text_Io; use Ada.Text_Io;
|
||||
with Ada.Strings.Fixed;
|
||||
with Interfaces; use Interfaces;
|
||||
|
||||
procedure Sieteri_Triangles is
|
||||
subtype Practical_Order is Unsigned_32 range 0..4;
|
||||
|
||||
|
||||
function Pow(X : Unsigned_32; N : Unsigned_32) return Unsigned_32 is
|
||||
begin
|
||||
if N = 0 then
|
||||
return 1;
|
||||
else
|
||||
return X * Pow(X, N - 1);
|
||||
end if;
|
||||
end Pow;
|
||||
|
||||
procedure Print(Item : Unsigned_32) is
|
||||
use Ada.Strings.Fixed;
|
||||
package Ord_Io is new Ada.Text_Io.Modular_Io(Unsigned_32);
|
||||
use Ord_Io;
|
||||
Temp : String(1..36) := (others => ' ');
|
||||
First : Positive;
|
||||
Last : Positive;
|
||||
begin
|
||||
Put(To => Temp, Item => Item, Base => 2);
|
||||
First := Index(Temp, "#") + 1;
|
||||
Last := Index(Temp(First..Temp'Last), "#") - 1;
|
||||
for I in reverse First..Last loop
|
||||
if Temp(I) = '0' then
|
||||
Put(' ');
|
||||
else
|
||||
Put(Temp(I));
|
||||
end if;
|
||||
end loop;
|
||||
New_Line;
|
||||
end Print;
|
||||
|
||||
procedure Sierpinski (N : Practical_Order) is
|
||||
Size : Unsigned_32 := Pow(2, N);
|
||||
V : Unsigned_32 := Pow(2, Size);
|
||||
begin
|
||||
for I in 0..Size - 1 loop
|
||||
Print(V);
|
||||
V := Shift_Left(V, 1) xor Shift_Right(V,1);
|
||||
end loop;
|
||||
end Sierpinski;
|
||||
|
||||
begin
|
||||
for N in Practical_Order loop
|
||||
Sierpinski(N);
|
||||
end loop;
|
||||
end Sieteri_Triangles;
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
with Ada.Command_Line;
|
||||
with Ada.Text_IO;
|
||||
|
||||
procedure Main is
|
||||
subtype Order is Natural range 1 .. 32;
|
||||
type Mod_Int is mod 2 ** Order'Last;
|
||||
|
||||
procedure Sierpinski (N : Order) is
|
||||
begin
|
||||
for Line in Mod_Int range 0 .. 2 ** N - 1 loop
|
||||
for Col in Mod_Int range 0 .. 2 ** N - 1 loop
|
||||
if (Line and Col) = 0 then
|
||||
Ada.Text_IO.Put ('X');
|
||||
else
|
||||
Ada.Text_IO.Put (' ');
|
||||
end if;
|
||||
end loop;
|
||||
Ada.Text_IO.New_Line;
|
||||
end loop;
|
||||
end Sierpinski;
|
||||
|
||||
N : Order := 4;
|
||||
begin
|
||||
if Ada.Command_Line.Argument_Count = 1 then
|
||||
N := Order'Value (Ada.Command_Line.Argument (1));
|
||||
end if;
|
||||
Sierpinski (N);
|
||||
end Main;
|
||||
|
|
@ -3,8 +3,8 @@ sierpinski: function [order][
|
|||
loop (s-1)..0 'y [
|
||||
do.times: y -> prints " "
|
||||
loop 0..dec s-y 'x [
|
||||
if? zero? and x y -> prints "* "
|
||||
else -> prints " "
|
||||
switch zero? and x y -> prints "* "
|
||||
-> prints " "
|
||||
]
|
||||
print ""
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
identification division.
|
||||
program-id. sierpinski-triangle-program.
|
||||
data division.
|
||||
working-storage section.
|
||||
01 sierpinski.
|
||||
05 n pic 99.
|
||||
05 i pic 999.
|
||||
05 k pic 999.
|
||||
05 m pic 999.
|
||||
05 c pic 9(18).
|
||||
05 i-limit pic 999.
|
||||
05 q pic 9(18).
|
||||
05 r pic 9.
|
||||
procedure division.
|
||||
control-paragraph.
|
||||
move 4 to n.
|
||||
multiply n by 4 giving i-limit.
|
||||
subtract 1 from i-limit.
|
||||
perform sierpinski-paragraph
|
||||
varying i from 0 by 1 until i is greater than i-limit.
|
||||
stop run.
|
||||
sierpinski-paragraph.
|
||||
subtract i from i-limit giving m.
|
||||
multiply m by 2 giving m.
|
||||
perform m times,
|
||||
display space with no advancing,
|
||||
end-perform.
|
||||
move 1 to c.
|
||||
perform inner-loop-paragraph
|
||||
varying k from 0 by 1 until k is greater than i.
|
||||
display ''.
|
||||
inner-loop-paragraph.
|
||||
divide c by 2 giving q remainder r.
|
||||
if r is equal to zero then display ' * ' with no advancing.
|
||||
if r is not equal to zero then display ' ' with no advancing.
|
||||
compute c = c * (i - k) / (k + 1).
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
procedure triangle(integer x, integer y, integer len, integer n)
|
||||
if n = 0 then
|
||||
position(y,x) puts(1,'*')
|
||||
else
|
||||
triangle (x, y+len, floor(len/2), n-1)
|
||||
triangle (x+len, y, floor(len/2), n-1)
|
||||
triangle (x+len*2, y+len, floor(len/2), n-1)
|
||||
end if
|
||||
end procedure
|
||||
|
||||
clear_screen()
|
||||
triangle(1,1,8,4)
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
class Main
|
||||
{
|
||||
static function main()
|
||||
{
|
||||
triangle(3);
|
||||
}
|
||||
|
||||
static inline var SPACE = ' ';
|
||||
static inline var STAR = '*';
|
||||
|
||||
static function triangle(o) {
|
||||
var n = 1 << o;
|
||||
var line = new Array<String>();
|
||||
|
||||
for (i in 0...(n*2)) line[i] = SPACE;
|
||||
|
||||
line[n] = '*';
|
||||
|
||||
for (i in 0...n) {
|
||||
Sys.println(line.join(''));
|
||||
var u ='*';
|
||||
var start = n - i;
|
||||
var end = n + i + 1;
|
||||
var t = SPACE;
|
||||
for (j in start...end) {
|
||||
t = (line[j-1] == line[j+1] ? SPACE : STAR);
|
||||
line[j-1] = u;
|
||||
u = t;
|
||||
}
|
||||
|
||||
line[n+i] = t;
|
||||
line[n+i+1] = STAR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
function triangle($o) {
|
||||
$n = [Math]::Pow(2, $o)
|
||||
$line = ,' '*(2*$n+1)
|
||||
$line[$n] = '█'
|
||||
$OFS = ''
|
||||
for ($i = 0; $i -lt $n; $i++) {
|
||||
Write-Host $line
|
||||
$u = '█'
|
||||
for ($j = $n - $i; $j -lt $n + $i + 1; $j++) {
|
||||
if ($line[$j-1] -eq $line[$j+1]) {
|
||||
$t = ' '
|
||||
} else {
|
||||
$t = '█'
|
||||
}
|
||||
$line[$j-1] = $u
|
||||
$u = $t
|
||||
}
|
||||
$line[$n+$i] = $t
|
||||
$line[$n+$i+1] = '█'
|
||||
}
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
Sub triangle(o)
|
||||
n = 2 ^ o
|
||||
Dim line()
|
||||
ReDim line(2*n)
|
||||
line(n) = "*"
|
||||
i = 0
|
||||
Do While i < n
|
||||
WScript.StdOut.WriteLine Join(line,"")
|
||||
u = "*"
|
||||
j = n - i
|
||||
Do While j < (n+i+1)
|
||||
If line(j-1) = line(j+1) Then
|
||||
t = " "
|
||||
Else
|
||||
t = "*"
|
||||
End If
|
||||
line(j-1) = u
|
||||
u = t
|
||||
j = j + 1
|
||||
Loop
|
||||
line(n+i) = t
|
||||
line(n+i+1) = "*"
|
||||
i = i + 1
|
||||
Loop
|
||||
End Sub
|
||||
|
||||
triangle(4)
|
||||
Loading…
Add table
Add a link
Reference in a new issue