int quality1, quality2;
Map<String, Integer> rankMap = new HashMap<String, Integer>();
double totalTests = 10000.0;
for (int j = 0; j < totalTests; j++) {
Deck deck = Deck.createTruelyRandomDeck();
Hand hand1 = new Hand(deck.deal(5));
Hand hand2 = new Hand(deck.deal(5));
compare = hand1.compareTo(hand2);
qualityGreater = (compare == 1);
qualitySmaller = (compare == -1);
qualityEqual = (compare == 0);
quality1 = hand1.getRank();
quality2 = hand2.getRank();
String rank = hand1.getShortDescription();
if (!rankMap.containsKey(rank)) {
rankMap.put(rank, Integer.valueOf(1));
}
rankMap
.put(rank, Integer
.valueOf(rankMap.get(rank).intValue() + 1));
if (qualityGreater != (quality1 < quality2)
|| qualitySmaller != (quality1 > quality2)
|| qualityEqual != (quality1 == quality2)) {
TestHandQuality.logger.info("compareTo "
+ hand1.compareTo(hand2));
TestHandQuality.logger.info(hand1.toString());
TestHandQuality.logger.info(hand1.getShortDescription());
TestHandQuality.logger.info("quality 1 " + quality1);
TestHandQuality.logger.info(hand2.toString());
TestHandQuality.logger.info(hand2.getShortDescription());
TestHandQuality.logger.info("quality 2 " + quality2);
fail("error");
}
if (j % (totalTests / 10) == 0) {
TestHandQuality.logger.info(Integer.valueOf(j));