-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot_yabl.js
183 lines (151 loc) · 4.42 KB
/
bot_yabl.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
$("#tabsLotteryTypes-2").prepend('<div id="bot-inform">'+
'<div style="float:left;">'+
'<p><b>BOT FUNCTIONS</b></p>'+
'*x: <input id="koef" size="5" value="1.3"><br>'+
'max: <input id="limit" size="5" value="100"><br>'+
'1-<input class="logic-select" type="radio" name="log" value="logic1" selected="" >'+
'2-<input class="logic-select" type="radio" name="log" value="logic2">'+
'3-<input class="logic-select" type="radio" name="log" value="logic3">'+
'4-<input class="logic-select" type="radio" name="log" value="logic4">'+
'<br><button id="startBot">start</button> <button id="stopBot">stop</button>'+
'</div><div style="float:left;">'+
'<p><b>BOT Statistics</b></p>'+
'<p>Max numbers:<span id="b_stat_max"></span></p>'+
'<p>Min numbers:<span id="b_stat_min"></span></p>'+
'</div><div style="clear:both;"></div></div>');
function Statistics(){
this.numbers = Object.create(null);
this.newRound = function(){
var self = this;
$("#divWinningNumbers div").each(function(i, e){
var name = parseInt($(e).text());
if( !self.numbers[name] ){
self.numbers[name] = 1;
} else {
self.numbers[name]++;
}
});
return this;
}
this.setMaxMin = function(){
var self = this;
var arr = Object.keys( this.numbers ).map(function ( key ) { return self.numbers[key]; });
var min = Math.min.apply( null, arr );
var max = Math.max.apply( null, arr );
$('#b_stat_max').text(min);
$('#b_stat_min').text(max);
}
this.getStatistics = function(){
return this.numbers;
}
this.clearStatistics = function(){
this.numbers = Object.create(null);
}
}
var statistic = new Statistics();
$(document).on('click', '#btPlayInstant', function(){
statistic.newRound().setMaxMin();
});
$(document).on('click', '#startBot', function(){
window.t = setInterval(logic, 1000);
return false;
});
$(document).on('click', '#stopBot', function(){
clearInterval(window.t);
return false;
});
//3
function logic(){
if( !$('#divButtonsPlay2').is(':visible') )
return;
var winNumbers = $('#divWinningNumbers .ballHit');
if( winNumbers.length == 0 ){
// No winn balls
stavka = Math.round(parseFloat($('#tbBetValue').val().replace(",", ".")) * 100000000 * parseFloat($(document).find("#koef").val()), 8);
if( stavka > parseInt($(document).find('#limit').val()) )
stavka = 10;
stavka = stavka / 100000000;
stavka = stavka.toFixed(8).replace(".", ',');
} else if( winNumbers.length == 1 ){
// 1 win ball
stavka = $('#tbBetValue').val();
} else if( winNumbers.length > 1 ){
// real winns
stavka = '0,00000010';
}
$('#tbBetValue').val(stavka);
$('#btPlayInstant').click();
}
//4
function logic(){
if( !$('#divButtonsPlay2').is(':visible') )
return;
var winNumbers = $('#divWinningNumbers .ballHit');
if( winNumbers.length == 1 ){
// No winn balls
stavka = Math.round(parseFloat($('#tbBetValue').val().replace(",", ".")) * 100000000 * parseFloat($(document).find("#koef").val()), 8);
if( stavka > parseInt($(document).find('#limit').val()) )
stavka = 10;
stavka = stavka / 100000000;
stavka = stavka.toFixed(8).replace(".", ',');
} else if( winNumbers.length == 0 ){
// 1 win ball
stavka = $('#tbBetValue').val();
} else if( winNumbers.length > 1 ){
// real winns
stavka = '0,00000010';
}
$('#tbBetValue').val(stavka);
$('#btPlayInstant').click();
}
var stat = [
[1, 3, 6, 8, 4, 0],
[5, 9, 1, 4, 7, 8],
[3, 5, 8, 7, 2, 0],
];
function recursionItems(items, level, arResult){
if( !arResult )
var arResult = [];
for( var i = 0; i < items.length; i++ ){
var strReturn = "";
if( level >= 1 )
strReturn = recursionItems(items.slice(1), level-1, arResult);
else
strReturn = items[i]+","+ items[i+1];
arResult.push(strReturn);
}
return arResult;
}
console.log(recursionItems(stat[0], 1));
function recStr(arStr, items){
for (var s = 0; s < arStr.length; s++) {
for( var i = 0; i < items.length; i++ ){
arStr[i] += items[i];
}
};
return arStr;
}
/*
var double = {};
function findDouble(items, cnt){
for(var i = 0; i < items.length;i++ ){
var n = recursionPar(items, 1);
if( !double[n] )
double[n] = 1;
else
double[n]++;
}
}
}
function recursionPar(items, level){
for(var _i = level; _i < items.length;_i++ ){
var n = items[i]+','+items[_i];
if( items[i] > items[_i] ){
n = items[_i]+','+items[i];
}
return n;
}
for(var t = 0; t < stat.length; t++){
findDouble(stat[t]);
}
*/