Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.51 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class badugi500635998 implements BadugiPlayer
  4. {
  5.  
  6. private static int count = 0;
  7. private int id;
  8. private int position;
  9. private int totalRaises; // total number of bets and raises in the entire hand
  10.  
  11. public badugi500635998() { this.id = ++count; }
  12.  
  13. public void startNewHand(int position, int handsToGo, int currentScore) {
  14. this.position = position; totalRaises = 0;
  15. }
  16.  
  17. public int bettingAction(int drawsRemaining, BadugiHand hand, int bets, int pot, int toCall, int opponentDrew) {
  18. //List<Card> activeCIH =hand.getActiveCards();//gets best current hand
  19. //List<Card> inactiveCIH =hand.getInactiveCards();//gets the other cards
  20. hand.getActiveCards().get(0).getRank();//to obtain card rank
  21. hand.getActiveCards().get(0).getSuit();//to obtain card suit
  22. int handSize = hand.getActiveCards().size();
  23.  
  24. //Variable names for easy documentation
  25. int fullHand = 4;
  26. int threeCardHand = 3;
  27. int oneDrawRemaining = 1;
  28. int twoCardHand = 2;
  29. int noCardsDrawn = 0;
  30.  
  31. Random rand = new Random();
  32. int gamble = rand.nextInt(100) + 1;
  33. int tracker = 0;
  34.  
  35. //if i have a size of 4 cards in my hand then raise
  36. if(handSize == fullHand){
  37. tracker = 0;
  38. return +1;
  39. }
  40.  
  41. //if i have a size of 3 cards or less and more than one draws remaining then fold
  42. if(handSize == threeCardHand && drawsRemaining > oneDrawRemaining) {
  43. tracker = 0;
  44. return -1;
  45. }
  46.  
  47. //if i have a size of 2 cards in hand and opponent draws no cards then fold
  48. if(handSize == twoCardHand){
  49. if(opponentDrew == noCardsDrawn && handSize < 3){
  50. tracker = 0;
  51. return -1;
  52. }
  53. }
  54.  
  55. if(handSize == 4 && drawsRemaining == 3){
  56. int cardPosition = 0;
  57. if (hand.getActiveCards().get(cardPosition).getRank() < 7 ){
  58. cardPosition++;
  59. if(hand.getActiveCards().get(cardPosition).getRank() < 7){
  60. cardPosition++;
  61. if (hand.getActiveCards().get(cardPosition).getRank() < 7){
  62. tracker = 0;
  63. return +0;
  64. }
  65. }
  66. }
  67. else return -1;
  68. }
  69.  
  70. if(gamble<=80 && tracker == 1){
  71. return +1; //raise in most cases
  72. } else if(gamble > 80 && gamble <= 90 && tracker == 1){
  73. return 0; //call in 1 out of 10 chances
  74. } else if(gamble > 90 && tracker == 1) {
  75. return -1; //fold in 1 out of 10 chances
  76. }
  77.  
  78.  
  79. return drawsRemaining;
  80. }
  81.  
  82.  
  83.  
  84. public List<Card> drawingAction(int drawsRemaining, BadugiHand hand, int pot, int dealerDrew) {
  85. List<Card> dropCards = hand.getInactiveCards();
  86. return dropCards;
  87. }
  88.  
  89. public void showdown(BadugiHand yourHand, BadugiHand opponentHand) {
  90. System.out.println("Showdown seen by human player " + id + ".");
  91. System.out.println("Your hand at showdown: " + yourHand);
  92. System.out.println("Opponent hand at showdown: " + opponentHand);
  93. }
  94.  
  95. public String getAgentName() { return "badugi500635998"; }
  96.  
  97. public String getAuthor() { return "Manku, Sundar"; }
  98.  
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement