Esempio n. 1
0
  public static void main(String args[]) {
    Card n = null;
    List<Optional<Card>> board = new ArrayList<Optional<Card>>();
    List<Optional<Card>> holeCards = new ArrayList<Optional<Card>>();
    List<Optional<Card>> opponentHoleCards = new ArrayList<Optional<Card>>();

    holeCards.add(
        Optional.of(new Card(Suit.fromFirstLetterLowerCase("s"), Rank.fromFirstLetter("14"))));
    holeCards.add(
        Optional.of(new Card(Suit.fromFirstLetterLowerCase("c"), Rank.fromFirstLetter("13"))));

    opponentHoleCards.add(
        Optional.of(new Card(Suit.fromFirstLetterLowerCase("d"), Rank.fromFirstLetter("2"))));
    opponentHoleCards.add(
        Optional.of(new Card(Suit.fromFirstLetterLowerCase("h"), Rank.fromFirstLetter("3"))));

    // board.add(Optional.of(new Card( Suit.fromFirstLetterLowerCase("s"),
    // Rank.fromFirstLetter("13"))));
    // board.add(Optional.of(new Card( Suit.fromFirstLetterLowerCase("h"),
    // Rank.fromFirstLetter("2"))));
    // board.add(Optional.of(new Card( Suit.fromFirstLetterLowerCase("h"),
    // Rank.fromFirstLetter("3"))));
    // board.add(Optional.of(new Card( Suit.fromFirstLetterLowerCase("s"),
    // Rank.fromFirstLetter("13"))));
    board.add(Optional.fromNullable(n));
    board.add(Optional.fromNullable(n));
    board.add(Optional.fromNullable(n));
    board.add(Optional.fromNullable(n));
    board.add(Optional.fromNullable(n));

    AIHelper ai = new AIHelper();
    System.out.println(ai.getWinningChance(board, holeCards, opponentHoleCards));
  }
Esempio n. 2
0
 public void generateCards() {
   Optional<Card> card;
   suits.add("s");
   suits.add("c");
   suits.add("d");
   suits.add("h");
   for (String s : suits) {
     for (int i = 2; i < 15; i++) {
       card =
           Optional.of(
               new Card(
                   Suit.fromFirstLetterLowerCase(s), Rank.fromFirstLetter(Integer.toString(i))));
       cardPool.add(card);
     }
   }
 }