


Description 
The engine of the Lupupu Cube solver.


Synopsis 



Documentation 

data LupuGraph 
LupuGraph is a data structure which represents the intermediate
state of stage solving.
 Constructors  LupuGraph   lgSize :: !Size  The size of stage.
 lgGraph :: !Gr Depth Action  The directed graph of state of the stage, which is usually
incomplete (i.e. doesn't have every possible states).
 lgPhaseMap :: !Map Phase Node  The finite map from Phase to Node.
 lgPending :: !Set Pending  The finite set of states which are known to be possible but
not actually examined yet. At the time this set becomes
empty, the stage is either solved or proven to have no
solutions.
 lgBestSolution :: !Maybe FinalState  The best solution ever found, which has the shortest path to
one of final states.
 lgInitialNode :: !Node  The Node of the initial state.
 lgInitialPhase :: !Phase  The initial state.





type Depth = Int 
Depth is just an Int which represents a depth of node
in a LupuGraph.


data Pending 
Pending represents a state which is known to be possible but not
actually determined yet. See lgPending.
 Constructors  PEN !!Node !!Depth !Phase  The Node of the state, the number of moves from the
initial state to this state, and the state itself.

 Instances  


data FinalState 
FinalState represents a final state.
 Constructors  FST !!Node !!Depth  The Node of the state, and the number of moves from the
initial state to this state.




type Solution = [(Action, Phase)] 
Solution is a list of tuple (Action, Phase), representing
the shortest path from the initial state to one of the final
states.


data Action 
Action is a data type to represent a way of state transition.
 Constructors  WalkLeft  Walk one step to left.
 WalkRight  Walk one step to right.
 JumpLeft  Jump one step to left.
 JumpRight  Jump one step to right.

 Instances  


isFinished :: LupuGraph > Bool 
Returns True iff the given LupuGraph has no pending
states.


numOfPendings :: LupuGraph > Int 
Returns the number of pending states of the given LupuGraph.


numOfStates :: LupuGraph > Int 
Returns the number of examined states of the given LupuGraph.


nextPending :: LupuGraph > Maybe Pending 
Returns the next pending state of the given LupuGraph if any.


solveM 
:: Monad m   => Stage  The Stage to solve.
 > LupuGraph > m a  An action to be called back repeatedly during the stage solving.
 > m (Maybe Solution)  The solution if found.
 Solves a Stage in a Monad with repeatedly applying an
monadic action to the intermediate LupuGraph. The Monad
is usually either IO or
Identity. See also solve.



solve :: Stage > Maybe Solution 
Solves a Stage in an Identity monad
with noop callback. See also solveM.


ppAction :: Action > String 
Returns a brief representation of the given Action.


Produced by Haddock version 2.1.0 