This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Calculates the sum of the items in the array. | |
// The sum is the result of adding all the items together. | |
Array.prototype.sum = function(){ | |
return this.reduce((a, b) => a + b); | |
} | |
// Checks whether the specified item is present in the array. | |
Array.prototype.contains = function (item) { | |
return this.find(x => x === item) !== undefined; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const DEBUG = !0 | |
const BET_BALANCE = 0.03 // max bankroll available to bet with | |
const MAX_CUT_OFF = 1.5 | |
const MIN_CUT_OFF = 1.08 | |
const BET_SPEED = 300 | |
const iskips = 20 | |
const hmrsv = 3 | |
let prevresults = []; | |
let previous_losses = []; | |
let loseStreak = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function asyncParForEach(array, fn, callback) { | |
var completed = 0; | |
if (array.length === 0) { | |
callback(); // done immediately | |
} | |
array.forEach(function(data) { | |
fn(data, function() { | |
completed++; | |
if (completed === array.length) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Get a range of numbers between two numbers | |
//Usage: [1, 10].range returns [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
Object.defineProperty(Array.prototype, "range", { | |
get: function () { | |
var range = [this[0]], i; | |
for (var i = this[0], len = this[1]; i < len; range.push(++i)); | |
return range; | |
} | |
}); | |
// Golfed TypeScript: |