Package org.cspoker.server.embedded.gamecontrol

Examples of org.cspoker.server.embedded.gamecontrol.PlayingTableState$AutoDealHandler


  /**
   * Test Settings: > 3 players > Big blind raises.
   */
  public void testBigBlindRaisesCase() {
    PlayingTableState gameControl = new PlayingTableState(pokerTable, table);
   
    events.add(newDealEvents);
   
    try {
      gameControl.deal();
    } catch (IllegalActionException e1) {
      fail(e1.toString());
    }
    Game game = gameControl.getGame();
   
    events.add(Events.call, Events.nextPlayer);
    events.add(Events.call, Events.nextPlayer);
    events.add(Events.raise, Events.nextPlayer);
    events.add(Events.call, Events.nextPlayer);
    events.add(Events.call, Events.newRound, Events.newCommunityCards, Events.nextPlayer);
   
    // Pre-flop Round
    assertEquals(PreFlopRound.class, gameControl.getRound().getClass());
    try {
      gameControl.call(game.getCurrentPlayer());
      gameControl.call(game.getCurrentPlayer());

      // Big Blind Raises.
      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());
    }
   
    events.add(Events.check, Events.nextPlayer);
    events.add(Events.check, Events.nextPlayer);
    events.add(Events.check, Events.newRound, Events.newCommunityCards, Events.nextPlayer);
   
    // 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());
    }
   
    events.add(Events.check, Events.nextPlayer);
    events.add(Events.check, Events.nextPlayer);
    events.add(Events.check, Events.newRound, Events.newCommunityCards, Events.nextPlayer);


    // Turn Round
    try {
      gameControl.check(game.getCurrentPlayer());
      gameControl.check(game.getCurrentPlayer());
      gameControl.check(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }
   
    events.add(Events.check, Events.nextPlayer);
    events.add(Events.check, Events.nextPlayer);
    events.add(Events.check);
    events.add(Events.showHand, Events.showHand, Events.showHand, Events.winner);
    events.ignore();
   
    // Final Round
    try {
      gameControl.check(game.getCurrentPlayer());
      gameControl.check(game.getCurrentPlayer());
      gameControl.check(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }
  }
View Full Code Here


    } catch (IllegalValueException e) {
      fail(e.getMessage());
    } catch (PlayerListFullException e) {
      fail(e.getMessage());
    }
    PlayingTableState gameControl = new PlayingTableState(pokerTable, table, kenzo);
    Game game = gameControl.getGame();
   
    events.add(Events.newDeal, Events.newRound, Events.allIn, Events.allIn, Events.nextPlayer);
   
    try {
      gameControl.deal();
    } catch (IllegalActionException e1) {
      fail(e1.toString());
    }
   
    events.add(Events.call);
    events.add(Events.newRound, Events.newCommunityCards);
    events.add(Events.newRound, Events.newCommunityCards);
    events.add(Events.newRound, Events.newCommunityCards);
    events.add(Events.showHand, Events.showHand, Events.showHand, Events.winner);
    events.ignore();
   
    try {
      gameControl.call(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

      fail(e.getMessage());
    }
  }

  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

TOP

Related Classes of org.cspoker.server.embedded.gamecontrol.PlayingTableState$AutoDealHandler

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.