previous | index | next

The AutomatedPlayerInfo Class

The AutomatedPlayerInfo Class Header

Automated player objects have a strategy object as an instance variable:

class AutomatedPlayerInfo: public PlayerInfo {
public:
  AutomatedPlayerInfo(string name, Strategy strategy);
  Move getMove(GameState state);
private:
  Strategy strategy;
};

getMove implements a more intelligent move strategy than its superclass's version by delegating the work to the strategy object.


previous | index | next