#ifndef __FILE_CRAPS_BASE_H_SEEN__
#define __FILE_CRAPS_BASE_H_SEEN__

/*-----------------------------------------------------------------------------

Copyright (C) 2012

A. Ronald Gallant
Post Office Box 659
Chapel Hill NC 27514
USA

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

-----------------------------------------------------------------------------*/

#include "libscl.h"

namespace craps {

  typedef std::pair<INTEGER,INTEGER> roll_t;
  
  struct marker_t {
    bool on;
    INTEGER point;
    marker_t() : on(false), point(0) { }
    void marker_action(roll_t roll); 
  };
  
  struct payoff_t {
    INTEGER house;
    INTEGER player;
    payoff_t() : house(0), player(0) { }
    payoff_t(INTEGER h, INTEGER p) : house(h), player(p) { }
    payoff_t& operator+=(const payoff_t& pay) 
      { house += pay.house; player += pay.player; return *this; }
  };
  
  class bet_base {
  private:
     void err() const
      {scl::error("Error, method not defined for this bet");}
  public:
    virtual payoff_t house_action
      (roll_t roll, marker_t marker, bool& remove_bet) 
      {err(); return payoff_t();}
    virtual payoff_t player_action
      (roll_t roll, marker_t marker, INTEGER change_odds) 
      {err(); return payoff_t();}
    virtual std::string get_name() const {err(); return std::string();}
    virtual INTEGER get_bet() const {err(); return INTEGER();}
    virtual INTEGER get_odds() const {err(); return INTEGER();}
    virtual INTEGER get_wager() const {err(); return INTEGER();}
    virtual INTEGER get_point() const {err(); return INTEGER();}
    virtual ~bet_base() { }
  };
  
  class strategy_base {
  public:
    virtual payoff_t operator()
      (roll_t r, marker_t marker, INTEGER n, std::list<bet_base*>& bets) = 0;
    virtual std::string get_name() const = 0;
    virtual ~strategy_base() { };
  };
  
  struct player_t {
    INTEGER number;
    INTEGER stake;
    std::list<bet_base*> bets;
    strategy_base* strategy;
    player_t() : number(0), stake(0) { }
  };
  
  struct house_t {
    INTEGER stake;
    house_t() : stake(0) { }
  };

}

#endif

