Skip to content
Snippets Groups Projects
Verified Commit c617a948 authored by mirabilos's avatar mirabilos Committed by mirabilos
Browse files

wtf…

parent 7eee4aae
No related branches found
No related tags found
No related merge requests found
#!/bin/mksh
file=i
w=101
h=103
{
print -r -- "h=$h"
print -r -- "u=$w"
cat <<-\EOF
a=0
b=0
c=0
d=0
e=(u-1)/2
f=(h-1)/2
define r(s,t,v,w) {
auto x, y
x = (s + n * v) % u
if (x < 0) x += u
y = (t + n * w) % h
if (y < 0) y += h
#print "z[",y," * W + ", x, " = ", y*u+x, "] = ", z[y*u+x], "\n"
if (z[y*u+x] == 1) return (1)
z[y*u+x] = 1
return (0)
}
define void q() {
auto n, q, x, y
n = 0
q = 1
while (q < 100) {
n += 1
if (p() == 0) {
q += 1
}
}
}
define p() {
auto x, y, z[]
EOF
sed -e 's/p=/if (r(/' -e 's/ v=/,/' -e 's/$/) == 1) return (1)/' <"$file"
cat <<-\EOF
for (y = 0; y < h; ++y) {
print " | "
for (x = 0; x < u; ++x) {
if (z[y*u+x] == 1) {
print "#"
} else {
print "."
}
}
print "\n"
}
print "n = ", n, "\n"
return (0)
}
q()
EOF
} | BC_LINE_LENGTH=120 bc
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment