I haven’t tried drawing it yet, not currently having a suitable library installed, but this might work… I fixed up the Algol from the article, then hand translated from Algol to Imp followed by a machine translation from Imp to C…
// cc -o schotter schotter.c -lm
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(int argc, char **argv) {
double X, Y;
void Open(double X, double Y) {}
void Close(void) {}
void Leer(double X, double Y) { printf("\nMoveto(%d, %d)\n", (int)round(X), (int)round(Y)); }
void Line(double X, double Y) { printf("Lineto(%d, %d)\n", (int)round(X), (int)round(Y)); }
void Sonk(int X) {}
double J(double Ja, double Je) { // ZUFALLS-GENERATOR J
static double Ji = 1306859721;
Ji = 5 * Ji;
if (Ji >= 8589934592) Ji -= 8589934592;
if (Ji >= 4294967296) Ji -= 4294967296;
if (Ji >= 2147483648) Ji -= 2147483648;
return ((Ji / 2147483648) * (Je - Ja) + Ja);
}
// SCHOTTER
double R, Pihalb, Pi4t, P, Q, P1, Q1, Xm, Ym, Hor, Ver, Jli, Jre, Jun, Job;
int I, M, T;
void Serie(double Quer, double Hoch, int Xmal, int Ymal, void Figur(void)) {
double Yanf;
int Countx, County;
P = -Quer * Xmal * .5;
Yanf = -Hoch * Ymal * .5;
Q = Yanf;
for (Countx = 1; Countx <= Xmal; Countx++) {
Q = Yanf;
for (County = 1; County <= Ymal; County++) {
Figur();
Q += Hoch;
}
P += Quer;
}
Leer(-148.0, -105.0);
Close();
Sonk(11);
Open(X, Y);
}
void Quad(void) {
double P1, Q1, Psi, Ja1, Je1, Ja2, Je2;
int S;
Je1 = 5 * 1 / 264;
Ja1 = -Je1;
Je2 = Pi4t * (1 + (I / 264));
Ja2 = Pi4t * (1 - (I / 264));
P1 = P + 5 + J(Ja1, Je1);
Q1 = Q + 5 + J(Ja1, Je1);
Psi = J(Ja2, Je2);
Leer(P1 + R * cos(Psi), Q1 + R * sin(Psi));
for (S = 1; S <= 4; S++) {
Psi += Pihalb;
Line(P1 + R * cos(Psi), Q1 + R * sin(Psi));
}
I++;
}
X = Y = 0;
Open(X, Y);
R = 5 * 1.4142;
Pihalb = 3.14159 * .5;
Pi4t = Pihalb * .5;
I = 0;
Serie(10.0, 10.0, 22, 12, &Quad);
Close();
exit(0);
return (1);
}
If you’re interested, here’s the Algol… in Unicode encoding, close to publication syntax.
b̲e̲g̲i̲n̲
r̲e̲a̲l̲ X, Y;
p̲r̲o̲c̲e̲d̲u̲r̲e̲ OPEN(X, Y);
v̲a̲l̲u̲e̲ X, Y;
r̲e̲a̲l̲ X, Y;
b̲e̲g̲i̲n̲
e̲n̲d̲ OPEN;
p̲r̲o̲c̲e̲d̲u̲r̲e̲ CLOSE;
b̲e̲g̲i̲n̲
e̲n̲d̲ CLOSE;
p̲r̲o̲c̲e̲d̲u̲r̲e̲ LEER(X, Y);
v̲a̲l̲u̲e̲ X, Y;
r̲e̲a̲l̲ X, Y;
b̲e̲g̲i̲n̲
c̲o̲m̲m̲e̲n̲t̲ MOVETO;
e̲n̲d̲ LEER;
p̲r̲o̲c̲e̲d̲u̲r̲e̲ LINE(X, Y);
v̲a̲l̲u̲e̲ X, Y;
r̲e̲a̲l̲ X, Y;
b̲e̲g̲i̲n̲
e̲n̲d̲ LINE;
p̲r̲o̲c̲e̲d̲u̲r̲e̲ SONK(X);
v̲a̲l̲u̲e̲ X;
i̲n̲t̲e̲g̲e̲r̲ X;
b̲e̲g̲i̲n̲
e̲n̲d̲ SONK;
r̲e̲a̲l̲ p̲r̲o̲c̲e̲d̲u̲r̲e̲ COS(A);
v̲a̲l̲u̲e̲ A;
r̲e̲a̲l̲ A;
b̲e̲g̲i̲n̲
COS := 0·0;
e̲n̲d̲ COS;
r̲e̲a̲l̲ p̲r̲o̲c̲e̲d̲u̲r̲e̲ SIN(A);
v̲a̲l̲u̲e̲ A;
r̲e̲a̲l̲ A;
b̲e̲g̲i̲n̲
SIN := 0·0;
e̲n̲d̲ SIN;
i̲n̲t̲e̲g̲e̲r̲ JI;
r̲e̲a̲l̲ p̲r̲o̲c̲e̲d̲u̲r̲e̲ J(JA, JE);
v̲a̲l̲u̲e̲ JA, JE;
r̲e̲a̲l̲ JA, JE;
b̲e̲g̲i̲n̲
c̲o̲m̲m̲e̲n̲t̲ ZUFALLS-GENERATOR J;
JI := 5×JI;
i̲f̲ JI ≥ 8589934592 t̲h̲e̲n̲ JI := JI - 8589934592;
i̲f̲ JI ≥ 4294967296 t̲h̲e̲n̲ JI := JI - 4294967296;
i̲f̲ JI ≥ 2147483648 t̲h̲e̲n̲ JI := JI - 2147483648;
J := JI/2147483648×(JE-JA) + JA
e̲n̲d̲ ZUFALLS GENERATOR J;
c̲o̲m̲m̲e̲n̲t̲ SCHOTTER;
r̲e̲a̲l̲ R, PIHALB, PI4T;
r̲e̲a̲l̲ P, Q, P1, Q1, XM, YM, HOR, VER, JLI, JRE, JUN, JOB;
i̲n̲t̲e̲g̲e̲r̲ I, M, T;
p̲r̲o̲c̲e̲d̲u̲r̲e̲ SERIE(QUER, HOCH, XMAL, YMAL, FIGUR);
v̲a̲l̲u̲e̲ QUER, HOCH, XMAL, YMAL;
r̲e̲a̲l̲ QUER, HOCH;
i̲n̲t̲e̲g̲e̲r̲ XMAL, YMAL;
p̲r̲o̲c̲e̲d̲u̲r̲e̲ FIGUR;
b̲e̲g̲i̲n̲
r̲e̲a̲l̲ YANF;
i̲n̲t̲e̲g̲e̲r̲ COUNTX, COUNTY;
P := -QUER×XMAL×·5;
Q := YANF := -HOCH×YMAL×·5;
f̲o̲r̲ COUNTX := 1 s̲t̲e̲p̲ 1 u̲n̲t̲i̲l̲ XMAL d̲o̲
b̲e̲g̲i̲n̲
Q := YANF;
f̲o̲r̲ COUNTY := 1 s̲t̲e̲p̲ 1 u̲n̲t̲i̲l̲ YMAL d̲o̲
b̲e̲g̲i̲n̲
FIGUR;
Q := Q+HOCH
e̲n̲d̲;
P := P+QUER
e̲n̲d̲;
LEER(-148·0, -105·0);
CLOSE;
SONK(11);
OPEN(X, Y);
e̲n̲d̲ SERIE;
p̲r̲o̲c̲e̲d̲u̲r̲e̲ QUAD;
b̲e̲g̲i̲n̲
r̲e̲a̲l̲ P1, Q1, PSI, JA1, JE1, JA2, JE2;
i̲n̲t̲e̲g̲e̲r̲ S;
JE1 := 5×1/264;
JA1 := -JE1;
JE2 := PI4T×(1+I/264);
JA2 := PI4T×(1-I/264);
P1 := P+5+J(JA1, JE1);
Q1 := Q+5+J(JA1, JE1);
PSI := J(JA2, JE2);
LEER(P1+R×COS(PSI), Q1+R×SIN(PSI));
f̲o̲r̲ S := 1 s̲t̲e̲p̲ 1 u̲n̲t̲i̲l̲ 4 d̲o̲
b̲e̲g̲i̲n̲
PSI := PSI+PIHALB;
LINE(P1+R×COS(PSI), Q1+R×SIN(PSI));
e̲n̲d̲;
I := I+1
e̲n̲d̲ QUAD;
X := Y := 0;
OPEN(X, Y);
JI := 1306859721;
R := 5×1·4142;
PIHALB := 3·14159×·5;
PI4T := PIHALB×·5;
I := 0;
SERIE(10·0, 10·0, 22, 12, QUAD)
CLOSE;
e̲n̲d̲ SCHOTTER;
And just for grins, here’s the Imp version…
%begin
%external %long %real %fn %spec cos %alias "cos" (%long %real angle) ;! C's "double cos(double x)"
%external %long %real %fn %spec sin %alias "sin" (%long %real angle)
%long %real X, Y
%routine OPEN(%long %real X, Y)
%end; ! OPEN
%routine CLOSE
%end; ! CLOSE
%routine LEER(%long %real X, Y); ! MOVETO
newline; print string("Moveto("); print(X,6); print string(", "); print(Y,6); print string(")"); newline
%end; ! LEER
%routine LINE(%long %real X, Y)
print string("Lineto("); print(X,6); print string(", "); print(Y,6); print string(")"); newline
%end; ! LINE
%routine SONK(%integer X)
%end; ! SONK
%long %real JI
%long %real %function J(%long %real JA, JE)
%comment ZUFALLS-GENERATOR J
JI = 5 * JI
%if JI >= 8589934592 %then JI = JI - 8589934592
%if JI >= 4294967296 %then JI = JI - 4294967296
%if JI >= 2147483648 %then JI = JI - 2147483648
%result = JI/2147483648 * (JE-JA) + JA
%end; ! ZUFALLS GENERATOR J
%comment SCHOTTER
%long %real R, PIHALB, PI4T
%long %real P, Q, P1, Q1, XM, YM, HOR, VER, JLI, JRE, JUN, JOB
%integer I, M, T
%routine SERIE(%long %real QUER, HOCH, %integer XMAL, YMAL, %routine FIGUR)
%long %real YANF
%integer COUNTX, COUNTY
P = -QUER * XMAL * .5
YANF = -HOCH * YMAL * .5; Q = YANF
%for COUNTX = 1, 1, XMAL %cycle
Q = YANF
%for COUNTY = 1, 1, YMAL %cycle
FIGUR
Q = Q+HOCH
%repeat
P = P+QUER
%repeat
LEER(-148.0, -105.0)
CLOSE
SONK(11)
OPEN(X, Y)
%end; ! SERIE
%routine QUAD
%long %real P1, Q1, PSI, JA1, JE1, JA2, JE2
%integer S
JE1 = 5 * 1/264
JA1 = -JE1
JE2 = PI4T * (1+I/264)
JA2 = PI4T * (1-I/264)
P1 = P+5+J(JA1, JE1)
Q1 = Q+5+J(JA1, JE1)
PSI = J(JA2, JE2)
LEER(P1+R * cos(PSI), Q1+R * sin(PSI))
%for S = 1, 1, 4 %cycle
PSI = PSI+PIHALB
LINE(P1+R * cos(PSI), Q1+R * sin(PSI))
%repeat
I = I+1
%end; ! QUAD
Y = 0; X = Y
OPEN(X, Y)
JI = 1306859721
R = 5 * 1.4142
PIHALB = 3.14159 * .5
PI4T = PIHALB * .5
I = 0
SERIE(10.0, 10.0, 22, 12, QUAD)
CLOSE
%end %of %program; ! SCHOTTER