Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김한준
/
OSS-Term-Project
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김한준
2019-06-06 19:49:45 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
94380eae1c0e3ce6a9ccbfa67cb45d9a54917907
94380eae
1 parent
134d07d4
API 사용 안하도록 기능 수정
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
231 additions
and
75 deletions
js/main.js
js/main.js
View file @
94380ea
var
data
;
var
acum_list
=
new
Array
();
// 번호별 누적횟수를 구하기 위한 배열
for
(
i
=
0
;
i
<
45
;
i
++
){
acum_list
[
i
]
=
0
;
}
//회차별 당첨번호를 가지고 오기 위하여 테이블을 만들고 data를 가지고 오기 위해 주소를 변경하는 함수
$
(
document
).
ready
(
function
()
{
var
dropdown
=
$
(
'#selectBox'
);
var
form
=
$
(
'#form'
);
var
result
=
$
(
'#result'
);
var
a2
=
$
(
'#a1'
);
for
(
i
=
1
;
i
<
862
;
i
++
)
{
var
option
=
$
(
'<option>'
);
option
.
val
(
i
).
text
(
i
+
'회차'
);
dropdown
.
append
(
option
);
}
form
.
on
(
'submit'
,
function
(
event
)
{
event
.
preventDefault
();
if
(
!
dropdown
.
val
())
{
alert
(
'뭔가 선택을 하세요.'
);
dropdown
.
focus
();
}
else
{
//회차별로 api에서 당첨번호를 끌어오기 위한 문자열 주소 조합
document
.
getElementById
(
"lotto_api_src"
).
src
=
"http://lotto.kaisyu.com/api?method=get&gno="
+
dropdown
.
val
()
+
";callback=loadlot"
;
//api에서 data를 끌어올때 최초 1회만 끌어올수 있는 문제를 해결하기 위한 방안
var
lotto_parent
=
document
.
getElementById
(
"lotto_api_data"
);
var
lotto_child
=
document
.
getElementById
(
"lotto_api_src"
);
lotto_child
.
remove
();
child_node
=
document
.
createElement
(
'script'
);
child_node
.
id
=
"lotto_api_src"
;
lotto_parent
.
append
(
child_node
);
}
});
});
//로또 번호 생성
function
dice
(
n
,
s
,
b
)
{
...
...
@@ -52,13 +11,12 @@ function dice(n, s, b) {
//로또 번호를 생성하고 번호별로 style을 주며 당첨등을 총괄하기 위한 함수
function
count
()
{
// console.log($('#inputnum').val());
var
numberSort
=
function
(
a
,
b
)
{
return
a
[
0
]
-
b
[
0
];
};
$
(
'#lottotable'
).
html
(
""
);
//초기화
$
(
'#accumulate_table'
).
html
(
""
);
//초기화
$
(
'#recom_table'
).
html
(
""
);
resets2
();
var
win1
=
0
;
var
win2
=
0
;
var
win3
=
0
;
...
...
@@ -101,13 +59,13 @@ function count() {
// console.log("No." + (list_length) + ": " + val);
for
(
m
=
0
;
m
<
6
;
m
++
)
{
if
(
val
[
j
][
0
]
==
data
.
nums
[
m
])
{
if
(
val
[
j
][
0
]
==
data
[
m
])
{
val
[
j
][
1
]
=
1
;
match
++
;
}
}
// console.log("No." + (list_length) + ": " + val);
if
(
val
[
j
][
0
]
==
data
.
bnum
)
{
if
(
val
[
j
][
0
]
==
data
[
6
]
)
{
val
[
j
][
1
]
=
2
;
match_b
=
1
;
}
...
...
@@ -197,36 +155,33 @@ function count() {
}
//api로부터 당첨 data를 끌어오기 위한 함수
function
loadlot
(
a
)
{
$
(
"#lottok"
).
html
(
'제 '
+
a
.
gno
+
'회차 당첨 결과('
+
a
.
gdate
+
')'
);
// + '<br/>' +
function
loadlot
(
num
)
{
$
(
"#lottok"
).
html
(
'제 '
+
(
861
-
num
+
1
)
+
'회차 당첨 결과('
+
lotto_num
[
num
-
1
][
7
]
+
')'
);
// + '<br/>' +
//a.nums + a.bnum;
a
.
nums
[
6
]
=
a
.
bnum
;
for
(
i
=
0
;
i
<
7
;
i
++
)
{
$
(
'#output'
+
i
).
text
(
a
.
nums
[
i
]);
$
(
'#output'
+
i
).
text
(
lotto_num
[
num
-
1
]
[
i
]);
}
for
(
i
=
0
;
i
<
7
;
i
++
)
{
if
(
a
.
nums
[
i
]
<=
10
)
{
$
(
'#output'
+
i
).
addClass
(
"c1"
);
}
else
if
(
a
.
nums
[
i
]
<=
20
)
{
$
(
'#output'
+
i
).
addClass
(
"c2"
);
}
else
if
(
a
.
nums
[
i
]
<=
30
)
{
$
(
'#output'
+
i
).
addClass
(
"c3"
);
}
else
if
(
a
.
nums
[
i
]
<=
40
)
{
$
(
'#output'
+
i
).
addClass
(
"c4"
);
if
(
lotto_num
[
num
-
1
]
[
i
]
<=
10
)
{
$
(
'#output'
+
i
).
addClass
(
"
output
c1"
);
}
else
if
(
lotto_num
[
num
-
1
]
[
i
]
<=
20
)
{
$
(
'#output'
+
i
).
addClass
(
"
output
c2"
);
}
else
if
(
lotto_num
[
num
-
1
]
[
i
]
<=
30
)
{
$
(
'#output'
+
i
).
addClass
(
"
output
c3"
);
}
else
if
(
lotto_num
[
num
-
1
]
[
i
]
<=
40
)
{
$
(
'#output'
+
i
).
addClass
(
"
output
c4"
);
}
else
{
$
(
'#output'
+
i
).
addClass
(
"c5"
);
$
(
'#output'
+
i
).
addClass
(
"
output
c5"
);
}
}
data
=
a
;
data
=
lotto_num
[
num
-
1
];
}
//생성한 번호별 누적횟수와 추천번호를 위한 함수
function
accumulate_number
()
{
$
(
'#lottotable'
).
html
(
""
);
//초기화
$
(
'#accumulate_table'
).
html
(
""
);
//초기화
$
(
'#recom_table'
).
html
(
""
);
//초기화
resets2
();
var
temp
=
JSON
.
parse
(
JSON
.
stringify
(
acum_list
));
var
out_temp
=
JSON
.
parse
(
JSON
.
stringify
(
acum_list
));
...
...
@@ -264,11 +219,6 @@ function accumulate_number() {
var
numberSort
=
function
(
a
,
b
)
{
return
a
[
0
]
-
b
[
0
];
};
...
...
@@ -300,13 +250,219 @@ function accumulate_number() {
//현재 보이는 화면을 초기화함과 동시에 누적번호 또한 초기화 하기 위한 함수
function
resets
()
{
$
(
'#lottotable'
).
html
(
""
);
//초기화
$
(
'#accumulate_table'
).
html
(
""
);
//초기화
$
(
'#recom_table'
).
html
(
""
);
//초기화
$
(
'#stats'
).
html
(
""
);
//초기화
resets2
();
for
(
i
=
0
;
i
<
45
;
i
++
){
acum_list
[
i
]
=
0
;
}
}
function
resets2
()
{
$
(
'#lottotable'
).
html
(
""
);
$
(
'#accumulate_table'
).
html
(
""
);
$
(
'#recom_table'
).
html
(
""
);
$
(
'#stats'
).
html
(
""
);
$
(
'#patten_table'
).
html
(
""
);
$
(
'#patten_recom_table'
).
html
(
""
);
$
(
'#chart_div_1'
).
html
(
""
);
$
(
'#chart_div_2'
).
html
(
""
);
$
(
'#chart_div_3'
).
html
(
""
);
$
(
'#chart_div_4'
).
html
(
""
);
}
function
patten
()
{
resets2
()
var
temp
=
JSON
.
parse
(
JSON
.
stringify
(
nujuk
));
var
out_temp
=
JSON
.
parse
(
JSON
.
stringify
(
nujuk
));
temp
.
sort
(
function
(
a
,
b
){
return
a
-
b
});
$
(
'#patten_table'
).
append
(
'<section id="patten_section" class="shadow"></scetion>'
);
for
(
i
=
44
;
i
>=
0
;
i
--
)
{
for
(
j
=
0
;
j
<
45
;
j
++
){
if
(
temp
[
i
]
==
out_temp
[
j
]){
if
(
j
<
9
)
$
(
'#patten_section'
).
append
(
'<div class="output c1">'
+
(
j
+
1
)
+
'</div>'
+
'<progress value="'
+
temp
[
i
]
+
'" max="'
+
(
temp
[
44
]
+
20
)
+
'"></progress>'
+
' '
+
temp
[
i
]);
else
if
(
j
<
19
)
$
(
'#patten_section'
).
append
(
'<div class="output c2">'
+
(
j
+
1
)
+
'</div>'
+
'<progress value="'
+
temp
[
i
]
+
'" max="'
+
(
temp
[
44
]
+
20
)
+
'"></progress>'
+
' '
+
temp
[
i
]);
else
if
(
j
<
29
)
$
(
'#patten_section'
).
append
(
'<div class="output c3">'
+
(
j
+
1
)
+
'</div>'
+
'<progress value="'
+
temp
[
i
]
+
'" max="'
+
(
temp
[
44
]
+
20
)
+
'"></progress>'
+
' '
+
temp
[
i
]);
else
if
(
j
<
39
)
$
(
'#patten_section'
).
append
(
'<div class="output c4">'
+
(
j
+
1
)
+
'</div>'
+
'<progress value="'
+
temp
[
i
]
+
'" max="'
+
(
temp
[
44
]
+
20
)
+
'"></progress>'
+
' '
+
temp
[
i
]);
else
$
(
'#patten_section'
).
append
(
'<div class="output c5">'
+
(
j
+
1
)
+
'</div>'
+
'<progress value="'
+
temp
[
i
]
+
'" max="'
+
(
temp
[
44
]
+
20
)
+
'"></progress>'
+
' '
+
temp
[
i
]);
out_temp
[
j
]
=
null
;
break
;
}
}
}
}
function
graph_accum
()
{
resets2
();
var
data
=
google
.
visualization
.
arrayToDataTable
([
[
'패턴요소'
,
'수치'
],
[
'홀0:짝6'
,
9
],
[
'홀1:짝5'
,
58
],
[
'홀2:짝4'
,
192
],
[
'홀3:짝3'
,
299
],
[
'홀4:짝2'
,
223
],
[
'홀5:짝1'
,
65
],
[
'홀0:짝6'
,
15
]
]);
var
options
=
{
title
:
'역대 홀수 짝수 비율'
,
vAxis
:
{
title
:
'출현횟수'
},
hAxis
:
{
title
:
'1회~861회'
},
seriesType
:
'bars'
,
series
:
{
5
:
{
type
:
'line'
}},
backgroundColor
:
'ivory'
};
var
data2
=
google
.
visualization
.
arrayToDataTable
([
[
'패턴요소'
,
'수치'
],
[
'저0:고6'
,
9
],
[
'저1:고5'
,
79
],
[
'저2:고4'
,
216
],
[
'저3:고3'
,
287
],
[
'저4:고2'
,
193
],
[
'저5:고1'
,
64
],
[
'저0:고6'
,
13
]
]);
var
options2
=
{
title
:
'역대 저&고 비율'
,
vAxis
:
{
title
:
'출현횟수'
},
hAxis
:
{
title
:
'1회~861회'
},
seriesType
:
'bars'
,
series
:
{
5
:
{
type
:
'line'
}},
backgroundColor
:
'ivory'
};
var
data3
=
google
.
visualization
.
arrayToDataTable
([
[
'패턴요소'
,
'수치'
],
[
'0개'
,
63
],
[
'1개'
,
234
],
[
'2개'
,
289
],
[
'3개'
,
212
],
[
'4개'
,
53
],
[
'5개'
,
8
],
[
'6개'
,
2
]
]);
var
options3
=
{
title
:
'역대 3의 배수 비율'
,
vAxis
:
{
title
:
'출현횟수'
},
hAxis
:
{
title
:
'1회~861회'
},
seriesType
:
'bars'
,
series
:
{
5
:
{
type
:
'line'
}},
backgroundColor
:
'ivory'
};
var
data4
=
google
.
visualization
.
arrayToDataTable
([
[
'패턴요소'
,
'수치'
],
[
'0~100'
,
106
],
[
'101~120'
,
140
],
[
'121~140'
,
214
],
[
'141~160'
,
180
],
[
'161~180'
,
151
],
[
'181~260'
,
70
]
]);
var
options4
=
{
title
:
'역대 번호 총합 비율'
,
vAxis
:
{
title
:
'출현횟수'
},
hAxis
:
{
title
:
'1회~861회'
},
seriesType
:
'bars'
,
series
:
{
5
:
{
type
:
'line'
}},
backgroundColor
:
'ivory'
};
while
(
true
){
var
val2
=
[
0
,
0
,
0
,
0
,
0
,
0
];
for
(
j
=
0
;
j
<
6
;
j
++
)
{
function
roll
(
n
)
{
if
(
j
==
0
)
{
val2
[
j
]
=
n
;
}
else
{
for
(
l
=
0
;
l
<
j
;
l
++
)
{
// console.log(n);
if
(
n
==
val2
[
l
])
{
roll
(
dice
(
1
,
45
,
0
));
}
else
{
val2
[
j
]
=
n
;
}
}
}
}
roll
(
dice
(
1
,
45
,
0
));
}
val2
.
sort
(
function
(
a
,
b
){
return
a
-
b
});
var
check_goju
=
0
;
var
check_sum
=
0
;
var
check_holjjak
=
0
;
var
check_three_mul
=
0
;
for
(
i
=
0
;
i
<
6
;
i
++
){
check_sum
+=
val2
[
i
];
if
(
val2
[
i
]
>
22
)
check_goju
+=
1
;
if
(
val2
[
i
]
%
2
==
0
)
check_holjjak
+=
1
;
if
(
val2
[
i
]
%
3
==
0
)
check_three_mul
+=
1
;
}
if
((
check_sum
<=
160
&&
check_sum
>=
121
)
&&
(
check_goju
==
3
||
check_goju
==
4
)
&&
(
check_holjjak
==
2
||
check_holjjak
==
3
)
&&
(
check_three_mul
==
1
||
check_three_mul
==
2
))
break
;
}
$
(
'#patten_recom_table'
).
append
(
'<section id="patten_recom_section" class="shadow"></scetion>'
);
$
(
"#patten_recom_section"
).
append
(
'추천 로또 번호(패턴 분석)'
+
'</font>'
+
'<br>'
+
'<br>'
);
for
(
i
=
0
;
i
<
6
;
i
++
)
{
if
(
val2
[
i
]
<=
10
)
{
$
(
'#patten_recom_section'
).
append
(
'<div class="output c1">'
+
val2
[
i
]
+
'</div>'
);
}
else
if
(
val2
[
i
]
<=
20
)
{
$
(
'#patten_recom_section'
).
append
(
'<div class="output c2">'
+
val2
[
i
]
+
'</div>'
);
}
else
if
(
val2
[
i
]
<=
30
)
{
$
(
'#patten_recom_section'
).
append
(
'<div class="output c3">'
+
val2
[
i
]
+
'</div>'
);
}
else
if
(
val2
[
i
]
<=
40
)
{
$
(
'#patten_recom_section'
).
append
(
'<div class="output c4">'
+
val2
[
i
]
+
'</div>'
);
}
else
{
$
(
'#patten_recom_section'
).
append
(
'<div class="output c5">'
+
val2
[
i
]
+
'</div>'
);
}
}
var
chart
=
new
google
.
visualization
.
ComboChart
(
document
.
getElementById
(
'chart_div_1'
));
chart
.
draw
(
data
,
options
);
var
chart
=
new
google
.
visualization
.
ComboChart
(
document
.
getElementById
(
'chart_div_2'
));
chart
.
draw
(
data2
,
options2
);
var
chart
=
new
google
.
visualization
.
ComboChart
(
document
.
getElementById
(
'chart_div_3'
));
chart
.
draw
(
data3
,
options3
);
var
chart
=
new
google
.
visualization
.
ComboChart
(
document
.
getElementById
(
'chart_div_4'
));
chart
.
draw
(
data4
,
options4
);
}
...
...
Please
register
or
login
to post a comment