Package org.cspoker.common.elements.player

Examples of org.cspoker.common.elements.player.MutableSeatedPlayer


    setPotsDividedToWinner(true);
   
    if (pots.getMainPot().getContributors().size() != 1)
      throw new IllegalStateException("There can be only one winner. It's an illegal winner call.");
   
    MutableSeatedPlayer winner = pots.getMainPot().getContributors().iterator().next();
   
    BettingRound.logger.info("Winner: " + winner.getName() + " wins " + Util.parseDollars(pots.getTotalValue()));
   
    int gainedChipsValue = pots.getMainPot().getChips().getValue();
    Set<Winner> savedWinner = Collections.singleton(new Winner(winner.getId(), gainedChipsValue));
    pots.getMainPot().getChips().transferAllChipsTo(winner.getStack());
   
    gameMediator.publishWinnerEvent(new WinnerEvent(savedWinner));
  }
View Full Code Here


    try {
      // If there are only 2 players, blinds are inverted.
      if (game.getNbCurrentDealPlayers() == 2) {
        game.nextPlayer();
      }
      MutableSeatedPlayer player = getGame().getCurrentPlayer();
      collectSmallBlind(player);
      getGame().nextPlayer();
    } catch (IllegalValueException e) {
      goAllIn(getGame().getCurrentPlayer());
      someoneBigAllIn = false;
    }
   
    if (getGame().getNbCurrentDealPlayers() != 1) {
      try {
        bigBlindPlayer = getGame().getCurrentPlayer();
        collectBigBlind(bigBlindPlayer);
        getGame().nextPlayer();
      } catch (IllegalValueException e) {
        goAllIn(getGame().getCurrentPlayer());
        bigBlindAllIn = true;
      }
    }
   
    PreFlopRound.logger.info("*** HOLE CARDS ***");
   
    //Start dealing after dealer seat, to enable card stratification
    for (MutableSeatedPlayer player : getGame().getCurrentDealPlayers()) {
      if(player.getSeatId().getId()>game.getDealer().getSeatId().getId()){
      dealPlayerCards(gameMediator, player);
      }
    }
    for (MutableSeatedPlayer player : getGame().getCurrentDealPlayers()) {
      if(player.getSeatId().getId()<=game.getDealer().getSeatId().getId()){
        dealPlayerCards(gameMediator, player);
      }
    }
   
    for (MutableAllInPlayer allInPlayer : allInPlayers) {
      MutableSeatedPlayer player = allInPlayer.getPlayer();
      player.dealPocketCard(drawCard());
      player.dealPocketCard(drawCard());
     
      PreFlopRound.logger.info("Dealt to " + player.getName() + " " + player.getPocketCards());
     
      gameMediator.publishNewPocketCardsEvent(player.getId(), new NewPocketCardsEvent(EnumSet.copyOf(player
          .getPocketCards())));
    }
   
    if (game.getCurrentPlayer() != null && getGame().getNbCurrentDealPlayers() > 1
        || !onlyOnePlayerLeftBesidesAllInPlayersAndCalled()) {
View Full Code Here

      }

    });
    pokerTable.subscribeHoldemTableListener(events);
    try {
      kenzo = new MutableSeatedPlayer(factory.createNewPlayer("kenzo", 100), 100);
      cedric = new MutableSeatedPlayer(factory.createNewPlayer("cedric", 100), 100);
      guy = new MutableSeatedPlayer(factory.createNewPlayer("guy",100), 100);
      table.addPlayer(kenzo);
      table.addPlayer(cedric);
      table.addPlayer(guy);

    } catch (IllegalValueException e) {
View Full Code Here

    }
  }

  public void test2AllInOneActivePlayerCase() {
    try {
      kenzo = new MutableSeatedPlayer(factory.createNewPlayer("Kenzo", 100), 100);
      cedric = new MutableSeatedPlayer(factory.createNewPlayer("Cedric", 100),100);
      guy = new MutableSeatedPlayer(factory.createNewPlayer("Guy", 200),200);
      TableConfiguration configuration = new TableConfiguration();
      table = new ServerTable(configuration);
      table.addPlayer(kenzo);
      table.addPlayer(cedric);
      table.addPlayer(guy);
View Full Code Here

  }

  public void testAllAllInCase() {
    try {
      kenzo = new MutableSeatedPlayer(factory.createNewPlayer("Kenzo", 200), 200);
      cedric = new MutableSeatedPlayer(factory.createNewPlayer("Cedric", 100),100);
      guy = new MutableSeatedPlayer(factory.createNewPlayer("Guy", 150),150);

      TableConfiguration configuration = new TableConfiguration();
      table = new ServerTable(configuration);
      table.addPlayer(kenzo);
      table.addPlayer(cedric);
      table.addPlayer(guy);
    } catch (IllegalValueException e) {
      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

  }

  public void testAllInBigBlindCase() {
    try {
      kenzo = new MutableSeatedPlayer(factory.createNewPlayer("Kenzo", 100), 100);
      cedric = new MutableSeatedPlayer(factory.createNewPlayer("Cedric", 100),100);
      guy = new MutableSeatedPlayer(factory.createNewPlayer("Guy", 100),9);

      TableConfiguration configuration = new TableConfiguration();
      table = new ServerTable(configuration);
      table.addPlayer(kenzo);
      table.addPlayer(cedric);
View Full Code Here

   * round for more betting.
   */
  public void testAllInRaiseCase() {
    try {

      kenzo = new MutableSeatedPlayer(factory.createNewPlayer("Kenzo", 200), 200);
      cedric = new MutableSeatedPlayer(factory.createNewPlayer("Cedric", 220),220);
      guy = new MutableSeatedPlayer(factory.createNewPlayer("Guy", 100),100);

      TableConfiguration configuration = new TableConfiguration();
      table = new ServerTable(configuration);

      table.addPlayer(kenzo);
View Full Code Here

    }
  }

  public void testBothBlindsAllInCase() {
    try {
      kenzo = new MutableSeatedPlayer(factory.createNewPlayer("Kenzo", 100), 100);
      cedric = new MutableSeatedPlayer(factory.createNewPlayer("Cedric", 100),4);
      guy = new MutableSeatedPlayer(factory.createNewPlayer("Guy", 100),9);

      TableConfiguration configuration = new TableConfiguration();
      table = new ServerTable(configuration);
      table.addPlayer(kenzo);
      table.addPlayer(cedric);
View Full Code Here

  }
 
  public void testMultiplePlayersSmallAllinBetRaise() {
    try {

      kenzo = new MutableSeatedPlayer(factory.createNewPlayer("Kenzo", 100), 100);
      cedric = new MutableSeatedPlayer(factory.createNewPlayer("Cedric", 100),18);
      guy = new MutableSeatedPlayer(factory.createNewPlayer("Guy", 100),100);

      TableConfiguration configuration = new TableConfiguration();
      table = new ServerTable(configuration);
      table.addPlayer(kenzo);
      table.addPlayer(cedric);
View Full Code Here

  }

  public void testMultiplePlayersAllInSmallBlindCase() {
    try {

      kenzo = new MutableSeatedPlayer(factory.createNewPlayer("Kenzo", 100), 100);
      cedric = new MutableSeatedPlayer(factory.createNewPlayer("Cedric", 100),4);
      guy = new MutableSeatedPlayer(factory.createNewPlayer("Guy", 100),100);

      TableConfiguration configuration = new TableConfiguration();
      table = new ServerTable(configuration);
      table.addPlayer(kenzo);
      table.addPlayer(cedric);
View Full Code Here

TOP

Related Classes of org.cspoker.common.elements.player.MutableSeatedPlayer

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.