Examples of HoleCards


Examples of com.javaflair.pokerprophesier.api.card.HoleCards

     * @param pls an array list of players entered via the UI.  Each player can
     *        have cards or not as well as have folded or not
     */
    private void setPlayerCards( ArrayList<Player> pls ) {
        //Variables to store data in types used by the calc engine
        HoleCards cards;
        Player player;
       
        //Set the total players in the hand (folder or not)
        totalPlayers = pls.size();
       
        //Create the HoleCards array used by the engine
        playerCards = new HoleCards[ totalPlayers ];
       
        //Loop through each player in the ArrayList, create a HoleCards object
        //for them, set their cards & state then add to the prcessing array
        //used by the calc engine
        for ( int ii = 0; ii < totalPlayers; ii++ ) {
            //Get the next player from the list
            player = pls.get(ii);
           
            //Check if the player is active (cards in their hand)
            if ( player.isActive() ) {
                //The player is active, create a HoleCards class for them and
                //assign their cards using the data from the input
                cards = new HoleCards( new Card( player.getCard(0).getRank(),
                                                 player.getCard(0).getSuit() ),
                                       new Card( player.getCard(1).getRank(),
                                                 player.getCard(1).getSuit() ) );
               
                //Check if the player has folded
                if ( player.getFolded() )
                    //This defaults to false, so only set if they have folded
                    cards.setFolded( true );
                else
                    //Haven't folded, inc the # of active players
                    activePlayers++;
            }
            else
View Full Code Here

Examples of com.javaflair.pokerprophesier.api.card.HoleCards

     * @throws SimulatorException if there is an error thrown by the adapter.
     *         Most likely because of invalid player or community configurations
     */
    private void runSinglePlayerSimulations() throws SimulatorException {
       
        HoleCards cards;
       
        //Create the results array.  All players have result records created
        //even if they are inactive or folded, so use total, not active Players
        playerResults = new PlayerResults[ totalPlayers ];
       
        //Process each player in a loop.  Create a results object to store the
        //current results, check if the player is inactive or folded, then if
        //they are active run the single player simulation using just their
        //HoleCards.  Finally, add the current player result to the results
        //array, regardless of the player state.
        for ( int ii = 0; ii < totalPlayers; ii++ ) {
            //Create a new Player Results object to store info for the current player
            currResult = getNewPlayerResult( ii+1 );
           
            //Get the next set of hole cards in the player array
            cards = playerCards[ii];
           
            //If there were multiple active players in the hand set the perfect
            //win percent using the player game stats helper
            if ( activePlayers > 1 )
                currResult.setPerfectWinPct( playerGameStatsHelper.getPlayerProb(ii) * PCT_MULT );
   
            //Make sure the player is active before calculating their results
            if ( cards == null )
                //The player was never assigned cards, they are just a place
                //holder for calculating player vs player results
                currResult.setPlayerState( TransportUtils.PLAYER_EMPTY );
            else if ( cards.isFolded() )
                //The player was assigned known cards, but folded.  This
                //changes the perfect win % calculations, but it treated
                //the same as an empty player for imperfect calculations
                currResult.setPlayerState( TransportUtils.PLAYER_FOLDED );
            else
View Full Code Here

Examples of com.javaflair.pokerprophesier.api.card.HoleCards

     * For each player in the game 2 randomly selected cards are assigned and
     * every player after the 1st has a 50% chance of folding.
     */
    private void setPlayerCards( ) {
        //Variables to store data in types used by the calc engine
        HoleCards cards;
        Card c1, c2;
        int p;
       
        //Create the HoleCards array used by the engine
        playerCards = new HoleCards[ totalPlayers ];
       
        //Loop through each player in the game, randomly select 2 cards from the
        //deck, create a HoleCards object for them, set their cards & state then
        //add to the processing array used by the calc engine.  After the 1st
        //player is assigned cards 15% of subsequent players will randomly
        //be assigned as inactive (null).  Of those that are active, 25% will
        //be set as folded.
        for( int ii = 0; ii < totalPlayers; ii++ ) {
            //Generate a random # 0-99 where 0-14 mean an inactive player
            if ( ii == 0 || rand.nextInt(100) > 14 ) {
                //Player is active, get 2 random cards to assign to them
                c1 = getNextRandomCard();
                c2 = getNextRandomCard();
               
                //Create a new hole cards object using the random cards
                cards = new HoleCards( c1, c2 );
               
                //Randomly fold 25% of players after the 1st
                if ( ii > 0 && rand.nextInt(4) == 3 )
                    //Fold the player
                    cards.setFolded( true );
                else
                    //Not folded and active, inc the counter
                    activePlayers++;   
            }
            else
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.