June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -1,9 +1,9 @@
function next_gen(a::BitArray{1}, isperiodic=false)
b = copy(a)
if isperiodic
ncnt = [a[end], a[1:end-1]] + [a[2:end], a[1]]
ncnt = prepend!(a[1:end-1], [a[end]]) + append!(a[2:end], [a[1]])
else
ncnt = [false, a[1:end-1]] + [a[2:end], false]
ncnt = prepend!(a[1:end-1], [false]) + append!(a[2:end], [false])
end
b[ncnt .== 0] = false
b[ncnt .== 2] = ~b[ncnt .== 2]
@ -16,7 +16,7 @@ function show_gen(a::BitArray{1})
end
hi = 70
a = randbool(hi)
a = bitrand(hi)
b = falses(hi)
println("A 1D Cellular Atomaton with ", hi, " cells and empty bounds.")
while any(a) && any(a .!= b)
@ -24,7 +24,7 @@ while any(a) && any(a .!= b)
b = copy(a)
a = next_gen(a)
end
a = randbool(hi)
a = bitrand(hi)
b = falses(hi)
println()
println("A 1D Cellular Atomaton with ", hi, " cells and periodic bounds.")