#ifndef MAZEGAMED2STATE01_H
#define MAZEGAMED2STATE01_H

#include <vector>
using namespace std;

#include <mazematrixD2.h>
#include <typedefs.h>


/*!
\brief Hold the game state.

 Set the variables and call game01.
*/
class mazegameD2state01
{
public:

  /** Number of rows in maze. */
  uint& m;
  /** Number of columns in maze. */
  uint& n;

  /** Uninitialized state. */
  mazegameD2state01();

  /** The current position is the last element. */
  vector<uint> path;

  /** Starting index into maze. */
  uint gamestart;
  /** Finishing index into maze. */
  uint gamefinish;


  /** For repeated testing with same outcome set to false. */
  bool randomize;

  /** If true only a proper maze is generated. */
  bool proper;

  /** Ratio of chance of deleting wall when proper set to false. */
  double deletewall;

  /** Build the maze from the current settings. */
  void game01();

  /** Default settings for game01, does not leave in a valid state. */
  void game01default();

  /** Maze. */
  mazematrixD2<uint> mz;

  /** Validate game and maze. */
  boolc valid() const;

  /** This class's command line settings. */
  stringc settings() const;
  
  /** Return current position id in maze. */
  uintc currentpos() const;

  /** If possible move in dir direction. */
  boolc currentmove(uintc dir);

// mazedisp03 sees model mazegameD2state01

  /** Serialize. */
  operator stringc () const;

  void serializeInverse(stringc & str);

};

#endif


