#ifndef __FILE_STRATEGIES_H_SEEN__
#define __FILE_STRATEGIES_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 "craps.h"

namespace craps {

  // When adding a new strategy do not forget to add it to the 
  // strategies list at the end of the file.

  class pass_line_only : public strategy_base 
  {
  public:  
    std::string get_name() const { return std::string("pass_line_only"); }
    payoff_t operator()
      (roll_t roll, marker_t marker, INTEGER n, std::list<bet_base*>& bets);
  };
  
  class pass_line_with_odds : public strategy_base 
  {
  public:  
    std::string get_name() const { return std::string("pass_line_with_odds"); }
    payoff_t operator()
      (roll_t roll, marker_t marker, INTEGER n, std::list<bet_base*>& bets);
  };
  
  class come_bet_only : public strategy_base 
  {
  public:  
    std::string get_name() const { return std::string("come_bet_only"); }
    payoff_t operator()
      (roll_t roll, marker_t marker, INTEGER n, std::list<bet_base*>& bets);
  };
  
  class come_bet_with_odds : public strategy_base 
  {
  public:  
    std::string get_name() const { return std::string("come_bet_with_odds"); }
    payoff_t operator()
      (roll_t roll, marker_t marker, INTEGER n, std::list<bet_base*>& bets);
  };

  class pass_line_with_craps_check_and_odds : public strategy_base 
  {
  public:  
    std::string get_name() const 
      { return std::string("pass_line_with_craps_check_and_odds"); }
    payoff_t operator()
      (roll_t roll, marker_t marker, INTEGER n, std::list<bet_base*>& bets);
  };
  
  class come_bet_with_craps_check_and_odds : public strategy_base 
  {
  public:  
    std::string get_name() const 
      { return std::string("come_bet_with_craps_check_and_odds"); }
    payoff_t operator()
      (roll_t roll, marker_t marker, INTEGER n, std::list<bet_base*>& bets);
  };

  class strategy_list {
  private:
    std::list<strategy_base*> strategies;
  public:
    strategy_list()
    { 
      strategies.push_back(new pass_line_only);
      strategies.push_back(new pass_line_only);
      strategies.push_back(new pass_line_with_odds);
      strategies.push_back(new pass_line_with_craps_check_and_odds);
      strategies.push_back(new come_bet_only);
      strategies.push_back(new come_bet_with_odds);
      strategies.push_back(new come_bet_with_craps_check_and_odds);
    }
    strategy_base* operator()(std::string name) 
    {
      std::list<strategy_base*>::const_iterator itr = strategies.begin();
      while (itr != strategies.end()) {
        strategy_base* ptr = *itr; 
        if (ptr->get_name()  == name) return *itr;
        ++itr;
      }
      scl::error("Error, strategy " + name + "not in strategy_list");
      return 0;
    }
    ~strategy_list()
    {  
      std::list<strategy_base*>::const_iterator itr = strategies.begin();
      while (itr != strategies.end()) {
        strategy_base* ptr = *itr; 
        delete ptr;
        ++itr;
      }
    }
  };    
  
}

#endif

