Recently, I stumbled upon an entertaining video from the category of "To quickly become rich you need only ...". The video begins with a pathetic recalculation of a solid wad of money and a demonstration of a decent bill. Next, the guy shows a strategy that is based on the phrase "Well, look at the chart, here it is clear."
However, I am a modest person, and therefore I decided before going after my Lard to first check this strategy mathematically and programmatically. Below you can see what came of it.
Oh, how I like martingales with smart strategies . But let's get down to business.
Let's start with the decomposition of the task:
The graph on the site is an SVG element. Of course, we can analyze it right there, but first I would prefer to work in my own project. In the end, we would first be convinced of the effectiveness of the strategy, and only then write a robot, which will click our farm to farm our "wealth"
Comments immediately after the code.
function turnToString(img) {
var canvas = document.createElement('canvas'); //(1)
var ctx = canvas.getContext('2d');
canvas.width = img.width;
canvas.height = img.height;
ctx.drawImage(img, 0, 0, img.width, img.height);
img.remove();
document.body.appendChild(canvas);
var result = [];
var isLocked = false;
var imgData = ctx.getImageData(0,0,canvas.width,canvas.height).data;
for(var i = 0;i<canvas.width;i++) {
var mainColor = "N";
for(var j = 0;j<canvas.height;j++) { //(2)
var colorIndexes = getColorIndexes(i,j,canvas.width);
var redPartIndex= colorIndexes[0];
var greenPartIndex= colorIndexes[1];
if (imgData[redPartIndex] > 120) {
mainColor = "O";
break;
}
if (imgData[greenPartIndex] > 120) {
mainColor = "G";
break;
}
}
if (isLocked == false && mainColor == "G") { //(3)
result.push("G");
isLocked = true;
}
if (isLocked == false && mainColor == "O") {
result.push("O");
isLocked = true;
}
if (mainColor == "N") {
isLocked = false;
}
console.log("Yet another line")
}
return result.join("");
}
getColorIndexes, .
function getColorIndexes(x,y,width) {
var R = 4*(width*y + x);
return [R,R+1,R+2];
}
, Uint8ClampedArray , getImageData — . , , .. , V8 .
.
1) . DOM, .. , - .
2) . KGB RGB. ( ), . Main color .
3) , . isLocked true. «N», , isLocked
Profit! !
, , .
. , .
function basicProfitAnalisis(mask) {
var maskInUse = mask;
var result = [0,0];
var currentBet = 50;
var baseBet = 50;
var maxBet = baseBet;
var totalSum = 0;
var multiplier = 0.82;
for(var i = 1;i<maskInUse.length;i++) {
if (maskInUse[i] == maskInUse[i-1]) {
result[0]++; // .
totalSum += currentBet*multiplier;
currentBet = baseBet;
} else {
result[1]++; // .
totalSum -= currentBet;
currentBet *= 2;
if (currentBet > maxBet) {
maxBet = currentBet;
}
}
}
document.getElementById("betsWon").innerHTML += result[0];
document.getElementById("betsLost").innerHTML += result[1];
if (totalSum >= 0) {
document.getElementById("pureChange").innerHTML += `<font
color='green'>${totalSum}</font>`;
} else {
document.getElementById("pureChange").innerHTML += `<font color='red'>${totalSum}
</font>`;
}
document.getElementById("maxBet").innerHTML += maxBet;
setCookie("totalSum", parseInt(getCookie("totalSum"))+totalSum, 365);
}
. , . . , — . , , ( — 0.82, ) . , .
, , -.
. , . .
? — ?
… -, , . .
, .
?
! ? . — .
, .
, , , 10-:
, — , , , , 5 , . , , .
. . . , , , , , . 0. , , , 48.65% ( — 2.7%). «» — . . — 0.82 /. .
, , , , .
, - / , , . .
, . , . ! , . , , .
, , .
, , . , . . , , ( ), … ? ?
, , , . , , :)
.
Source: https://habr.com/ru/post/420523/
All Articles