#include <msmazes/core/fsm/builder/sphere.hpp>
SpherePattern
.
typedef boost::mt19937 RNGEngine; typedef msmazes::SphereFSMBuilder<> Builder; typedef Builder::Pattern Sphere; typedef sgdk::IndexTypeFSM< boost::numeric::ublas::matrix<unsigned int> , unsigned int > FiniteStateMachine; RNGEngine rng_engine; Builder builder; FiniteStateMachine fsm; const Sphere& sphere = builder.getPattern(); builder.initialize( rng_engine , msmazes::StandardMazeMaker() , msmazes::FSMNoInputMaker() , msmazes::IcosahedronTesselationSelector() , Sphere::createCell(0.0, 0.0, 0.0) , 2.0 , 4.0 , 1.0 , Sphere::createCell(8.0, 0.0, 0.0) , Sphere::createCell(0.0, 8.0, 0.0) ); fsm.initialize(builder); while (!fsm.hasReachedTargetState()) { unsigned int state = fsm.getCurrentState(); renderCurrentMazeRoom(builder.getStateCell(state), sphere); // User-defined int input = getInputFromUser(); // User-defined if ((-1 < input) && (input < sphere.getMaxOutDegree())) { fsm.processInput(input); } }
The code above will produce a traditional maze, but in the form of layered icosahedrons.
All programs using this class template must define BOOST_PARAMETER_MAX_ARITY as 13 or more.
Parameter | Description | Default |
---|---|---|
CoordinateType | The value type of the coordinates in each cell. | double |
DirectionChangeType | The type that will represent the change in course or bearing that occurs when traversing two consecutive edges in the underlying graph. | int |
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 |
CoordinateType
must be a floating-point type. DirectionChangeType
must be a signed integer type. CellContainerSelector
must be either boost::vecS
or boost::dequeS
.
Public Types | |
typedef implementation_defined | StateIndex |
typedef implementation_defined | InputIndex |
typedef implementation_defined | MazeGraph |
typedef implementation_defined | Pattern |
typedef implementation_defined | Cell |
typedef implementation_defined | Direction |
typedef implementation_defined | ArgumentValidationPolicy |
Public Member Functions | |
SphereFSMBuilder () | |
The default constructor. | |
virtual | ~SphereFSMBuilder () |
The destructor. | |
template<typename RNGEngine, typename MazeMaker, typename FSMInputMaker, typename TesselationSelector, typename MazePolicy> | |
bool | initialize (RNGEngine &rng_engine_arg, const MazeMaker &maze_maker_arg, const FSMInputMaker &fsm_input_maker_arg, const TesselationSelector &init_tesselation_selector_arg, const Cell &init_centroid_arg, const typename Pattern::Coordinate init_radial_increment_arg, const typename Pattern::Coordinate init_radius_maximum_arg, const typename Pattern::Coordinate init_radius_minimum_arg, const Cell &init_entrance_cell_arg, const Cell &init_exit_cell_arg, const MazePolicy &maze_policy_arg, const sgdk::PositiveRotation &init_positive_rotation_arg, const typename Pattern::Coordinate init_zero_tolerance_arg) |
template<typename Params> | |
bool | initialize_with_named_params (Params &p) |
const Pattern & | getPattern () const |
const MazeGraph & | getMazeGraph () const |
bool | isReady () const |
template<typename TransitionFunction> | |
void | buildTransitionFunction (TransitionFunction &transition_function) const |
StateIndex | getSourceState () const |
StateIndex | getTargetState () const |
bool | hasSolutionFromState (const StateIndex source_state) const |
InputIndex | getCorrectInput (const StateIndex source_state) const |
const Cell & | getStateCell (const StateIndex state) const |
Direction | getStateDirection (const StateIndex state) const |
|
The type representing the index of a vertex in the underlying maze graph, as defined in the FSM Builder concept. |
|
The type representing the index of an edge in the underlying maze graph, as defined in the FSM Builder concept. |
|
The type of the underlying maze graph, as defined in the FSM Builder concept. |
|
The type of the underlying pattern, as defined in the FSM Builder concept. |
|
The type of the cells in the underlying pattern, as defined in the FSM Builder concept. |
|
The type representing the course or bearing that is followed when traversing an edge in the underlying pattern's internal graph, as defined in the FSM Builder concept. |
|
The Argument Validation Policy in effect, as defined in the FSM Builder concept. |
|
Constructs this |
|
Destroys this |
|
Initializes this
You can also pass the arguments by name. 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 pattern, as defined in the FSM Builder concept. |
|
Returns a const reference to the underlying maze graph, as defined in the FSM Builder concept. |
|
Returns the readiness of this |
|
Builds the specified transition function according to the structure of the underlying maze graph and its property maps, as defined in the FSM Builder concept. |
|
Returns the finite state machine's source state, as defined in the FSM Builder concept. |
|
Returns the finite state machine's target state, as defined in the FSM Builder concept. |
|
Indicates whether or not it is possible for the finite state machine to reach the target state from the specified state, as defined in the FSM Builder concept. |
|
Returns the input that brings the finite state machine one step closer to its target state, as defined in the FSM Builder concept. |
|
Returns the cell that the maze graph's cell index map pairs the specified state with, as defined in the FSM Builder concept. |
|
Returns the direction from the last-visited cell to the cell that the maze graph's cell index map pairs the specified state with, as defined in the FSM Builder concept. |
Multi-State Mazes in C++ is hosted by . Use the Table of Contents for navigation.