Beispiel #1
0
SEGD* new_segd(int idx)
{
  SEGD *seg = (SEGD *)calloc(1,sizeof(SEGD));
  seg->RT_HAN = make_hand();
  seg->FL_HAN = make_hand();
  seg->FLCK = make_lck( 0-(idx));
  seg->FFCK = make_lck(-1-(idx));
  seg->ID = idx;
  return seg;
}
Beispiel #2
0
/// Finds the best combination of 5 cards out of 7 cards.
hand_t find_best_hand(const card_t cards[7], HandStrength *strength_output)
{
#if 1
    // New method: try it out!
    Hand hand(cards, 7);
    HandStrength strength = EvaluateHand(hand);
    *strength_output = strength;
#endif

	card_t choice[5];
	hand_t best;

	// Exclude each pair of cards (i, j), and evaluate the rest.
	for (int i = 0; i < 7; i++)
	{
		for (int j = i + 1; j < 7; j++)
		{
			int ii = 0;
			for (int k = 0; k < 7; k++)
				if (k != i && k != j)
					choice[ii++] = cards[k];

			hand_t h = make_hand(choice);
			if (j == 1 || h > best)
				best = h;
		}
	}
	return best;
}