Changeset 4 for trunk


Ignore:
Timestamp:
Dec 10, 2005, 7:33:39 AM (14 years ago)
Author:
jtv
Message:

Made intelligence level dynamic

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/c_abi.cxx

    r3 r4  
    3939extern "C"
    4040{
    41 Minefield *mines_init(int rows, int cols, int mines, int intelligence)
     41Minefield *mines_init(int rows, int cols, int mines)
    4242{
    43   return new Lake(rows, cols, mines, intelligence);
     43  return new Lake(rows, cols, mines);
    4444}
    4545
     
    4949  delete castback(f);
    5050}
     51
     52
     53int mines_max_intelligence()
     54{
     55  return Lake::max_intelligence();
     56}
     57
     58
     59void mines_set_intelligence(Minefield *f, int i)
     60{
     61  castback(f)->set_intelligence(i);
     62}
     63
    5164
    5265int mines_probe(Minefield *f, int row, int col, int minedP)
  • trunk/c_abi.h

    r3 r4  
    2929/** @brief Create minefield of given size.  Clean up with mines_close() later!
    3030 */
    31 Minefield *mines_init(int rows, int cols, int mines, int intelligence);
     31Minefield *mines_init(int rows, int cols, int mines);
     32
     33/** @brief Maximum intelligence level implemented by current version
     34 */
     35int mines_max_intelligence(void);
     36
     37/** @brief Set intelligence level of game's "autocompletion"
     38 */
     39void mines_set_intelligence(Minefield *, int);
    3240
    3341/** @brief Clean up minefield created with mines_init()
  • trunk/gamelogic.cxx

    r3 r4  
    208208
    209209
    210 Lake::Lake(int rows, int cols, int mines, int intelligence) :
     210Lake::Lake(int rows, int cols, int mines) :
    211211  m_patches(0),
    212212  m_rows(rows),
    213213  m_cols(cols),
    214   m_intelligence(intelligence),
     214  m_intelligence(1),
    215215  m_patches_to_go(rows*cols-mines),
    216216  m_moves(0)
  • trunk/gamelogic.hxx

    r3 r4  
    5656{
    5757public:
    58   explicit Lake(int rows, int cols, int mines, int intelligence);
     58  explicit Lake(int rows, int cols, int mines);
    5959  ~Lake() throw ();
     60
     61  /// Maximum intelligence level available
     62  static int max_intelligence() throw () { return 2; }
     63
     64  /// Change intelligence level
     65  void set_intelligence(int i) throw () { m_intelligence = i; }
    6066
    6167  /// Mark given patch as being either clear or mined
  • trunk/ui_cli.cxx

    r3 r4  
    5151    cout << "Creating minefield of "
    5252         <<rows<<"x"<<cols<<" fields, "<<mines<<" mines." << endl;
    53     Lake L(rows,cols,mines,3);
     53    Lake L(rows,cols,mines);
     54    L.set_intelligence(Lake::max_intelligence()+1);
    5455    while (L.to_go())
    5556    {
Note: See TracChangeset for help on using the changeset viewer.