
module.exports = {

  VERSION: "Default JavaScript folding player",

  bet_request: function(game_state, bet) {
      
   try
{ 
      
    var cards =  getMyCards(game_state),
        player = getMyPlayer(game_state),
        myBet = 0,
        trans = {
            "1": 1,
            "2": 2,
            "3": 3,
            "4": 4,
            "5": 5,
            "6": 6,
            "7": 7,
            "8": 8,
            "9": 9,
            "10": 10,
            "J": 11,
            "Q": 12,
            "K": 13,
            "A": 14
        },
        x = trans(cards[0].rank),
        y = trans(cards[1].rank); 
    
    // OPENING HAND
    // The cards are equal
    if (x === y) {
        myBet = game_state.pot * 2;
      if ( x >== 10) {
        myBet = player.stack;  
      }   
    }
    
    console.log(cards[0]);
    console.log(cards[1]);
    console.log("My bet is : " + myBet);
    bet(myBet);  
      
}
catch (ex)
{
    console.log("Caught exception: " + ex);
}      
    
      

      
      
          
  function getMyCards(game_state) {
   
      var cards_down = game_state.community_cards;
      var players = game_state.players;
        
     var nrOfPlayers = players.length;
        for (var i=0; i<nrOfPlayers;i++) {
            if (players[i].name == 'Comfortable Pugs') {
                return players[i].hole_cards;
            }
        }
     
   };
 function getAllCards(game_state) {
        var myCards = getMyCards(game_state);
        var cards_down = game_state.community_cards;
        
        cards.push(myCards[0]);
        cards.push(myCards[1]);
        
        var cards = [];
        var cardsDownSize = cards_down.length; 
         for (var i=0; i<cardsDownSize;i++) {
            cards.push(cards_down[i]);
        }
        return cards;
    };
    function getMyPlayer(game_state) {
              var players = game_state.players;
        
     var nrOfPlayers = players.length;
        for (var i=0; i<nrOfPlayers;i++) {
            if (players[i].name == 'Comfortable Pugs') {
                return players[i];
            }
        }
    }

  },

  showdown: function(game_state) {

  }

};

@@ -233,461 +233,77 @@
 t = 
-0,%0A        trans = %7B%0A            %221%22: 1,%0A            %222%22: 2,%0A            %223%22: 3,%0A            %224%22: 4,%0A            %225%22: 5,%0A            %226%22: 6,%0A            %227%22: 7,%0A            %228%22: 8,%0A            %229%22: 9,%0A            %2210%22: 10,%0A            %22J%22: 11,%0A            %22Q%22: 12,%0A            %22K%22: 13,%0A            %22A%22: 14%0A        %7D,%0A        x = trans(cards%5B0%5D.rank),%0A        y = trans(cards%5B1%5D.rank); %0A    %0A    // OPENING HAND%0A    // The cards are equal%0A    if (x === y
+game_state.current_buy_in; %0A   /* if (cards%5B0%5D.rank === cards%5B1%5D.rank
 ) %7B%0A
@@ -305,33 +305,28 @@
 k) %7B%0A       
- myBet = 
+bet(
 game_state.p
@@ -331,76 +331,69 @@
 .pot
- * 2
+)
 ;%0A    
-  if ( x %3E== 10) %7B%0A        myBet = player.stack
+%7D else %7B%0A       bet(game_state.current_buy_in)
 ;  
-%0A
      
- %7D
    %0A
@@ -393,24 +393,26 @@
       %0A    %7D
+*/
 %0A    %0A    co
@@ -467,44 +467,101 @@
     
-console.log(%22My bet is : %22 + myBet);
+if (cards%5B1%5D.rank === cards%5B1%5D.rank) %7B%0A        myBet = game_state.current_buy_in * 2;  %0A    %7D
 %0A   
@@ -1807,13 +1807,14 @@
 ) %7B%0A%0A  %7D
+,
 %0A%0A%7D;%0A

Revert "Initial hand logic"