Ejemplo n.º 1
0
  @Test
  public void testIsAcceptableCombination() throws Exception {
    Card cards[] =
        new Card[] {
          PokerDeck.getCard(CardSuitType.DIAMOND, CardDenominationType.ACE),
          PokerDeck.getCard(CardSuitType.DIAMOND, CardDenominationType.D10),
          PokerDeck.getCard(CardSuitType.SPADE, CardDenominationType.D9),
          PokerDeck.getCard(CardSuitType.CLUB, CardDenominationType.D5),
          PokerDeck.getCard(CardSuitType.CLUB, CardDenominationType.D4)
        };

    HighCard highCard = new HighCard();
    assertTrue(highCard.isAcceptableCombination(cards));
  }
Ejemplo n.º 2
0
  public static void main(String[] agrs) throws IOException {
    /*
    Card[] myCards = new Card[5];
    myCards[0] = new Card(9,"SPADES");
    myCards[1] = new Card(9,"CLUBS");
    myCards[2] = new Card(9,"DIAMONDS");
    myCards[3] = new Card(7,"CLUBS");
    myCards[4] = new Card(1,"DIAMONDS");

    boolean[] chgcd = Poker.suggestionForThisHand(myCards);
    for (int ii = 0; ii < chgcd.length; ii++){
    System.out.println(chgcd[ii]);
    }
    */
    try {
      Poker.out = new BufferedWriter(new FileWriter("output" + fileIndex));
      Poker.writeToFile = true;
    } catch (IOException e) {
      System.err.println(e);
    }
    List<Card[]> list = HighCard.allHighCards();
    // System.out.println(list.size());
    System.out.println("Index\tCurrent score\tExpected new score\tNumber of dropped cards");
    for (int i = prefix; i < prefix + period; ++i) {
      Card[] cards = list.get(i);
      // printCards(cards);
      // System.out.println(fileIndex*period + i);
      System.out.println(i);
      // System.out.print((fileIndex*period + i)+"\t");
      // out.write((fileIndex*period + i)+"\t");
      out.write(i + "\t");
      boolean[] change = Poker.suggestionForThisHand(cards);
      int numberOfTrue = 0;
      for (boolean bool : change) {
        if (bool) {
          numberOfTrue++;
        }
      }
      // System.out.print(numberOfTrue);
      // System.out.println();
      out.write(numberOfTrue + "");
      out.newLine();
      out.flush();
    }
    out.close();
    /*
    List<Card[]> list = ThreeOfAKind.allThreeOfAKind();
    System.out.println(list.size());
    */
  }