#include <msmazes/core/pattern/n_bit.hpp>
msmazes::NBitPattern pattern; pattern.initialize( msmazes::init_bit_count_arg = 4 , msmazes::init_entrance_cell_arg = 0 , msmazes::init_exit_cell_arg = 15 , msmazes::init_entrance_direction_arg = 1 , msmazes::init_exit_direction_arg = 3 );
The code above will yield the following cells and their connections in adjacency list notation:
0000 <--> 0010 0001 <--> 0011 0101 1001 0010 <--> 0000 0011 0110 1010 0011 <--> 0001 0010 0111 1011 0100 <--> 0101 0110 1100 0101 <--> 0001 0100 0111 1101 0110 <--> 0010 0100 0111 1110 0111 <--> 0011 0101 0110 1111 1000 <--> 1001 1010 1100 1001 <--> 0001 1000 1011 1101 1010 <--> 0010 1000 1011 1110 1011 <--> 0011 1001 1010 1100 <--> 0100 1000 1101 1110 1101 <--> 0101 1001 1100 1110 <--> 0110 1010 1100 1111 <--> 0111
All programs using this class template must define BOOST_PARAMETER_MAX_ARITY as 5 or more.
Parameter | Description | Default |
---|---|---|
CellContainerSelector | The type that will represent whether the cell container is a std::vector (in which case this type is boost::vecS ) or a std::deque (in which case this type is boost::dequeS ). | boost::vecS |
Block | The integer type in which the bits of each cell are stored. | unsigned long |
Allocator | The allocator type used for memory management of each cell. | std::allocator<Block> |
CellContainerSelector
must be either boost::vecS
or boost::dequeS
. Block
must be an unsigned integer type. Allocator
must satisfy the C++ standard requirements for an allocator.
Public Types | |
typedef implementation_defined | Cell |
typedef implementation_defined | CellEqualityPolicy |
typedef implementation_defined | Graph |
typedef implementation_defined | CellIndex |
typedef implementation_defined | EdgeDirectedCategory |
typedef implementation_defined | Direction |
typedef implementation_defined | OutDegree |
typedef implementation_defined | HasIndexableEndpointCells |
Public Member Functions | |
NBitPattern () | |
The default constructor. | |
virtual | ~NBitPattern () |
The destructor. | |
void | initialize (const unsigned long init_bit_count_arg, const unsigned long init_entrance_cell_arg, const unsigned long init_exit_cell_arg, const unsigned long init_entrance_direction_arg, const unsigned long init_exit_direction_arg) |
template<typename Params> | |
void | initialize_with_named_params (Params &p) |
const Graph & | getGraph () const |
CellIndex | getCellCount () const |
const Cell & | getCell (const CellIndex index) const |
const Cell & | getEntranceCell () const |
const Cell & | getSourceCell () const |
const Cell & | getTargetCell () const |
const Cell & | getExitCell () const |
Direction | getEdgeDirection (const CellIndex source_index, const CellIndex target_index) const |
OutDegree | getMaxOutDegree () const |
|
The type of the objects to be connected together, as defined in the Pattern concept. |
|
The type of the function object that determines equality between any two cells, as defined in the Pattern concept. |
|
The type of the underlying object that represents the manner in which the cells are connected together, as defined in the Pattern concept. |
|
An unsigned integral type for representing either the index of a cell or the number of such cells, as defined in the Pattern concept. |
|
The type that represents whether the edges in the underlying graph are undirected, directed, or bidirectional, as defined in the Pattern concept. |
|
The type that represents the course or bearing that is followed when traversing an edge in the underlying graph, as defined in the Pattern concept. |
|
The type that represents the number of edges from a source vertex in the underlying graph, as defined in the Pattern concept. |
|
The type that indicates that the entrance and exit cells are indexable, as defined in the Pattern concept. |
|
Constructs a new |
|
Destroys this |
|
Initializes this
You can also pass the arguments by name. (In this case, it is recommended that you do so; otherwise, the arguments may be indistinguishable from each other.) Use the parameter table above to look up the parameter names. Remember that each parameter name resides in the |
|
Initializes this |
|
Returns a const reference to the underlying object that represents the manner in which the cells are connected together in this |
|
Returns the number of cells in this |
|
Returns a const reference to the cell in this |
|
Returns a const reference to the entrance cell in the solution path of an overlying maze, as defined in the Pattern concept. |
|
Returns a const reference to the cell that topologically follows the entrance cell in the solution path of an overlying maze, as defined in the Pattern concept. |
|
Returns a const reference to the cell that topologically precedes the exit cell in the solution path of an overlying maze, as defined in the Pattern concept. |
|
Returns a const reference to the exit cell in the solution path of an overlying maze, as defined in the Pattern concept. |
|
Returns a representation of the course or bearing that is followed when traversing the corresponding edge in the underlying graph, as defined in the Pattern concept. |
|
Returns the maximum number of edges from any source vertex in the underlying graph, as defined in the Pattern concept. |
Multi-State Mazes in C++ is hosted by . Use the Table of Contents for navigation.