function minbet(gs) {
  return gs.current_buy_in - gs.players[gs.in_action]['bet'] + gs.minimum_raise;
}

var l = console.log;

function checkCard(card) {
        switch (card) {
            case "J" :
                card = 11;
                break;
            case "Q" :
                card = 12;
                break;
            case "K" :
                card = 13;
                break;
            case "A" :
                card = 14;
                break;
            default:
                card = card;
        }
        return card;
    }

function calculateBet(gs) {
<<<<<<< HEAD
    console.log(minbetgs);
    console.log(randomRaise(ranking(gs)));
      return minbet(gs) + randomRaise(ranking(gs));
=======
      return minbet(gs) + raise(ranking(gs));
>>>>>>> 414f8b642fa61962854e320f64e9b000aefc23d5
}

function cardholder(game_state) {
    var ours = game_state.players[game_state.in_action].hole_cards;
    var common = game_state.community_cards;
    var cards = common.map(function(x) {
        return checkCard(x.rank);
    });
    cards.push(checkCard(ours[0].rank));
    cards.push(checkCard(ours[1].rank));
    return cards.sort();
}

function findPair(game_state) {
    var cards = cardholder(game_state);
    for (var i in cards) {
        if (i = cards.length) return false;
        if (cards[i] === cards[i+1]) {
            return true;
        }
    }
}

function twoPair(game_state) {
    var cards = cardholder(game_state);
    counter = 0;
    for (var i = 0; i < cards.length - 2; i++) {
        if (cards[i] === cards[i+1]) {
            counter++;
            i++;
        }
    }
    if (counter >= 2) {
        return true;
    }
}

function threeOfaKind(game_state) {
    var cards = cardholder(game_state);
     for (var i in cards) {
        if (cards[i] === cards[i+1] && cards[i+1] === cards[i+2]) {
           return true;
        }
    }
}

function raise(rank) {
    var small = 100;
    var big = 300;
    return big * rank;
}

function lotsOfMoney(gs) {
    if (minbet(gs) >= gs.players[gs.in_action].stack / 2) {
        return true;
    }
}

function ranking(gs) {
  if (threeOfaKind(gs)) return odds.three
  if (twoPair(gs)) return odds.twoPair;
  if (findPair(gs)) {
    return odds.pair;
  } else {
    return false;
  }
}

var odds = {
  highCard : 1,
  pair : 1.37,
  twoPair : 20,
  three : 46.3,
  straight : 254
}


module.exports = {
    calBet: calculateBet,
}

@@ -148,22 +148,16 @@
 card) %7B%0A
-      
   switch
@@ -162,32 +162,24 @@
 ch (card) %7B%0A
-        
     case %22J%22
@@ -177,34 +177,24 @@
  case %22J%22 :%0A
-          
       card =
@@ -208,33 +208,15 @@
     
-     
-     
 break;%0A
-        
     
@@ -222,34 +222,24 @@
  case %22Q%22 :%0A
-          
       card =
@@ -243,26 +243,16 @@
 d = 12;%0A
-          
       br
@@ -252,32 +252,24 @@
      break;%0A
-        
     case %22K%22
@@ -267,34 +267,24 @@
  case %22K%22 :%0A
-          
       card =
@@ -298,33 +298,15 @@
     
-          break;%0A        
+break;%0A
     
@@ -318,34 +318,24 @@
 %22A%22 :%0A      
-     
-     
 card = 14;%0A 
@@ -343,33 +343,15 @@
     
-          break;%0A        
+break;%0A
     
@@ -359,26 +359,16 @@
 efault:%0A
-          
       ca
@@ -384,22 +384,10 @@
 ;%0A  
-      %7D%0A      
+%7D%0A
   re
@@ -397,20 +397,16 @@
 n card;%0A
-    
 %7D%0A%0Afunct
@@ -432,93 +432,410 @@
 ) %7B%0A
-%3C%3C%3C%3C%3C%3C%3C HEAD%0A    console.log(
+  var bet;%0A  var r = ranking(gs)%0A  if (r) %7B%0A    return 
 minbet
+(
 gs)
-;%0A    console.log(randomRaise(ranking(gs))
+ + raise(r);%0A  %7D else %7B%0A    return highCards(gs);%0A  %7D%0A%7D%0A%0Afunction highCards(gs) %7B%0A  var ours = gs.players%5Bgs.in_action%5D.hole_cards;%0A  var card1 = checkCard(ours%5B0%5D.rank);%0A  var card2 = checkCard(ours%5B1%5D.rank);%0A%0A  if (card1 %3C 2 && card2 %3C 2) %7B%0A    return 10;%0A  %7D else if (card1 %3C 6 && card2 %3C 6 && !lotsOfMoney(gs)) %7B%0A    l(%22low cards%22
 );%0A
-  
     
@@ -855,139 +855,190 @@
 (gs)
- + randomRaise(ranking(gs));%0A=======%0A      return minbet(gs) + raise(ranking(gs));%0A%3E%3E%3E%3E%3E%3E%3E 414f8b642fa61962854e320f64e9b000aefc23d5
+;%0A  %7D else if (card1 %3C 10 && card2 %3C 10 && !lotsOfMoney(gs)) %7B%0A    l(%22middle cards%22);%0A    return minbet(gs) + 200;%0A  %7D else %7B%0A    l(%22high cards%22);%0A    return minbet(gs) + 100000;%0A  %7D
 %0A%7D%0A%0A

bring back old logic