#ifndef INCLUDED_WinLoss_h_
#define INCLUDED_WinLoss_h_
 
#include "Behaviors/StateNode.h"
#include "Behaviors/Nodes/SoundNode.h"
#include "Behaviors/Nodes/LedNode.h"
#include "Behaviors/Transitions/CompletionTrans.h"
#include "Behaviors/Transitions/EventTrans.h"
#include "Behaviors/Transitions/TimeOutTrans.h"
#include "Events/EventRouter.h"
#include "Motion/WalkMC.h"
#include "Behaviors/Nodes/WalkNode.h"

class WinLoss : public StateNode {


public:
	WinLoss() : StateNode("Win Loss"){}
 
  virtual void setup() {
    StateNode::setup();
    std::cout << getName() << " is setting up the state machine." << std::endl;
	 
  }

  virtual void DoStart() {
    StateNode::DoStart();
    std::cout << getName() << " is starting up." << std::endl;  
  }

  int value(int pval, int dval){
	 SoundNode *sn;
	 if(pval > 21 || (pval < dval)){
		 sn = new SoundNode("Player Lost", "howl.wav");
		 sn->DoStart();
		 postCompletionEvent();
		 return 1;
	 }
	 else{
		 sn = new SoundNode("Player Won", "barkmed.wav");
		 sn->DoStart();
		 postCompletionEvent();
		 return 0;
	 }
  }

  virtual void DoStop(){
	  std::cout<<getName()<<" is stopping"<<std::endl;
	  StateNode::DoStop();
  }

protected:  // Dummy functions to satisfy the compiler
  WinLoss(const WinLoss&);
  WinLoss& operator=(const WinLoss&);

};




#endif

