김한준

누적 번호 보기 및 번호 추천 기능 추가

Showing 1 changed file with 114 additions and 4 deletions
1 var data; 1 var data;
2 +var acum_list = new Array();
3 +for (i=0;i<45;i++){
4 + acum_list[i]=0;
5 +}
2 6
7 +
3 8
4 $(document).ready(function () { 9 $(document).ready(function () {
5 var dropdown = $('#selectBox'); 10 var dropdown = $('#selectBox');
...@@ -48,6 +53,8 @@ function count() { ...@@ -48,6 +53,8 @@ function count() {
48 return a[0] - b[0]; 53 return a[0] - b[0];
49 }; 54 };
50 $('#lottotable').html(""); //초기화 55 $('#lottotable').html(""); //초기화
56 + $('#accumulate_table').html(""); //초기화
57 + $('#recom_table').html("");
51 var win1 = 0; 58 var win1 = 0;
52 var win2 = 0; 59 var win2 = 0;
53 var win3 = 0; 60 var win3 = 0;
...@@ -87,7 +94,7 @@ function count() { ...@@ -87,7 +94,7 @@ function count() {
87 } 94 }
88 } 95 }
89 roll(dice(1, 45, 0)); 96 roll(dice(1, 45, 0));
90 - 97 +
91 // console.log("No." + (list_length) + ": " + val); 98 // console.log("No." + (list_length) + ": " + val);
92 for (m = 0; m < 6; m++) { 99 for (m = 0; m < 6; m++) {
93 if (val[j][0] == data.nums[m]) { 100 if (val[j][0] == data.nums[m]) {
...@@ -100,7 +107,7 @@ function count() { ...@@ -100,7 +107,7 @@ function count() {
100 val[j][1] = 2; 107 val[j][1] = 2;
101 match_b = 1; 108 match_b = 1;
102 } 109 }
103 - } 110 + }
104 // console.log("before sort: "+val); 111 // console.log("before sort: "+val);
105 val.sort(numberSort); 112 val.sort(numberSort);
106 // console.log("after sort: "+val); 113 // console.log("after sort: "+val);
...@@ -131,7 +138,19 @@ function count() { ...@@ -131,7 +138,19 @@ function count() {
131 list += '<div class="output ' + num_class + '">' + val[j][0] + '</div>'; 138 list += '<div class="output ' + num_class + '">' + val[j][0] + '</div>';
132 // console.log(match); 139 // console.log(match);
133 } 140 }
134 - var win_class; 141 +
142 +
143 +
144 + acum_list[val[0][0]-1]+=1;
145 + acum_list[val[1][0]-1]+=1;
146 + acum_list[val[2][0]-1]+=1;
147 + acum_list[val[3][0]-1]+=1;
148 + acum_list[val[4][0]-1]+=1;
149 + acum_list[val[5][0]-1]+=1;
150 +
151 +
152 +
153 + var win_class;
135 if (match == 6) { 154 if (match == 6) {
136 win_class = 'win win1'; 155 win_class = 'win win1';
137 win1++; 156 win1++;
...@@ -167,9 +186,9 @@ function count() { ...@@ -167,9 +186,9 @@ function count() {
167 if (--i) engine(i); 186 if (--i) engine(i);
168 }, 0) 187 }, 0)
169 })($('#inputnum').val()); 188 })($('#inputnum').val());
170 -
171 var totalmatch = (win1 + win2 + win3 + win4 + win5) 189 var totalmatch = (win1 + win2 + win3 + win4 + win5)
172 var totalbuy = $('#inputnum').val(); 190 var totalbuy = $('#inputnum').val();
191 +
173 } 192 }
174 193
175 function loadlot(a) { 194 function loadlot(a) {
...@@ -195,3 +214,94 @@ function loadlot(a) { ...@@ -195,3 +214,94 @@ function loadlot(a) {
195 214
196 data = a; 215 data = a;
197 } 216 }
217 +
218 +function accumulate_number() {
219 +/*
220 + for(i=0;i<45;i++){
221 + <-document.write((i+1)+"번 : "+acum_list[i]+"<br>");
222 + }
223 + */
224 + var temp= JSON.parse(JSON.stringify( acum_list ));
225 + var out_temp= JSON.parse(JSON.stringify( acum_list ));
226 +
227 + temp.sort(function(a,b){return a-b});
228 +
229 + var recom_number = new Array();
230 +
231 + $('#recom_table').append('<section id="recom_section" class="shadow"></scetion>');
232 +
233 + for(i=44;i>=0;i--) {
234 + for(j=0;j<45;j++){
235 + if(temp[i]==out_temp[j]){
236 + if(j<9)
237 + $('#recom_section').append('<div class="output c1">'+(j+1)+'</div>'+'<progress value="' + temp[i] + '" max="' + (temp[44]+20)+ '"></progress>'+' '+temp[i]);
238 + else if(j<19)
239 + $('#recom_section').append('<div class="output c2">'+(j+1)+'</div>'+'<progress value="' + temp[i] + '" max="' + (temp[44]+20)+ '"></progress>'+' '+temp[i]);
240 + else if(j<29)
241 + $('#recom_section').append('<div class="output c3">'+(j+1)+'</div>'+'<progress value="' + temp[i] + '" max="' + (temp[44]+20)+ '"></progress>'+' '+temp[i]);
242 + else if(j<39)
243 + $('#recom_section').append('<div class="output c4">'+(j+1)+'</div>'+'<progress value="' + temp[i] + '" max="' + (temp[44]+20)+ '"></progress>'+' '+temp[i]);
244 + else
245 + $('#recom_section').append('<div class="output c5">'+(j+1)+'</div>'+'<progress value="' + temp[i] + '" max="' + (temp[44]+20)+ '"></progress>'+' '+temp[i]);
246 + out_temp[j]=null;
247 + if(i>38){
248 + recom_number[44-i]=j+1;
249 + }
250 + break;
251 + }
252 + }
253 + }
254 +
255 + recom_number.sort(function(a,b){return a-b});
256 +
257 +
258 +
259 +
260 + var numberSort = function(a, b) {
261 + return a[0] - b[0];
262 + };
263 +
264 +
265 +
266 +
267 +
268 + $('#lottotable').html(""); //초기화
269 + $('#accumulate_table').html(""); //초기화
270 +
271 + var list = "";
272 +
273 + var num_class= "c2 ";
274 + list += '<div class="output ' + num_class + '">' + "3" + '</div>';
275 +
276 + $('#accumulate_table').append('<section id="accumulate_section" class="shadow"></scetion>');
277 +
278 + $("#accumulate_section").append('추천 로또 번호(누적 상위 6개)'+'</font>'+'<br>'+'<br>');
279 +
280 + for (i = 0; i < 6; i++) {
281 + if (recom_number[i] <= 10) {
282 + $('#accumulate_section').append('<div class="output c1">'+recom_number[i]+'</div>');
283 + } else if (recom_number[i] <= 20) {
284 + $('#accumulate_section').append('<div class="output c2">'+recom_number[i]+'</div>');
285 + } else if (recom_number[i] <= 30) {
286 + $('#accumulate_section').append('<div class="output c3">'+recom_number[i]+'</div>');
287 + } else if (recom_number[i] <= 40) {
288 + $('#accumulate_section').append('<div class="output c4">'+recom_number[i]+'</div>');
289 + } else {
290 + $('#accumulate_section').append('<div class="output c5">'+recom_number[i]+'</div>');
291 + }
292 + }
293 +
294 +
295 +}
296 +
297 +function resets() {
298 + $('#lottotable').html(""); //초기화
299 + $('#accumulate_table').html(""); //초기화
300 + $('#recom_table').html("");
301 + $('#stats').html("");
302 +
303 + for (i=0;i<45;i++){
304 + acum_list[i]=0;
305 + }
306 +
307 +}
...\ No newline at end of file ...\ No newline at end of file
......