Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int worstValue = 12;
- int worstCard = -1;
- int[] suitAmount = new int[4];
- int suitMax = 0;
- int max = 0;
- for (int i = 0; i < 4; i++)
- {
- suitAmount[game.suitToInt(hand[i].suit)]++;
- }
- for (int i = 0; i < 4; i++)
- {
- if (suitAmount[i] > suitMax)
- {
- suitMax = suitAmount[i];
- max = i;
- }
- }
- if (suitAmount[max] > 1 && game.suitScore(hand, game.intToSuit(max)) > 15)
- {
- if (suitAmount[max] > 3)
- {
- for (int i = 0; i < 4; i++)
- {
- if (hand[i].value < worstValue)
- {
- worstValue = hand[i].value;
- worstCard = i;
- }
- }
- return worstCard;
- }
- else
- {
- for (int i = 0; i < 4; i++)
- {
- if (hand[i].value < worstValue && hand[i].suit != game.intToSuit(max))
- {
- worstValue = hand[i].value;
- worstCard = i;
- }
- }
- return worstCard;
- }
- }
- else
- {
- for (int i = 0; i < 4; i++)
- {
- if (hand[i].value < worstValue) //Tittar igenom handen efter det lägsta kortet och kastar det
- {
- worstValue = hand[i].value;
- worstCard = i;
- }
- }
- return worstCard;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement