// CONFIG ////////////////
var initialBetAmount = 2;
var mode = 'martingale'; // can be 'martingale' or 'anti-martingale' (WAT? https://en.wikipedia.org/wiki/Martingale_(betting_sys.. )
var betColor = 'black'; // can be 'red' or 'black'
//////////////////////////
function tick() {
var a = getStatus();
if (a !== lastStatus && "unknown" !== a) {
switch (a) {
case "waiting":
bet();
break;
case "rolled":
rolled()
}
lastStatus = a, printInfo()
}
}
function checkBalance() {
return getBalance() - 1
}
function getColor(a) {
return 0 == a ? "green" : a >= 1 && 7 >= a ? "red" : "black"
}
function wonLastRoll() {
return lastBetColor ? lastRollColor === lastBetColor : null
}
var currentBetAmount = initialBetAmount,
currentRollNumber = 1,
lastStatus, lastBetColor, lastRollColor, $balance = $("#balance"),
$betAmountInput = $("#betAmount"),
$statusBar = $(".progress #banner"),
$redButton = $("#panel1-7 .betButton"),
$blackButton = $("#panel8-14 .betButton"),
refreshIntervalId = setInterval(tick, 500);
这是代码。该代码与csgodouble.com一起使用,只在一种颜色下注,我希望它选择一个随机颜色。红色/黑色
答案 0 :(得分:2)
由于您没有提供太多详细信息,我猜这是您需要的:
function f(a) {
return a%2 ? [a] : false;
}
x = [];
for (var i=1; i < 10; i+=2) {
x = f(i).concat(x);
}
document.write(x);
答案 1 :(得分:0)
您可以生成随机颜色:
function randColor() {
var col = "";
var possible = "ABCDEF1234567890";
for( var i=0; i < 6; i++ )
col += possible.charAt(Math.floor(Math.random() * possible.length));
return "#" + col;
}