msmazes::ParallelepipedFSMBuilder<> Class Template Reference
[Core FSM Layer]

#include <msmazes/core/fsm/builder/parallelepiped.hpp>

List of all members.


Detailed Description

template<>
class msmazes::ParallelepipedFSMBuilder<>

An FSM Builder whose underlying pattern is a Parallelepiped. In the beginning, this will be your bread-and-butter, as the Parallelepiped is the most common Physical Pattern on top of which to build a maze graph.

     typedef boost::mt19937
             RNGEngine;
     typedef msmazes::ParallelepipedFSMBuilder<>
             Builder;
     typedef Builder::Pattern
             Tesselation;
     typedef sgdk::IndexTypeFSM<
                 boost::numeric::ublas::matrix<unsigned int>
               , unsigned int
             >
             FiniteStateMachine;
     RNGEngine          rng_engine;
     Builder            builder;
     FiniteStateMachine fsm;
     const Tesselation& parallelepiped = builder.getPattern();
     builder.initialize(
         rng_engine
       , msmazes::WalkthroughMazeMaker()
       , msmazes::FSMDirectionInputMaker()
       , msmazes::OrthogonalTesselationSelector()
       , Tesselation::createCell(1.0, 0.0, 0.0)
       , Tesselation::createCell(3.0, 3.0, 0.0)
       , Tesselation::createCellIncrement(1.0, 1.0, 1.0)
       , Tesselation::createCell(0.0, 1.0, 0.0)
       , Tesselation::createCell(4.0, 2.0, 0.0)
 //      , msmazes::NoNegativeTurnWalkthroughMazePolicy()
 //      , sgdk::PositiveRotation::COUNTERCLOCKWISE
     );
     fsm.initialize(builder);
     while (!fsm.hasReachedTargetState())
     {
         unsigned int state = fsm.getCurrentState();
         renderCurrentMazeRoom(builder.getStateCell(state), parallelepiped);  // User-defined
         int input = getInputFromUser();  // User-defined
         if ((-1 < input) && (input < parallelepiped.getMaxOutDegree()))
         {
             fsm.processInput(input);
         }
     }
 

The code above will produce a walkthrough arrow maze that is conceptually like the one first launched by the program in the binary distribution. Uncommenting the first commented line of code will result in a no-left-turn maze; uncommenting both lines will yield a no-right-turn maze.

All programs using this class template must define BOOST_PARAMETER_MAX_ARITY as 13 or more.


Template parameters

Parameter Description Default
DirectionType The type that will represent the course or bearing that is followed when traversing an edge in the underlying graph. unsigned int
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
PiConstant The type of the function object returning the constant value PI. sgdk::Pi
TangentFunction The type of the function object returning the tangent of an angle. sgdk::Tangent


Model of


Type requirements



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

 ParallelepipedFSMBuilder ()
 The default constructor.
virtual ~ParallelepipedFSMBuilder ()
 The destructor.
template<typename RNGEngine, typename MazeMaker, typename FSMInputMaker, typename TesselationSelector, typename Increment, 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_cell_minimum_arg, const Cell &init_cell_maximum_arg, Increment init_cell_increment_arg, const Cell &init_entrance_cell_arg, const Cell &init_exit_cell_arg, const MazePolicy &maze_policy_arg, const sgdk::ZeroDirection &init_zero_direction_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 PatterngetPattern () const
const MazeGraphgetMazeGraph () 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 CellgetStateCell (const StateIndex state) const
Direction getStateDirection (const StateIndex state) const


Member Typedef Documentation

typedef implementation_defined msmazes::ParallelepipedFSMBuilder<>::StateIndex
 

The type representing the index of a vertex in the underlying maze graph, as defined in the FSM Builder concept.

typedef implementation_defined msmazes::ParallelepipedFSMBuilder<>::InputIndex
 

The type representing the index of an edge in the underlying maze graph, as defined in the FSM Builder concept.

typedef implementation_defined msmazes::ParallelepipedFSMBuilder<>::MazeGraph
 

The type of the underlying maze graph, as defined in the FSM Builder concept.

typedef implementation_defined msmazes::ParallelepipedFSMBuilder<>::Pattern
 

The type of the underlying pattern, as defined in the FSM Builder concept.

typedef implementation_defined msmazes::ParallelepipedFSMBuilder<>::Cell
 

The type of the cells in the underlying pattern, as defined in the FSM Builder concept.

typedef implementation_defined msmazes::ParallelepipedFSMBuilder<>::Direction
 

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.

typedef implementation_defined msmazes::ParallelepipedFSMBuilder<>::ArgumentValidationPolicy
 

The Argument Validation Policy in effect, as defined in the FSM Builder concept.


Constructor & Destructor Documentation

msmazes::ParallelepipedFSMBuilder<>::ParallelepipedFSMBuilder  )  [inline]
 

Constructs this ParallelepipedFSMBuilder, but does not initialize it.

virtual msmazes::ParallelepipedFSMBuilder<>::~ParallelepipedFSMBuilder  )  [inline, virtual]
 

Destroys this ParallelepipedFSMBuilder.


Member Function Documentation

template<typename RNGEngine, typename MazeMaker, typename FSMInputMaker, typename TesselationSelector, typename Increment, typename MazePolicy>
bool msmazes::ParallelepipedFSMBuilder<>::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_cell_minimum_arg,
const Cell init_cell_maximum_arg,
Increment  init_cell_increment_arg,
const Cell init_entrance_cell_arg,
const Cell init_exit_cell_arg,
const MazePolicy &  maze_policy_arg,
const sgdk::ZeroDirection &  init_zero_direction_arg,
const sgdk::PositiveRotation &  init_positive_rotation_arg,
const typename Pattern::Coordinate  init_zero_tolerance_arg
 

Initializes this ParallelepipedFSMBuilder. Violation of the specified preconditions will result in either compile-time errors or failed assertions unless otherwise noted.

Parameter Name Description Preconditions Default
rng_engine_arg A number generator used to build a random maze graph and, if required, random inputs.
maze_maker_arg The maze graph builder. A StandardMazeMaker builds a traditional maze, while a WalkthroughMazeMaker results in a walkthrough arrow maze.
fsm_input_maker_arg The input maker. If you deal strictly with two-dimensional mazes, i.e. by setting the z-coordinates of init_cell_minimum_arg and init_cell_maximum_arg equal to each other, then FSMDirectionInputMaker is a good choice if the user will view the maze from the top down, while FSMYawInputMaker is ideal from a first-person, three-dimensional perspective.
  • FSMInputMaker must model the FSM Input Maker concept.
  • If MazeMaker doesn't build last-visited maps, then FSMInputMaker must not require them.
init_tesselation_selector_arg Forms the underlying tesselation on top of which a maze will be built. See the corresponding parameter name under Parallelepiped::initialize() for details and requirements.
init_cell_minimum_arg The cell at the intersection of the coordinates' lower bounds.
init_cell_maximum_arg The cell at the intersection of the coordinates' upper bounds.
  • init_cell_minimum_arg[0] < init_cell_maximum_arg[0]
  • init_cell_minimum_arg[1] < init_cell_maximum_arg[1]
  • init_cell_minimum_arg[2] <= init_cell_maximum_arg[2]
init_cell_increment_arg Defines the space between each indexable cell in the underlying tesselation. See the corresponding parameter name under Parallelepiped::initialize() for details and requirements.
init_entrance_cell_arg The entrance cell.
init_exit_cell_arg The exit cell.
maze_policy_arg A maze policy associated with MazeMaker.
  • If FSMInputMaker is the same as FSMYawInputMaker, then init_cell_minimum_arg[2] == init_cell_maximum_arg[2]. (This function will return false otherwise.)
  • If maze_policy_arg is a NoNegativeTurnWalkthroughMazePolicy, then neither the entrance cell nor the exit cell can be adjacent to a corner cell or a cell on a vertical wedge. (This function will return false otherwise.)
The default policy associated with MazeMaker.
init_zero_direction_arg The input that a finite state machine that processes directional inputs will recognize as zero. sgdk::ZeroDirection::POSITIVE_Y_AXIS
init_positive_rotation_arg The rotational direction that a finite state machine that processes yaw inputs will recognize as upward from the finite state machine's current orientation. sgdk::PositiveRoration::CLOCKWISE
init_zero_tolerance_arg See the sgdk::ZeroChecker reference documentation. The default value is sufficient in most cases. 0.000001

Returns:
false if FSMInputMaker requires a single layer and the z-coordinates of the entrance, exit, and corner cells are not equal to each other, or if maze_policy_arg is a NoNegativeTurnWalkthroughMazePolicy and either the entrance cell or the exit cell is adjacent to a corner cell or a cell on a vertical wedge; true otherwise.

You can also pass the arguments by name. (In this case, it is recommended that you do so; otherwise, some of 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 msmazes namespace.

template<typename Params>
bool msmazes::ParallelepipedFSMBuilder<>::initialize_with_named_params Params &  p  )  [inline]
 

Initializes this ParallelepipedFSMBuilder via the specified Argument Pack object. See the initialize() function documentation for acceptable parameters.

const Pattern& msmazes::ParallelepipedFSMBuilder<>::getPattern  )  const [inline]
 

Returns a const reference to the underlying pattern, as defined in the FSM Builder concept.

const MazeGraph& msmazes::ParallelepipedFSMBuilder<>::getMazeGraph  )  const [inline]
 

Returns a const reference to the underlying maze graph, as defined in the FSM Builder concept.

bool msmazes::ParallelepipedFSMBuilder<>::isReady  )  const [inline]
 

Returns the readiness of this FSMBuilder, as defined in the FSM Builder concept.

template<typename TransitionFunction>
void msmazes::ParallelepipedFSMBuilder<>::buildTransitionFunction TransitionFunction &  transition_function  )  const [inline]
 

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.

StateIndex msmazes::ParallelepipedFSMBuilder<>::getSourceState  )  const [inline]
 

Returns the finite state machine's source state, as defined in the FSM Builder concept.

StateIndex msmazes::ParallelepipedFSMBuilder<>::getTargetState  )  const [inline]
 

Returns the finite state machine's target state, as defined in the FSM Builder concept.

bool msmazes::ParallelepipedFSMBuilder<>::hasSolutionFromState const StateIndex  source_state  )  const [inline]
 

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.

InputIndex msmazes::ParallelepipedFSMBuilder<>::getCorrectInput const StateIndex  source_state  )  const [inline]
 

Returns the input that brings the finite state machine one step closer to its target state, as defined in the FSM Builder concept.

const Cell& msmazes::ParallelepipedFSMBuilder<>::getStateCell const StateIndex  state  )  const [inline]
 

Returns the cell that the maze graph's cell index map pairs the specified state with, as defined in the FSM Builder concept.

Direction msmazes::ParallelepipedFSMBuilder<>::getStateDirection const StateIndex  state  )  const [inline]
 

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 SourceForge.net. Use the Table of Contents for navigation.