/******************************************************************************* * * Copyright (c) 2006 Javaflair. All Rights Reserved. * ******************************************************************************/ import com.javaflair.pokerprophesier.api.adapter.PokerProphesierAdapter; import com.javaflair.pokerprophesier.api.card.Card; import com.javaflair.pokerprophesier.api.card.CommunityCards; import com.javaflair.pokerprophesier.api.card.HoleCards; import com.javaflair.pokerprophesier.api.exception.SimulatorException; import com.javaflair.pokerprophesier.api.helper.MyGameStatsHelper; import com.javaflair.pokerprophesier.api.helper.MyHandHelper; import com.javaflair.pokerprophesier.api.helper.MyHandStatsHelper; import com.javaflair.pokerprophesier.api.helper.MyOutsHelper; import com.javaflair.pokerprophesier.api.helper.OppHandStatsHelper; import com.javaflair.pokerprophesier.api.helper.UpdateHelper; /** * An example of using the Me vs Opponents simulator. * * @author Javaflair */ public class MySimulatorExample{ /** * Run the example. */ public void runExample(){ // Number of simulations, total players int numSimulations= 100000; int numSimPlayers= 5; // Create an adapter to communicate with the simulator PokerProphesierAdapter adapter= new PokerProphesierAdapter(); // Try the update helper try{ UpdateHelper updateHelper= adapter.getUpdateHelper(); System.out.println("UpdateHelper:\n" + updateHelper); } catch (SimulatorException e){ e.printStackTrace(); } // Create my hole cards HoleCards myHoleCards= new HoleCards(new Card(Card.ACE, Card.CLUBS), new Card(Card.ACE, Card.DIAMONDS)); // Create the community cards CommunityCards communityCards= new CommunityCards(new Card[]{ new Card(Card.TEN, Card.CLUBS), new Card(Card.JACK, Card.CLUBS), new Card(Card.KING, Card.CLUBS), new Card(Card.NINE, Card.HEARTS)}); // Set the simulator parameters adapter.setMyOutsHoleCardSensitive(true); adapter.setOppHoleCardsRealistic(true); adapter.setOppProbMyHandSensitive(true); adapter.setNumSimulations(numSimulations); // Record the time long start= System.currentTimeMillis(); // Run the simulator try{ adapter.runMySimulations(myHoleCards, communityCards, numSimPlayers, PokerProphesierAdapter.TURN_CARD_DEALT); } catch (SimulatorException e){ e.printStackTrace(); } // Get the time taken long totalTime= System.currentTimeMillis() - start; System.out.println("-\nTime taken to run simulations: " + (totalTime / (float)1000) + " secs"); // Get the MyHandHelper MyHandHelper myHandHelper= adapter.getMyHandHelper(); System.out.println("-\nmyHandHelper:\n" + myHandHelper); // Get the MyOutsHelper MyOutsHelper myOutsHelper= adapter.getMyOutsHelper(); System.out.println("-\nmyOutsHelper:\n" + myOutsHelper); // Get the MyHandStatsHelper MyHandStatsHelper myHandStatsHelper= adapter.getMyHandStatsHelper(); System.out.println("-\nmyHandStatsHelper:\n" + myHandStatsHelper); // Get the OppHandStatsHelper OppHandStatsHelper oppHandStatsHelper= adapter.getOppHandStatsHelper(); System.out.println("-\noppHandStatsHelper:\n" + oppHandStatsHelper); // Get the MyGameStatsHelper MyGameStatsHelper myGameStatsHelper= adapter.getMyGameStatsHelper(); System.out.println("-\nmyGameStatsHelper:\n" + myGameStatsHelper); } /** * Main. * * @param args */ public static void main(String[] args){ MySimulatorExample inst= new MySimulatorExample(); inst.runExample(); } }