From 6701e8cbb8a6fa47ddd649dd17094749a576f601 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 28 Sep 2016 03:45:43 +0300 Subject: [PATCH] add evBot --- players/challengerBot.js | 88 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 80 insertions(+), 8 deletions(-) diff --git a/players/challengerBot.js b/players/challengerBot.js index 74b45d4..196971e 100644 --- a/players/challengerBot.js +++ b/players/challengerBot.js @@ -1,17 +1,89 @@ module.exports = function () { var info = { - name: "Nameless Challenger", - email: "", - btcWallet: "" + name: "evBot", + email: "evbot@noman.land", + btcWallet: "nil" }; - + + // I hope these don't count as "external modules"? + // they seem to come with the game engine + var Hand = require('hoyle').Hand; + var deck = new (require('hoyle').Deck)().cards; + + // increadably bad card dealer + function randCard(used) { + while(true) { + var card = deck[Math.floor(Math.random()*deck.length)].toString(); + if(used.indexOf(card) == -1) + { + used.push(card); + return card; + } + } + } + + // slowest game simulator on the planet + // needs serious optimizations + function simulate(hand, community, opponents, iterations) { + var wins = 0; + var games = 0; + var used = hand.concat(community); + + for(games=0; games pot += parseFloat(p.wagered)); + + // compensate for horrible pre-flop and flop + // reducing opponent count increases simulation winning odds + var num_opponents = game.players.filter(p => p.state == 'active').length; + var sim_opponents = Math.min(num_opponents, opponent_cap); + + // calculate winning odds + var odds = simulate(game.self.cards, game.community, sim_opponents, sim_iterations); + + // set bet + // I have no idea if this is actually a good strategy or + // if it's just good against these basic bots + return pot * odds * aggression; } } - return { update: update, info: info } - -} + return { update: update, info: info }; + +};