Package org.cspoker.server.embedded.gamecontrol

Examples of org.cspoker.server.embedded.gamecontrol.Game


    }
  }

  public void testCase1() {
    PlayingTableState gameControl = new PlayingTableState(pokerTable, table, kenzo);
    Game game = gameControl.getGame();
    events.ignore(); //TODO
    try {
      gameControl.deal();
    } catch (IllegalActionException e1) {
      fail(e1.toString());
    }

    // Pre-flop Round
    assertEquals(PreFlopRound.class, gameControl.getRound().getClass());
    assertTrue(game.getCurrentPlayer().equals(kenzo));

    try {
      gameControl.call(game.getCurrentPlayer());
      assertEquals(PreFlopRound.class, gameControl.getRound().getClass());
      gameControl.call(game.getCurrentPlayer());
      assertEquals(PreFlopRound.class, gameControl.getRound().getClass());

      // Big Blind Checks.
      gameControl.check(game.getCurrentPlayer());

    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    // Flop Round
    assertEquals(FlopRound.class, gameControl.getRound().getClass());
    try {
      gameControl.check(game.getCurrentPlayer());
      assertEquals(FlopRound.class, gameControl.getRound().getClass());
      gameControl.check(game.getCurrentPlayer());
      assertEquals(FlopRound.class, gameControl.getRound().getClass());
      gameControl.check(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    // Turn Round
    assertEquals(TurnRound.class, gameControl.getRound().getClass());
    try {
      gameControl.check(game.getCurrentPlayer());
      assertEquals(TurnRound.class, gameControl.getRound().getClass());
      gameControl.check(game.getCurrentPlayer());
      assertEquals(TurnRound.class, gameControl.getRound().getClass());
      gameControl.check(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    // Final Round
    assertEquals(FinalRound.class, gameControl.getRound().getClass());
    try {
      gameControl.check(game.getCurrentPlayer());
      assertEquals(FinalRound.class, gameControl.getRound().getClass());
      gameControl.check(game.getCurrentPlayer());
      assertEquals(FinalRound.class, gameControl.getRound().getClass());
      gameControl.check(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    // New Deal
    assertEquals(cedric, game.getDealer());
    assertEquals(PreFlopRound.class, gameControl.getRound().getClass());
    try {
      gameControl.call(game.getCurrentPlayer());
      assertEquals(PreFlopRound.class, gameControl.getRound().getClass());
      gameControl.call(game.getCurrentPlayer());
      assertEquals(PreFlopRound.class, gameControl.getRound().getClass());
      gameControl.check(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    // Flop Round
    assertEquals(FlopRound.class, gameControl.getRound().getClass());
    try {
      gameControl.check(game.getCurrentPlayer());
      assertEquals(FlopRound.class, gameControl.getRound().getClass());
      gameControl.check(game.getCurrentPlayer());
      assertEquals(FlopRound.class, gameControl.getRound().getClass());
      gameControl.check(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    // Turn Round
    assertEquals(TurnRound.class, gameControl.getRound().getClass());
    try {
      gameControl.check(game.getCurrentPlayer());
      assertEquals(TurnRound.class, gameControl.getRound().getClass());
      gameControl.check(game.getCurrentPlayer());
      assertEquals(TurnRound.class, gameControl.getRound().getClass());
      gameControl.check(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    // Final Round
    assertEquals(FinalRound.class, gameControl.getRound().getClass());
    try {
      gameControl.check(game.getCurrentPlayer());
      assertEquals(FinalRound.class, gameControl.getRound().getClass());
      gameControl.check(game.getCurrentPlayer());
      assertEquals(FinalRound.class, gameControl.getRound().getClass());
      gameControl.check(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    // New Deal
    assertEquals(guy, game.getDealer());
    assertEquals(PreFlopRound.class, gameControl.getRound().getClass());
  }
View Full Code Here


    try {
      gameControl.deal();
    } catch (IllegalActionException e1) {
      fail(e1.toString());
    }
    Game game = gameControl.getGame();

    // New Deal
    assertEquals(guy, game.getDealer());
    assertEquals(PreFlopRound.class, gameControl.getRound().getClass());

    try {
      System.out.println(game.getCurrentPlayer());
      gameControl.call(game.getCurrentPlayer());
      assertEquals(PreFlopRound.class, gameControl.getRound().getClass());
      gameControl.raise(game.getCurrentPlayer(), 10);
      assertEquals(PreFlopRound.class, gameControl.getRound().getClass());
      gameControl.call(game.getCurrentPlayer());
      assertEquals(PreFlopRound.class, gameControl.getRound().getClass());
      gameControl.raise(game.getCurrentPlayer(), 20);
      assertEquals(PreFlopRound.class, gameControl.getRound().getClass());
      gameControl.call(game.getCurrentPlayer());
      assertEquals(PreFlopRound.class, gameControl.getRound().getClass());
      gameControl.call(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }


    // Flop Round
    assertEquals(FlopRound.class, gameControl.getRound().getClass());
    try {
      gameControl.check(game.getCurrentPlayer());
      gameControl.check(game.getCurrentPlayer());
      gameControl.check(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    // Turn Round
    assertEquals(TurnRound.class, gameControl.getRound().getClass());
    try {
      gameControl.check(game.getCurrentPlayer());
      gameControl.check(game.getCurrentPlayer());
      gameControl.check(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    // Final Round
    assertEquals(FinalRound.class, gameControl.getRound().getClass());
    try {
      gameControl.check(game.getCurrentPlayer());
      gameControl.check(game.getCurrentPlayer());
      gameControl.check(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    // New Deal
View Full Code Here

    try {
      gameControl.deal();
    } catch (IllegalActionException e1) {
      fail(e1.toString());
    }
    Game game = gameControl.getGame();

    try {
      gameControl.call(game.getCurrentPlayer());
      gameControl.call(game.getCurrentPlayer());
      gameControl.check(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    // Flop Round
    try {
      gameControl.bet(game.getCurrentPlayer(),8);
      gameControl.raise(game.getCurrentPlayer(), 10);
      gameControl.call(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    // Turn Round
    try {
      gameControl.check(game.getCurrentPlayer());
      gameControl.check(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    // Final Round
    try {
      System.out.println("final round");
      gameControl.check(game.getCurrentPlayer());
      System.out.println("Check 1");
      gameControl.check(game.getCurrentPlayer());
      System.out.println("check 2");
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    GameFlowTest.logger.info("Next game...");

    GameFlowTest.logger.info("Current Player:" + game.getCurrentPlayer());
    GameFlowTest.logger.info("Next Dealer:" + game.getNextDealer());
    GameFlowTest.logger.info(game.getFirstToActPlayer());
    GameFlowTest.logger.info("Dealer: " + game.getDealer().getName());
    GameFlowTest.logger.info(game.getCurrentDealPlayers());
  }
View Full Code Here

TOP

Related Classes of org.cspoker.server.embedded.gamecontrol.Game

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.