Package org.cspoker.server.embedded.gamecontrol

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


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

    PlayingTableState gameControl = new PlayingTableState(pokerTable, table, cedric);
   
    events.ignore(); //TODO
   
    try {
      gameControl.deal();
    } catch (IllegalActionException e1) {
      fail(e1.toString());
    }

    try {
      performAction(gameControl, cedric, Action.call, 5);
    } catch (IllegalActionException e1) {
      fail(e1.toString());
    }

    //Verify auto-showdown
    assertNotSame(FlopRound.class, gameControl.getRound().getClass());

  }
View Full Code Here


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

    PlayingTableState gameControl = new PlayingTableState(pokerTable, table, cedric);
   
    events.ignore(); //TODO
   
    try {
      gameControl.deal();
    } catch (IllegalActionException e1) {
      fail(e1.toString());
    }

    //Verify auto-showdown
    assertNotSame(FlopRound.class, gameControl.getRound().getClass());

  }
View Full Code Here

    assertEquals(guy, game.getDealer());
    assertEquals(PreFlopRound.class, gameControl.getRound().getClass());
  }

  public void testCase2() {
    PlayingTableState gameControl = new PlayingTableState(pokerTable, table, guy);
    events.ignore(); //TODO
    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
    assertEquals(PreFlopRound.class, gameControl.getRound().getClass());
  }
View Full Code Here

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

    PlayingTableState gameControl = new PlayingTableState(pokerTable, table, kenzo);
   
    events.ignore(); //TODO
   
    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());
    }
View Full Code Here

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

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

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

    // Flop Round
    try {
      gameControl.check(game.getCurrentPlayer());
      gameControl.check(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());
    }
View Full Code Here

  //      }
  //}

  public void testOnlyOneActivePlayer() {

    PlayingTableState gameControl = new PlayingTableState(pokerTable, table);

    events.ignore(); //TODO
   
    Game game = gameControl.getGame();
    try {
      gameControl.deal();
    } catch (IllegalActionException e1) {
      fail(e1.toString());
    }
    try {
      gameControl.fold(game.getCurrentPlayer());
      gameControl.fold(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    assertFalse(gameControl.getRound() instanceof WaitingRound);

  }
View Full Code Here

      fail(e.getMessage());
    }
   
    events.add(newDealEvents);
   
    PlayingTableState gameControl = new PlayingTableState(pokerTable, table, kenzo);
    try {
      gameControl.deal();
    } catch (IllegalActionException e1) {
      fail(e1.toString());
    }
    Game game = gameControl.getGame();
   
    events.checkEmpty();

    events.add(Events.allIn, Events.nextPlayer);
    events.add(Events.allIn, Events.nextPlayer);
    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.raise(game.getCurrentPlayer(),100);
      gameControl.call(game.getCurrentPlayer());
      gameControl.call(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

  }
View Full Code Here

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

    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.check, Events.newRound, Events.newCommunityCards, Events.nextPlayer);
   
    try {
      gameControl.call(game.getCurrentPlayer());
      gameControl.call(game.getCurrentPlayer());
      gameControl.check(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }
   
    events.add(Events.allIn, Events.nextPlayer);
    events.add(Events.allIn, Events.nextPlayer);
    events.add(Events.allIn, Events.newRound, Events.newCommunityCards);
    events.add(Events.newRound, Events.newCommunityCards);
    events.add(Events.showHand, Events.showHand, Events.showHand, Events.winner);
   
    events.ignore();
   
    // Flop Round
    try {
      gameControl.allIn(game.getCurrentPlayer());
      gameControl.allIn(game.getCurrentPlayer());
      gameControl.allIn(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }
    GameFlowTest.logger.info("Common Cards: " + game.getCommunityCards());

    // New game
    MutableSeatedPlayer testPlayer;
    try {
      testPlayer = new MutableSeatedPlayer(factory.createNewPlayer("Test", 150),150);
      gameControl.sitIn(new SeatId(4), testPlayer);
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    } catch (IllegalValueException e) {
      fail(e.getMessage());
    }
View Full Code Here

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

    PlayingTableState gameControl = new PlayingTableState(pokerTable, table, kenzo);
   
    events.add(Events.newDeal, Events.newRound, Events.smallBlind, Events.allIn, Events.nextPlayer);
   
    try {
      gameControl.deal();
    } catch (IllegalActionException e1) {
      fail(e1.toString());
    }
    Game game = gameControl.getGame();

    events.add(Events.call, Events.nextPlayer);
    events.add(Events.call);
    events.add(Events.newRound, Events.newCommunityCards, Events.nextPlayer);
   
    try {
      gameControl.call(game.getCurrentPlayer());
      gameControl.call(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }
   
    events.add(Events.check, Events.nextPlayer);
    events.add(Events.check);
    events.add(Events.newRound, Events.newCommunityCards, Events.nextPlayer);
   
    // Flop Round
    try {
      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.add(Events.newRound, Events.newCommunityCards, Events.nextPlayer);

    // Turn Round
    try {
      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.add(Events.showHand, Events.showHand, Events.showHand, Events.winner);

    events.ignore();

    // Final Round
    try {
      gameControl.check(game.getCurrentPlayer());
      gameControl.check(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

    GameFlowTest.logger.info("Small Blind: "
        + pokerTable.getTableConfiguration().getSmallBlind());
    GameFlowTest.logger.info("Big Blind: "
        + pokerTable.getTableConfiguration().getBigBlind());

    PlayingTableState gameControl = new PlayingTableState(pokerTable, table, kenzo);
   
    events.add(newDealEvents);
   
    try {
      gameControl.deal();
    } catch (IllegalActionException e1) {
      fail(e1.toString());
    }
    GameFlowTest.logger.info("Betting Rules: "
        + gameControl.getGame().getBettingRules().toString());
    Game game = gameControl.getGame();

    GameFlowTest.logger.info("Dealer: " + game.getDealer());

    GameFlowTest.logger.info(game.getCurrentDealPlayers());
    GameFlowTest.logger.info("Kenzo's Cards: " + kenzo.getPocketCards());
    GameFlowTest.logger.info("Cedric's Cards: " + cedric.getPocketCards());
    GameFlowTest.logger.info("Guy's Cards: " + guy.getPocketCards());

    events.add(Events.raise, Events.nextPlayer);
    events.add(Events.call, Events.nextPlayer);
    events.add(Events.allIn, Events.nextPlayer);
    events.add(Events.raise, Events.nextPlayer);
   
   
    try {
      gameControl.raise(kenzo, 20);
      gameControl.call(cedric);
      gameControl.allIn(guy);
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    try {
      gameControl.raise(kenzo, 75);
    } catch (IllegalActionException e1) {
      fail("Previous all in big enough to open up betting!");
    }

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.