Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/2dim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type CA2d

h, w = size(init)
cells = Array(Int8, h, w, gen)
cells[:, :, 1] = int8(init[:, :])
cells[:, :, 1] = round(Int8, init[:, :])

for g = 2:gen
for i = 1:h, j = 1:w
Expand Down
7 changes: 4 additions & 3 deletions test/conway_test.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
module ConwayTest

using Base.Test
using Compat

using CellularAutomata
export blinker_test, turbine_test

# Function to test Conway's blinker oscillator and toad oscillator
function blinker_test()
init = int(zeros(10,10))
init = round(Int, zeros(10,10))

# 'Toad Oscillator'
init[6, 4] = 1
Expand Down Expand Up @@ -38,9 +39,9 @@ function blinker_test()
@test ca.cells[:, :, 8] == ca.cells[:, :, 6]
end

# Function to test Conway's turbine automota which repeats every ninth step
# Function to test Conway's turbine automata which repeats every ninth step
function turbine_test()
init = int(zeros(20,20))
init = @compat round(Int64, zeros(20,20))
init[4, 4:9] = 1
init[5, 4:9] = 1

Expand Down