diff --git a/src/2dim.jl b/src/2dim.jl index d3c1fb8..a3bb104 100644 --- a/src/2dim.jl +++ b/src/2dim.jl @@ -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 diff --git a/test/conway_test.jl b/test/conway_test.jl index 93e28ae..36296df 100644 --- a/test/conway_test.jl +++ b/test/conway_test.jl @@ -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 @@ -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