package games.war;
import game.Card;
import game.Deck;
import game.Game;
import games.war.behaviors.Cheating;
import games.war.behaviors.TestCheating;
import games.war.behaviors.CheatingBehavior;
import games.war.behaviors.NotCheating;
import games.war.behaviors.RandomCheating;
/**
* WarController is what sets up and eventually runs the War game.
* Responsible for creating the PlayerController, and starting the timer
* @author Chris Hersh
*
*/
public class WarController extends Game
{
protected WarTimer timer;
protected PlayerController playerCon;
/**
* Creates the behaviors and PlayerController used in the game
*/
public WarController()
{
Deck dk = Deck.getInstance();
dk.reset();
dk.shuffle();
timer = WarTimer.getInstance();
CheatingBehavior player1 = new NotCheating();
CheatingBehavior player2 = new Cheating();
playerCon = new PlayerController(player1, player2);
timer.addObserver(playerCon);
}
/**
* Starts the timer which sets the game in motion
*/
public void startGame()
{
timer.start();
}
/**
* Used to run only the War game, used for testing/demonstration
* @param args
*/
public static void main(String[] args)
{
WarController war = new WarController();
war.startGame();
}
}