Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class badugi500635998 implements BadugiPlayer
- {
- private static int count = 0;
- private int id;
- private int position;
- private int totalRaises; // total number of bets and raises in the entire hand
- public badugi500635998() { this.id = ++count; }
- public void startNewHand(int position, int handsToGo, int currentScore) {
- this.position = position; totalRaises = 0;
- }
- public int bettingAction(int drawsRemaining, BadugiHand hand, int bets, int pot, int toCall, int opponentDrew) {
- //List<Card> activeCIH =hand.getActiveCards();//gets best current hand
- //List<Card> inactiveCIH =hand.getInactiveCards();//gets the other cards
- hand.getActiveCards().get(0).getRank();//to obtain card rank
- hand.getActiveCards().get(0).getSuit();//to obtain card suit
- int handSize = hand.getActiveCards().size();
- //Variable names for easy documentation
- int fullHand = 4;
- int threeCardHand = 3;
- int oneDrawRemaining = 1;
- int twoCardHand = 2;
- int noCardsDrawn = 0;
- Random rand = new Random();
- int gamble = rand.nextInt(100) + 1;
- int tracker = 0;
- //if i have a size of 4 cards in my hand then raise
- if(handSize == fullHand){
- tracker = 0;
- return +1;
- }
- //if i have a size of 3 cards or less and more than one draws remaining then fold
- if(handSize == threeCardHand && drawsRemaining > oneDrawRemaining) {
- tracker = 0;
- return -1;
- }
- //if i have a size of 2 cards in hand and opponent draws no cards then fold
- if(handSize == twoCardHand){
- if(opponentDrew == noCardsDrawn && handSize < 3){
- tracker = 0;
- return -1;
- }
- }
- if(handSize == 4 && drawsRemaining == 3){
- int cardPosition = 0;
- if (hand.getActiveCards().get(cardPosition).getRank() < 7 ){
- cardPosition++;
- if(hand.getActiveCards().get(cardPosition).getRank() < 7){
- cardPosition++;
- if (hand.getActiveCards().get(cardPosition).getRank() < 7){
- tracker = 0;
- return +0;
- }
- }
- }
- else return -1;
- }
- if(gamble<=80 && tracker == 1){
- return +1; //raise in most cases
- } else if(gamble > 80 && gamble <= 90 && tracker == 1){
- return 0; //call in 1 out of 10 chances
- } else if(gamble > 90 && tracker == 1) {
- return -1; //fold in 1 out of 10 chances
- } else{
- System.out.print("error");
- }
- return drawsRemaining;
- }
- public List<Card> drawingAction(int drawsRemaining, BadugiHand hand, int pot, int dealerDrew) {
- List<Card> dropCards = hand.getInactiveCards();
- return dropCards;
- }
- public void showdown(BadugiHand yourHand, BadugiHand opponentHand) {
- System.out.println("Showdown seen by human player " + id + ".");
- System.out.println("Your hand at showdown: " + yourHand);
- System.out.println("Opponent hand at showdown: " + opponentHand);
- }
- public String getAgentName() { return "badugi500635998"; }
- public String getAuthor() { return "Manku, Sundar"; }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement