diff --git a/docs/build/index.html b/docs/build/index.html index a905857..20ea03f 100644 --- a/docs/build/index.html +++ b/docs/build/index.html @@ -1,2 +1,3 @@ -CellularAutomata.jl · CellularAutomata.jl

CellularAutomata.jl

This package is meant to be a complete Open source reference for everything regarding Cellular Automata. In it you will find wayd to create one and two dimensional Cellular Automata models and functions to analyze them

Contributions

Contributions are more than welcomed! The package is in the early days, so expet things to change a lot. For everything do contact me or open an issue about it.

+CellularAutomata.jl · CellularAutomata.jl

CellularAutomata.jl

This package is meant to be a complete Open source reference for everything regarding Cellular Automata. In it you will find wayd to create one and two dimensional Cellular Automata models and functions to analyze them

General usage

The main function is given by CellularAutomaton

CellularAutomata.CellularAutomatonType
CellularAutomaton(rule::AbstractODRule, initial_conditions, generations)
+CellularAutomaton(rule::AbstractTDRule, initial_conditions, generations)

Given a cellular automata rule (inluded in the library or provided by the user) returns a CellularAutomaton evolution with given initial conditions and number of generations. OD indicates one-diomensional cellular automata rules, TD indicates two-dimensiona cellular automata rules.

source

where rule is a function returning the next state of the Cellular Automata.

Contributions

Contributions are more than welcomed! The package is in the early days, so expet things to change a lot. For everything do contact me or open an issue about it.

diff --git a/docs/build/onedim/onedimensionca/index.html b/docs/build/onedim/onedimensionca/index.html index ae8d2cb..935cce2 100644 --- a/docs/build/onedim/onedimensionca/index.html +++ b/docs/build/onedim/onedimensionca/index.html @@ -1,2 +1,2 @@ -One dimensional CA · CellularAutomata.jl
+One dimensional CA · CellularAutomata.jl
diff --git a/docs/build/search/index.html b/docs/build/search/index.html index a9770d1..af05ce7 100644 --- a/docs/build/search/index.html +++ b/docs/build/search/index.html @@ -1,2 +1,2 @@ -Search · CellularAutomata.jl

Loading search...

    +Search · CellularAutomata.jl

    Loading search...

      diff --git a/docs/build/search_index.js b/docs/build/search_index.js index 0ac141c..0542116 100644 --- a/docs/build/search_index.js +++ b/docs/build/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"onedim/onedimensionca/#General-Cellular-Automata","page":"One dimensional CA","title":"General Cellular Automata","text":"","category":"section"},{"location":"onedim/onedimensionca/","page":"One dimensional CA","title":"One dimensional CA","text":"Some text here and there","category":"page"},{"location":"onedim/onedimensionca/#Elementary-Cellular-Automata","page":"One dimensional CA","title":"Elementary Cellular Automata","text":"","category":"section"},{"location":"onedim/onedimensionca/","page":"One dimensional CA","title":"One dimensional CA","text":"Some text here and there","category":"page"},{"location":"onedim/onedimensionca/#Multiple-States-Cellular-Automata","page":"One dimensional CA","title":"Multiple States Cellular Automata","text":"","category":"section"},{"location":"onedim/onedimensionca/","page":"One dimensional CA","title":"One dimensional CA","text":"Some text here and there","category":"page"},{"location":"onedim/onedimensionca/#Larger-Radius-Cellular-Automata","page":"One dimensional CA","title":"Larger Radius Cellular Automata","text":"","category":"section"},{"location":"onedim/onedimensionca/","page":"One dimensional CA","title":"One dimensional CA","text":"Some text here and there","category":"page"},{"location":"user/twodimensionca/#Life-like-Cellular-Automata","page":"Two Dimensial CA","title":"Life-like Cellular Automata","text":"","category":"section"},{"location":"user/twodimensionca/","page":"Two Dimensial CA","title":"Two Dimensial CA","text":" Life","category":"page"},{"location":"user/twodimensionca/#CellularAutomata.Life","page":"Two Dimensial CA","title":"CellularAutomata.Life","text":"Life(life_description; radius=1)\n\nReturns a Life object given a tuple of tuples that follows the Golly notation ((b), (s)), where b stands for birth and s for survival. These values indicates the number of neighbouring cells needed to birth a new one in the following generation, or to make the current alive one survive.\n\n\n\n\n\n","category":"type"},{"location":"user/onedimensionca/#General-Dicrete-Cellular-Automata","page":"One Dimensional CA","title":"General Dicrete Cellular Automata","text":"","category":"section"},{"location":"user/onedimensionca/","page":"One Dimensional CA","title":"One Dimensional CA","text":" DCA","category":"page"},{"location":"user/onedimensionca/#CellularAutomata.DCA","page":"One Dimensional CA","title":"CellularAutomata.DCA","text":"DCA(rule; states=2, radius=1)\n\nReturns a DCA object given a specific rule, number of states and radius. The ruleset for the rule is computed and stored in the struct as well.\n\n\n\n\n\n","category":"type"},{"location":"user/onedimensionca/#Totalistic-Discrete-Cellular-Automata","page":"One Dimensional CA","title":"Totalistic Discrete Cellular Automata","text":"","category":"section"},{"location":"user/onedimensionca/","page":"One Dimensional CA","title":"One Dimensional CA","text":" TCA","category":"page"},{"location":"user/onedimensionca/#CellularAutomata.TCA","page":"One Dimensional CA","title":"CellularAutomata.TCA","text":"(tca::TCA)(starting_array)\n\nReturns the next state of the given starting_array according to the evolution rule contained in the TCA struct.\n\n\n\n\n\n","category":"type"},{"location":"user/onedimensionca/#Continous-Cellular-Automata","page":"One Dimensional CA","title":"Continous Cellular Automata","text":"","category":"section"},{"location":"user/onedimensionca/","page":"One Dimensional CA","title":"One Dimensional CA","text":" CCA","category":"page"},{"location":"user/onedimensionca/#CellularAutomata.CCA","page":"One Dimensional CA","title":"CellularAutomata.CCA","text":"(cca::CCA)(starting_array)\n\nReturns the next state of the given starting_array according to the evolution rule contained in the CCA struct.\n\n\n\n\n\n","category":"type"},{"location":"#CellularAutomata.jl","page":"CellularAutomata.jl","title":"CellularAutomata.jl","text":"","category":"section"},{"location":"","page":"CellularAutomata.jl","title":"CellularAutomata.jl","text":"This package is meant to be a complete Open source reference for everything regarding Cellular Automata. In it you will find wayd to create one and two dimensional Cellular Automata models and functions to analyze them","category":"page"},{"location":"#Contributions","page":"CellularAutomata.jl","title":"Contributions","text":"","category":"section"},{"location":"","page":"CellularAutomata.jl","title":"CellularAutomata.jl","text":"Contributions are more than welcomed! The package is in the early days, so expet things to change a lot. For everything do contact me or open an issue about it.","category":"page"}] +[{"location":"onedim/onedimensionca/#General-Cellular-Automata","page":"One dimensional CA","title":"General Cellular Automata","text":"","category":"section"},{"location":"onedim/onedimensionca/","page":"One dimensional CA","title":"One dimensional CA","text":"Some text here and there","category":"page"},{"location":"onedim/onedimensionca/#Elementary-Cellular-Automata","page":"One dimensional CA","title":"Elementary Cellular Automata","text":"","category":"section"},{"location":"onedim/onedimensionca/","page":"One dimensional CA","title":"One dimensional CA","text":"Some text here and there","category":"page"},{"location":"onedim/onedimensionca/#Multiple-States-Cellular-Automata","page":"One dimensional CA","title":"Multiple States Cellular Automata","text":"","category":"section"},{"location":"onedim/onedimensionca/","page":"One dimensional CA","title":"One dimensional CA","text":"Some text here and there","category":"page"},{"location":"onedim/onedimensionca/#Larger-Radius-Cellular-Automata","page":"One dimensional CA","title":"Larger Radius Cellular Automata","text":"","category":"section"},{"location":"onedim/onedimensionca/","page":"One dimensional CA","title":"One dimensional CA","text":"Some text here and there","category":"page"},{"location":"user/twodimensionca/#Life-like-Cellular-Automata","page":"Two Dimensial CA","title":"Life-like Cellular Automata","text":"","category":"section"},{"location":"user/twodimensionca/","page":"Two Dimensial CA","title":"Two Dimensial CA","text":" Life","category":"page"},{"location":"user/twodimensionca/#CellularAutomata.Life","page":"Two Dimensial CA","title":"CellularAutomata.Life","text":"Life(life_description; radius=1)\n\nReturns a Life object given a tuple of tuples that follows the Golly notation ((b), (s)), where b stands for birth and s for survival. These values indicates the number of neighbouring cells needed to birth a new one in the following generation, or to make the current alive one survive.\n\n\n\n\n\n","category":"type"},{"location":"user/onedimensionca/#General-Dicrete-Cellular-Automata","page":"One Dimensional CA","title":"General Dicrete Cellular Automata","text":"","category":"section"},{"location":"user/onedimensionca/","page":"One Dimensional CA","title":"One Dimensional CA","text":" DCA","category":"page"},{"location":"user/onedimensionca/#CellularAutomata.DCA","page":"One Dimensional CA","title":"CellularAutomata.DCA","text":"DCA(rule; states=2, radius=1)\n\nReturns a DCA object given a specific rule, number of states and radius. The ruleset for the rule is computed and stored in the struct as well.\n\n\n\n\n\n","category":"type"},{"location":"user/onedimensionca/#Totalistic-Discrete-Cellular-Automata","page":"One Dimensional CA","title":"Totalistic Discrete Cellular Automata","text":"","category":"section"},{"location":"user/onedimensionca/","page":"One Dimensional CA","title":"One Dimensional CA","text":" TCA","category":"page"},{"location":"user/onedimensionca/#CellularAutomata.TCA","page":"One Dimensional CA","title":"CellularAutomata.TCA","text":"TCA(code; states=2, radius=1)\n\nReturns a TCA object given a specific code, number of states and radius. The ruleset for the rule is computed and stored in the struct as well.\n\n\n\n\n\n","category":"type"},{"location":"user/onedimensionca/#Continous-Cellular-Automata","page":"One Dimensional CA","title":"Continous Cellular Automata","text":"","category":"section"},{"location":"user/onedimensionca/","page":"One Dimensional CA","title":"One Dimensional CA","text":" CCA","category":"page"},{"location":"user/onedimensionca/#CellularAutomata.CCA","page":"One Dimensional CA","title":"CellularAutomata.CCA","text":"TCA(code; radius=1)\n\nReturns a CCA object given a specific code and radius. \n\n\n\n\n\n","category":"type"},{"location":"#CellularAutomata.jl","page":"CellularAutomata.jl","title":"CellularAutomata.jl","text":"","category":"section"},{"location":"","page":"CellularAutomata.jl","title":"CellularAutomata.jl","text":"This package is meant to be a complete Open source reference for everything regarding Cellular Automata. In it you will find wayd to create one and two dimensional Cellular Automata models and functions to analyze them","category":"page"},{"location":"#General-usage","page":"CellularAutomata.jl","title":"General usage","text":"","category":"section"},{"location":"","page":"CellularAutomata.jl","title":"CellularAutomata.jl","text":"The main function is given by CellularAutomaton","category":"page"},{"location":"","page":"CellularAutomata.jl","title":"CellularAutomata.jl","text":" CellularAutomaton","category":"page"},{"location":"#CellularAutomata.CellularAutomaton","page":"CellularAutomata.jl","title":"CellularAutomata.CellularAutomaton","text":"CellularAutomaton(rule::AbstractODRule, initial_conditions, generations)\nCellularAutomaton(rule::AbstractTDRule, initial_conditions, generations)\n\nGiven a cellular automata rule (inluded in the library or provided by the user) returns a CellularAutomaton evolution with given initial conditions and number of generations. OD indicates one-diomensional cellular automata rules, TD indicates two-dimensiona cellular automata rules.\n\n\n\n\n\n","category":"type"},{"location":"","page":"CellularAutomata.jl","title":"CellularAutomata.jl","text":"where rule is a function returning the next state of the Cellular Automata. ","category":"page"},{"location":"#Contributions","page":"CellularAutomata.jl","title":"Contributions","text":"","category":"section"},{"location":"","page":"CellularAutomata.jl","title":"CellularAutomata.jl","text":"Contributions are more than welcomed! The package is in the early days, so expet things to change a lot. For everything do contact me or open an issue about it.","category":"page"}] } diff --git a/docs/build/twodim/twodimensionca/index.html b/docs/build/twodim/twodimensionca/index.html index f15552a..aa7f260 100644 --- a/docs/build/twodim/twodimensionca/index.html +++ b/docs/build/twodim/twodimensionca/index.html @@ -1,2 +1,2 @@ -Two dimensional CA · CellularAutomata.jl
      +Two dimensional CA · CellularAutomata.jl
      diff --git a/docs/build/user/onedimensionca/index.html b/docs/build/user/onedimensionca/index.html index c9d4f36..ebf6d22 100644 --- a/docs/build/user/onedimensionca/index.html +++ b/docs/build/user/onedimensionca/index.html @@ -1,2 +1,2 @@ -One Dimensional CA · CellularAutomata.jl

      General Dicrete Cellular Automata

      CellularAutomata.DCAType
      DCA(rule; states=2, radius=1)

      Returns a DCA object given a specific rule, number of states and radius. The ruleset for the rule is computed and stored in the struct as well.

      source

      Totalistic Discrete Cellular Automata

      CellularAutomata.TCAType
      (tca::TCA)(starting_array)

      Returns the next state of the given starting_array according to the evolution rule contained in the TCA struct.

      source

      Continous Cellular Automata

      CellularAutomata.CCAType
      (cca::CCA)(starting_array)

      Returns the next state of the given starting_array according to the evolution rule contained in the CCA struct.

      source
      +One Dimensional CA · CellularAutomata.jl

      General Dicrete Cellular Automata

      CellularAutomata.DCAType
      DCA(rule; states=2, radius=1)

      Returns a DCA object given a specific rule, number of states and radius. The ruleset for the rule is computed and stored in the struct as well.

      source

      Totalistic Discrete Cellular Automata

      CellularAutomata.TCAType
      TCA(code; states=2, radius=1)

      Returns a TCA object given a specific code, number of states and radius. The ruleset for the rule is computed and stored in the struct as well.

      source

      Continous Cellular Automata

      diff --git a/docs/build/user/twodimensionca/index.html b/docs/build/user/twodimensionca/index.html index b098ed9..d55c985 100644 --- a/docs/build/user/twodimensionca/index.html +++ b/docs/build/user/twodimensionca/index.html @@ -1,2 +1,2 @@ -Two Dimensial CA · CellularAutomata.jl

      Life-like Cellular Automata

      CellularAutomata.LifeType

      Life(life_description; radius=1)

      Returns a Life object given a tuple of tuples that follows the Golly notation ((b), (s)), where b stands for birth and s for survival. These values indicates the number of neighbouring cells needed to birth a new one in the following generation, or to make the current alive one survive.

      source
      +Two Dimensial CA · CellularAutomata.jl

      Life-like Cellular Automata

      CellularAutomata.LifeType

      Life(life_description; radius=1)

      Returns a Life object given a tuple of tuples that follows the Golly notation ((b), (s)), where b stands for birth and s for survival. These values indicates the number of neighbouring cells needed to birth a new one in the following generation, or to make the current alive one survive.

      source
      diff --git a/docs/src/index.md b/docs/src/index.md index e934a03..271acde 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -4,6 +4,15 @@ This package is meant to be a complete Open source reference for everything rega In it you will find wayd to create one and two dimensional Cellular Automata models and functions to analyze them +## General usage + +The main function is given by ```CellularAutomaton``` +```@docs + CellularAutomaton +``` +where ```rule``` is a function returning the next state of the Cellular Automata. + + ## Contributions Contributions are more than welcomed! The package is in the early days, so expet things to change a lot. For everything diff --git a/src/CellularAutomata.jl b/src/CellularAutomata.jl index 0ed8c5d..e4e0a53 100644 --- a/src/CellularAutomata.jl +++ b/src/CellularAutomata.jl @@ -16,11 +16,10 @@ end CellularAutomaton(rule::AbstractODRule, initial_conditions, generations) CellularAutomaton(rule::AbstractTDRule, initial_conditions, generations) -Given a cellular automata rule (inluded in the library of provided by the user) returns a CellularAutomaton evolution +Given a cellular automata rule (inluded in the library or provided by the user) returns a CellularAutomaton evolution with given initial conditions and number of generations. OD indicates one-diomensional cellular automata rules, TD indicates two-dimensiona cellular automata rules. """ - function CellularAutomaton(rule::AbstractODRule, initial_conditions, generations) evolution = zeros(typeof(initial_conditions[2]), generations, length(initial_conditions)) diff --git a/src/cca.jl b/src/cca.jl index f3931c6..4fd9a25 100644 --- a/src/cca.jl +++ b/src/cca.jl @@ -4,6 +4,7 @@ struct CCA{T} <: AbstractCCARule rule::T radius::Int end + """ TCA(code; radius=1) @@ -13,11 +14,6 @@ function CCA(rule; radius=1) CCA(rule, radius) end -""" - (cca::CCA)(starting_array) - -Returns the next state of the given ```starting_array``` according to the evolution rule contained in the ```CCA``` struct. -""" function (cca::CCA)(starting_array) nextgen = evolution(starting_array, cca.rule, cca.radius) diff --git a/src/dca.jl b/src/dca.jl index 59e509d..b630607 100644 --- a/src/dca.jl +++ b/src/dca.jl @@ -21,12 +21,6 @@ function DCA(rule; DCA(rule, ruleset, states, radius) end -""" - (dca::DCA)(starting_array) - -Returns the next state of the given ```starting_array``` according to the evolution rule contained in the ```DCA``` struct. -""" - function (dca::DCA)(starting_array) nextgen = evolution(starting_array, dca.ruleset, dca.states, dca.radius) @@ -77,21 +71,4 @@ function evolution(cell, ruleset, states, radius::Tuple) end output -end - -#consider (single function, less lines) -#= -function evolution(cell, ruleset, args...) - - neighborhood_size = radius*2+1 - output = zeros(length(cell)) - cell = vcat(cell[end-neighborhood_size÷2+1:end], cell, cell[1:neighborhood_size÷2]) - - for i=1:length(cell)-neighborhood_size+1 - output[i] = ruleset[state_reader(cell[i:i+neighborhood_size-1], args...)+1] - end - - output - -end -=# \ No newline at end of file +end \ No newline at end of file diff --git a/src/tca.jl b/src/tca.jl index 35dbdeb..873ff7d 100644 --- a/src/tca.jl +++ b/src/tca.jl @@ -21,11 +21,6 @@ function TCA(code; TCA(code, codeset, states, radius) end -""" - (tca::TCA)(starting_array) - -Returns the next state of the given ```starting_array``` according to the evolution rule contained in the ```TCA``` struct. -""" function (tca::TCA)(starting_array) nextgen = tca_evolution(starting_array, tca.codeset, tca.states, tca.radius)