Definition in file Ca.h.
#include <boost/dynamic_bitset.hpp>


Go to the source code of this file.
Classes | |
| struct | Pos |
| CA cell position. More... | |
| class | CaState |
| Simple CA state representation. More... | |
| class | IGate |
| The most generic interface of designed (and/or simulated) circuit, most commonly a logical gate. More... | |
| class | IGateBinding |
| Interface to define a binding between simulated gate and designed CA. More... | |
| class | ICaRules |
| Interface to define rules of non-uniform CA. More... | |
| struct | CaEvalParams |
| CA evaluation parameters. More... | |
| class | CaEvaluator |
| CA evaluator runs the given CA and evaluates its fitness for the desired purpose. More... | |
Defines | |
| #define | RULE_WIDTH (1 << 5) |
| Common state space for cell and neighbors size (Von Neuman's neighborhood). | |
Typedefs | |
| typedef signed long | TCoord |
| Type used for CA's cells addressing. | |
| typedef unsigned long | TBus |
| Type used for in/out signals of gate. | |
| typedef std::bitset< (1<< 5) > | TRule5N |
| Type for one-cell rule definition (32bit bitset). | |
Enumerations | |
| enum | EDirection { D_NULL = 0, D_TOP, D_RIGHT, D_BOTTOM, D_LEFT, D_ONE_AFTER_LAST } |
| Possible direction enumeration. More... | |
Functions | |
| void | writeRule (std::ostream &str, const TRule5N &rule) |
| Write CA rule in human-readable (colorized if possible) format. | |
| Pos | neighbor (Pos pos, EDirection dir) |
| Return position of cell's neighbor. | |
| std::ostream & | operator<< (std::ostream &str, const CaState &state) |
| Write CA state in human-readable (colorized if possible) format. | |
| bool | applyRule (const CaState &ca, Pos pos, const TRule5N &rule) |
| Return the result of applied rule. | |
| bool | applyRules (CaState &state, const ICaRules *rules) |
| Apply the given rule set on given CA state synchronously and check if anything is changed. | |
| #define RULE_WIDTH (1 << 5) |
Common state space for cell and neighbors size (Von Neuman's neighborhood).
Definition at line 50 of file Ca.h.
Referenced by CaDesigner::CaDesigner(), GaCaRules::GaCaRules(), GaCaRules::getRuleAtPos(), main(), and writeRule().
| typedef unsigned long TBus |
| typedef std::bitset< (1 << 5) > TRule5N |
| enum EDirection |
Return the result of applied rule.
The given CA is not changed at all.
| ca | The CA's state to compute new value for. | |
| pos | Position of the cell to compute the new value for. | |
| rule | The rule ought to be applied. |
Definition at line 97 of file Ca.cpp.
References D_BOTTOM, D_LEFT, D_RIGHT, D_TOP, CaState::getCellAtPos(), and neighbor().
Referenced by applyRules().


Apply the given rule set on given CA state synchronously and check if anything is changed.
| state | CA state to apply the rule set on. | |
| rules | The set of rules ought to be applied. |
Definition at line 123 of file Ca.cpp.
References applyRule(), ICaRules::getRuleAtPos(), CaState::setCellAtPos(), and CaState::size().
Referenced by CaEvaluator::cntSteps(), CaEvaluator::eval(), and CaEvaluator::simulate().


| Pos neighbor | ( | Pos | pos, | |
| EDirection | dir | |||
| ) | [inline] |
Return position of cell's neighbor.
| pos | Self position of the cell. | |
| dir | Direction to look for neighbor. |
Definition at line 98 of file Ca.h.
References Pos::col, D_BOTTOM, D_LEFT, D_RIGHT, D_TOP, and Pos::row.
Referenced by applyRule().

| std::ostream& operator<< | ( | std::ostream & | str, | |
| const CaState & | state | |||
| ) |
Write CA state in human-readable (colorized if possible) format.
| str | Standard output stream to write to. | |
| state | The CA state ought to be write. |
Definition at line 37 of file Ca.cpp.
References CaState::getCellAtPos(), and CaState::size().

| void writeRule | ( | std::ostream & | str, | |
| const TRule5N & | rule | |||
| ) |
Write CA rule in human-readable (colorized if possible) format.
| str | Standard output stream to write to. | |
| rule | The CA rule ought to be write. |
Definition at line 46 of file Ca.cpp.
References C_LIGHT_GREEN, C_LIGHT_RED, C_NO_COLOR, and RULE_WIDTH.
Referenced by writeRules().

1.5.4