console
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
let money = minMoney = maxMoney = 0;
let round = maxRound = 0;
function game() {
let res = "";
let smallEnd = /小{5,}$/;
let bigEnd = /大{5,}$/;
for(let i=0; i<10000; i++) {
let betRes = null, betMoney;
if(smallEnd.test(res)) {
betRes = "大";
}
if(bigEnd.test(res)) {
betRes = "小";
}
if(betRes) {
round++;
betMoney = 100 * Math.pow(2, round-1);
}
res += (Math.random()<0.5? "小" : "大");
if(betRes != null) {
maxRound = (maxRound > round? maxRound : round);
if(res[i] == betRes) {
money += betMoney;
round = 0;
} else {
money -= betMoney;
}
setRange();
}
}
}
function setRange() {
minMoney = (minMoney < money? minMoney : money);
maxMoney = (maxMoney > money? maxMoney : money);
}
game();
console.log("最大轮次:" + maxRound);
console.log("最大赌金:" + 100 * Math.pow(2, maxRound-1));
console.log("最小盈利:" + minMoney);
console.log("最大盈利:" + maxMoney);
console.log("最终盈利:" + money);
</script>
</body>
</html>