Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
|
|
@ -0,0 +1,21 @@
|
|||
#include <basico.h>
|
||||
|
||||
algoritmo
|
||||
tamaño de pila 65
|
||||
x = 0
|
||||
enlistar (0,0,1,1,1,0,0,1,1,0,1,0,1,1,0,1,1,1,0,0,\
|
||||
1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,0,1,0,0,\
|
||||
1,1,0,0,0,0,0,1,0,1,0,1,1,1,1,1,1,1,0,0) mover a 'x'
|
||||
x2 = x
|
||||
decimales '0', token.separador ("")
|
||||
iterar para ( k=1, #(k<=15), ++k )
|
||||
imprimir ' #(utf8("Generación #")),k, "\t", x, NL '
|
||||
iterar para ( j=2, #(j<60), ++j )
|
||||
#(x2[j] = 0)
|
||||
cuando ( #( (x[j-1]+x[j]+x[j+1])==2 ) ){
|
||||
#(x2[j]=1)
|
||||
}
|
||||
siguiente
|
||||
x = x2
|
||||
siguiente
|
||||
terminar
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
#include <basico.h>
|
||||
|
||||
algoritmo
|
||||
x={}
|
||||
'0,0,1,1,1,0,0,1,1,0,1,0,1,1,0,1,1,1,0,0' anidar en lista 'x'
|
||||
'1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,0,1,0,0' anidar en lista 'x'
|
||||
'1,1,0,0,0,0,0,1,0,1,0,1,1,1,1,1,1,1,0,0' anidar en lista 'x'
|
||||
|
||||
x2 = x, k=10
|
||||
decimales '0', token.separador ("")
|
||||
iterar
|
||||
imprimir ' #(utf8("Generación #")), #(11-k), "\t", x, NL '
|
||||
iterar para ( j=2, #(j<60), ++j )
|
||||
#( x2[j] = ((x[j-1]+x[j]+x[j+1])==2) )
|
||||
siguiente
|
||||
x = x2
|
||||
mientras ' k-- '
|
||||
terminar
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
map[] = [ 0 0 0 1 0 1 1 0 ]
|
||||
cell[] = [ 0 1 1 1 0 1 1 0 1 0 1 0 1 0 1 0 0 1 0 0 ]
|
||||
len celln[] len cell[]
|
||||
proc evolve . .
|
||||
for i = 2 to len cell[] - 1
|
||||
ind = cell[i - 1] + 2 * cell[i] + 4 * cell[i + 1] + 1
|
||||
celln[i] = map[ind]
|
||||
.
|
||||
swap celln[] cell[]
|
||||
.
|
||||
proc show . .
|
||||
for v in cell[]
|
||||
if v = 1
|
||||
write "#"
|
||||
else
|
||||
write "."
|
||||
.
|
||||
.
|
||||
print ""
|
||||
.
|
||||
show
|
||||
for i to 9
|
||||
evolve
|
||||
show
|
||||
.
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
automaton(g::Vector{Bool}) =
|
||||
for i ∈ 0:9
|
||||
println(join(alive ? '#' : '_' for alive ∈ g))
|
||||
g = ([false; g[1:end-1]] .+ g .+ [g[2:end]; false]) .== 2
|
||||
end
|
||||
|
||||
automaton([c == '#' for c ∈ "_###_##_#_#_#_#__#__"])
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
struct Automaton g₀::Vector{Bool} end
|
||||
|
||||
Base.iterate(a::Automaton, g = a.g₀) =
|
||||
g, ([false; g[1:end-1]] .+ g .+ [g[2:end]; false]) .== 2
|
||||
|
||||
Base.show(io::IO, a::Automaton) = for g in Iterators.take(a, 10)
|
||||
println(io, join(alive ? '#' : '_' for alive ∈ g)) end
|
||||
|
||||
Automaton([c == '#' for c ∈ "_###_##_#_#_#_#__#__"])
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
function next_gen(a::BitArray{1}, isperiodic=false)
|
||||
b = copy(a)
|
||||
if isperiodic
|
||||
ncnt = prepend!(a[1:end-1], [a[end]]) + append!(a[2:end], [a[1]])
|
||||
else
|
||||
ncnt = prepend!(a[1:end-1], [false]) + append!(a[2:end], [false])
|
||||
end
|
||||
b[ncnt .== 0] = false
|
||||
b[ncnt .== 2] = ~b[ncnt .== 2]
|
||||
return b
|
||||
end
|
||||
|
||||
function show_gen(a::BitArray{1})
|
||||
s = join([i ? "\u2588" : " " for i in a], "")
|
||||
s = "\u25ba"*s*"\u25c4"
|
||||
end
|
||||
|
||||
hi = 70
|
||||
a = bitrand(hi)
|
||||
b = falses(hi)
|
||||
println("A 1D Cellular Atomaton with ", hi, " cells and empty bounds.")
|
||||
while any(a) && any(a .!= b)
|
||||
println(" ", show_gen(a))
|
||||
b = copy(a)
|
||||
a = next_gen(a)
|
||||
end
|
||||
a = bitrand(hi)
|
||||
b = falses(hi)
|
||||
println()
|
||||
println("A 1D Cellular Atomaton with ", hi, " cells and periodic bounds.")
|
||||
while any(a) && any(a .!= b)
|
||||
println(" ", show_gen(a))
|
||||
b = copy(a)
|
||||
a = next_gen(a, true)
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue