정주희

Rearrange Files

# 적중률 99% 야구 결과 시뮬레이터
원하는 팀과 선수로 여러분만의 경기를 만들고 그 결과를 확인하세요!
## About the project
저희는 여러분에게 다양한 기능을 제공합니다. 한국의 프로야구 팀 중 두 팀을 사용자가 선택하고, 투수와 타자를 포함한 모든 선수를 사용자가 선출하여 팀을 구성할 수 있습니다. 이렇게 두 팀을 구성하게 되면 어느 팀이 이길지, 승률은 얼마인지에 대한 결과를 제공합니다!
추가적으로, 각 팀의 경기 일정과 경기 관련 영상을 확인하실 수 있습니다!
### Built with
+ HTML
+ CSS
+ Javascript
+ Express
+ pm2
+ AWS EC2
+ AWS Route 53
## Getting Started
+ https://2020105636.oss-2021.tk:23023/ 도메인 접속으로 바로 이용 가능합니다.
### 로컬 서버를 이용하여 구동하는 방법
(1) 원하는 디렉토리에서 git bash를 열어 다음 코드를 이용하여 clone을 진행합니다.
$ git clone http://khuhub.khu.ac.kr/2021-1-open-source/BaseBallSimulator.git
(2) ./BaseBallSimulator/의 위치로 이동한 후 다음 코드를 이용하여 필요한 요소들을 설치합니다.
$ npm install
(3) 다음의 코드를 입력하여 로컬 서버를 구동합니다.
$ node server.js
(4) localhost:8080 에 접속하시면 시뮬레이터를 이용하실 수 있습니다.
## Usage
+ Home 화면에서는 팀 순위와 경기 일정, 그리고 경기 기록이 우수한 선수들과 경기 관련 영상을 확인할 수 있습니다.
+ Introduction 화면
+ Calendar 화면에서는 각 팀의 로고를 클릭하면 해당 팀의 시즌 경기 일정을 확인할 수 있습니다.
+ Simulation 화면
1) 원정 팀과 홈 팀을 선택하고 각 팀의 1~9번 타자와 선발 투수를 선택합니다.
2) 시뮬레이션 버튼을 클릭하면 각 이닝별 베이스 상태와 아웃카운트, 스코어 등이 출력되며, 이를 기반으로 예측된 최종 스코어로 승리 팀과 패배 팀을 도출하여 출력합니다.
3)
## RoadMap
## Contributor
+ 김건우(2020105583) : 정보 수집 및 전반적인 알고리즘 구축, Javascript
+ 오진혁(2020105636) : 정보 수집 및 서버 구축, Nodejs
+ 정주희(2020105660) : 프론트 및 알고리즘 적용, HTML, CSS, Javascript
\ No newline at end of file
'적중률 99%' 야구 결과 시뮬레이션
프로젝트 참여자 : 김건우(2020105583), 오진혁(2020105636), 정주희(2020105660)
프로젝트 소개 : {
목적 : 야구 경기 시뮬레이션과 경기 일정 등을 종합적으로 제공하는 서비스
구현 계획 : [
1. node.js or js로 크롤링하여 순위, 일정 등을 불러들여 제공(미완) -> 임시 사진 대체. 링크만 걸어놓음
2. 구현 서비스, 과정을 담은 영상을 home에 연결(미완) -> 야구 경기 하이라이트로 대체.
3. 전반적인 4개의 site(main, introduction, calendar, simulation) 구축
-> main은 위 1, 2번 문제에 해당됨.
-> introduction은 readme.md 완성 시 update할 예정.
-> simulation은 구단 클릭 시 선수 list를 불러와 원하는 구단과 선수 명단을 짜고, 이를 바탕으로 시뮬레이션 하도록 프로그래밍 요망.
현재는 임시로 KIA(원정)VS두산(홈)의 구도와 9명의 짜여진 라인업, 1명의 투수로 시뮬레이션 진행하도록 설계함.
오류 발생하는 대로 수정하여 update&commit 예정.
]
}
알고리즘 소개 : {
업데이트 예정 ...
참고사항 : 기계학습, 딥러닝 사용하지 않아 99% 적중하기는 힘들다.
}
역할 분담 : {
김건우 : 전반적인 알고리즘 구축(with javascript), calendar 사진 및 기본 틀 구축, 정보 업데이트,
오진혁 : 서버 구축 담당(with node.js), main 기본 틀 구축, shuffle 알고리즘 구축, 정보 업데이트,
정주희 : 전반적인 프론트엔드(with html, css, javascript), 알고리즘 수정 및 적용
}
\ No newline at end of file
......
......@@ -25,10 +25,10 @@
</ul>
</nav>
<div class="container2">
<a href="https://sports.news.naver.com/kbaseball/record/index.nhn?category=kbo&year=2021"><img src="pngs/rank.jpg" style="display:block; margin:0 auto; width:600px; height:400px;"></a>
<a href="https://sports.news.naver.com/kbaseball/record/index.nhn?category=kbo&year=2021"><img src="pngs/rank.JPG" style="display:block; margin:0 auto; width:600px; height:400px;"></a>
</div>
<div class="container3">
<a href="https://sports.news.naver.com/kbaseball/schedule/index.nhn"><img src="pngs/today.jpg" style="display:block; margin:0 auto; width:655px; height:150px;"></a>
<a href="https://sports.news.naver.com/kbaseball/schedule/index.nhn"><img src="pngs/today.JPG" style="display:block; margin:0 auto; width:655px; height:150px;"></a>
</div>
<div class="container4">
<img src="pngs/1.jpg" style="display:block; margin:0 auto; width:200px; height:100px;">
......
var dusan_hitter = [
['선수명', 'AVG', 'H', '2B', '3B', 'HR'],
['박건우', 0.356, 47, 9, 0, 2],
['허경민', 0.345, 49, 6, 0, 3],
['페르난데스', 0.336, 48, 5, 0, 6],
['최용제', 0.308, 8, 2, 0, 0],
['안재석', 0.304, 14, 1, 2, 0],
['김인태', 0.298, 25, 3, 0, 1],
['김재환', 0.285, 37, 4, 1, 9],
['장승현', 0.284, 23, 1, 0, 1],
['조수행', 0.278, 10, 1, 1, 0],
['양석환', 0.277, 38, 8, 0, 5],
['박계범', 0.266, 21, 5, 0, 2],
['김재호', 0.243, 18, 1, 0, 1],
['오재원', 0.22, 11, 2, 0, 0],
['강승호', 0.212, 7, 0, 0, 2],
['권민석', 0.167, 2, 1, 0, 0],
['박세혁', 0.161, 5, 0, 0, 0],
['안권수', 0.133, 2, 0, 0, 0],
['정수빈', 0.125, 4, 1, 0, 0]
['김재환',0.268,48,4,1,13],
['박건우',0.340,52,10,0,2],
['페르난데스',0.333,66,7,0,8],
['허경민',0.330,63,9,0,4],
['양석환',0.269,52,10,0,12],
['김인태',0.267,36,5,1,4],
['안재석',0.316,25,4,2,0],
['최용제',0.311,14,3,0,0],
['조수행',0.277,13,1,1,0],
['장승현',0.248,27,3,0,2],
['김재호',0.262,28,5,0,1],
['박계범',0.266,21,5,0,2],
['강승호',0.247,19,2,1,2],
['정수빈',0.226,14,2,1,0],
['박세혁',0.182,6,0,0,0],
['오재원',0.175,11,2,0,0],
]
var dusan_pitcher = [
......@@ -29,57 +27,67 @@ var dusan_pitcher = [
['곽빈', 16.7, 0.256],
['유희관', 7.6, 0.409],
['조제영', 16.7, 0.367],
['이영하', 12.8, 0.388],
['이영하', 16.0, 0.393],
]
var hanhwa_hitter = [
['선수명', 'AVG', 'H', '2B', '3B', 'HR'],
['하주석', 0.299, 40, 7, 1, 3],
['장운호', 0.291, 30, 6, 0, 0],
['노시환', 0.279, 38, 7, 0, 7],
['정은원', 0.277, 36, 7, 2, 0],
['힐리', 0.258, 32, 6, 1, 2],
['정진호', 0.254, 15, 3, 0, 0],
['최재훈', 0.247, 20, 1, 0, 2],
['김민하', 0.246, 14, 4, 0, 1],
['노수광', 0.238, 10, 1, 0, 0],
['이해창', 0.231, 9, 3, 0, 0],
['이성열', 0.207, 12, 3, 0, 1],
['박정현', 0.196, 19, 3, 0, 0],
['유장혁', 0.169, 14, 5, 0, 1],
['임종찬', 0.163, 16, 5, 0, 1],
['정은원',0.284,54,10,4,1],
['노시환',0.266,49,8,0,11],
['하주석',0.283,53,10,1,4],
['조한민',0.308,8,1,2,2],
['최재훈',0.216,27,3,0,2],
['김민하',0.240,18,4,0,1],
['장운호',0.273,35,8,0,0],
['노수광',0.217,15,1,0,1],
['강상원',0.167,3,0,0,0],
['강경학',0.136,3,0,0,0],
['이해창',0.231,9,3,0,0],
['허관회',0.161,5,0,0,0],
['이성열',0.203,16,4,0,1],
['힐리',0.258,46,8,1,4],
['정진호',0.216,16,3,0,0],
['박정현',0.196,21,4,0,0],
['유장혁',0.143,14,5,0,1],
['임종찬',0.155,16,5,0,1],
]
var hanhwa_pitcher = [
['선수명', '볼넷%', '피안타율'],
['킹험', 6.4, 0.211],
['카펜터', 11.6, 0.201],
['김민우', 10.9, 0.217],
['강재민', 9.9, 0.143],
['김범수', 14.3, 0.265],
['장시환', 14.9, 0.311],
['정우람', 13.8, 0.244],
['윤대경', 15.3, 0.222],
['카펜터', 11.7, 0.209],
['김민우', 11.2, 0.208],
['김범수', 13.9, 0.284],
['장시환', 15.8, 0.306],
['윤대경', 15.0, 0.208],
['김기중', 5.6, 0.353],
['김이환', 16.7, 0.283],
['윤호솔', 10.8, 0.222],
['배동현', 12.5, 0.244],
['박주홍', 50.0, 0.250],
['이승관', 39.1, 0.538],
['배동현', 15.4, 0.252],
]
var kia_hitter = [
['선수명', 'AVG', 'H', '2B', '3B', 'HR'],
['김태진', 0.349, 22, 2, 1, 0],
['최원준', 0.342, 54, 2, 4, 0],
['이정훈', 0.293, 12, 2, 0, 1],
['김선빈', 0.292, 40, 8, 0, 0],
['터커', 0.265, 40, 9, 1, 2],
['김민식', 0.261, 18, 2, 0, 2],
['류지혁', 0.259, 21, 3, 0, 0],
['한승택', 0.259, 15, 3, 0, 0],
['이창진', 0.254, 18, 5, 0, 0],
['박찬호', 0.237, 28, 5, 2, 0],
['최형우', 0.2, 18, 0, 0, 4],
['나지완', 0.184, 9, 1, 0, 0],
['김호령', 0.163, 7, 2, 0, 1],
['최원준',0.324,71,5,5,1],
['김민식',0.247,22,3,0,2],
['김선빈',0.281,52,10,0,0],
['이정훈',0.298,25,5,0,2],
['김태진',0.336,41,3,1,0],
['터커',0.269,56,11,1,3],
['이진영',0.188,6,2,0,2],
['한승택',0.238,19,3,0,0],
['김호령',0.163,7,2,0,1],
['류지혁',0.259,21,3,0,0],
['김규성',0.133,2,1,0,0],
['이창진',0.218,22,5,0,0],
['나지완',0.184,9,1,0,0],
['박찬호',0.241,42,6,2,0],
['이우성',0.194,6,1,0,0],
['유민상',0.143,3,1,0,0],
['최형우',0.195,22,1,0,5],
['황대인',0.259,15,2,0,2],
['나주환',0.172,5,0,0,0],
]
var kia_pitcher = [
......@@ -92,29 +100,32 @@ var kia_pitcher = [
['이민우', 7.9, 0.346],
['남재현', 27.8, 0.208],
['김유신', 16.2, 0.269],
['차명진', 8.0, 0.273],
]
var kiwoom_hitter = [
['선수명', 'AVG', 'H', '2B', '3B', 'HR'],
['이정후', 0.367, 55, 14, 3, 1],
['서건창', 0.31, 40, 8, 0, 1],
['이지영', 0.304, 17, 2, 1, 0],
['박동원', 0.281, 25, 5, 0, 7],
['김혜성', 0.268, 41, 7, 1, 3],
['이용규', 0.258, 32, 2, 4, 0],
['김웅빈', 0.256, 32, 8, 0, 3],
['프레이타스',0.25, 25, 7, 0, 1],
['송우현', 0.248, 28, 5, 1, 1],
['전병우', 0.222, 14, 3, 0, 2],
['김수환', 0.22, 9, 2, 0, 2],
['박병호', 0.212, 22, 5, 0, 5],
['허정협', 0.179, 5, 0, 0, 0],
['신준우', 0.167, 1, 1, 0, 0],
['이정후',0.346,71,21,4,1],
['박동원',0.281,34,7,0,9],
['김혜성',0.283,62,8,1,3],
['서건창',0.266,49,9,0,1],
['김웅빈',0.250,39,10,0,4],
['이용규',0.256,42,4,4,0],
['송우현',0.280,46,11,1,1],
['박병호',0.219,35,8,0,8],
['전병우',0.196,22,6,0,3],
['박준태',0.048,1,1,0,0],
['프레이타스',0.285,35,10,0,2],
['김수환',0.220,9,2,0,2],
['허정협',0.179,5,0,0,0],
['박주홍',0.143,4,2,0,0],
['이지영',0.253,22,2,1,0],
['변상권',0.105,2,0,0,0],
]
var kiwoom_pitcher = [
['선수명', '볼넷%', '피안타율'],
['요키시', 6.6, 0.27],
['요키시', 6.8, 0.252],
['한현희', 8.8, 0.261],
['최원태', 7.7, 0.276],
['안우진', 10.4, 0.269],
......@@ -127,27 +138,29 @@ var kiwoom_pitcher = [
var kt_hitter = [
['선수명', 'AVG', 'H', '2B', '3B', 'HR'],
['강백호', 0.417, 60, 8, 1, 5],
['김병희', 0.389, 7, 2, 0, 2],
['배정대', 0.324, 44, 8, 0, 2],
['황재균', 0.324, 22, 2, 1, 1],
['심우준', 0.315, 34, 6, 1, 2],
['김민혁', 0.306, 19, 0, 2, 0],
['유한준', 0.288, 19, 5, 0, 0],
['알몬테', 0.284, 40, 5, 0, 4],
['조용호', 0.277, 33, 3, 0, 0],
['문상철', 0.258, 16, 6, 0, 2],
['장성우', 0.235, 24, 3, 0, 3],
['신본기', 0.222, 18, 4, 0, 0],
['박경수', 0.203, 15, 5, 0, 4],
['이홍구', 0.184, 7, 0, 0, 1],
['강백호',0.407,81,12,1,7],
['배정대',0.295,57,13,0,3],
['심우준',0.306,49,11,1,3],
['김병희',0.300,12,3,0,3],
['황재균',0.316,31,3,1,1],
['조용호',0.281,47,7,0,0],
['장성우',0.234,36,6,0,6],
['알몬테',0.296,58,9,0,5],
['김민혁',0.302,19,0,2,0],
['유한준',0.280,30,6,0,1],
['권동진',0.182,6,3,0,0],
['송민섭',0.080,2,0,0,0],
['문상철',0.222,16,6,0,2],
['신본기',0.400,18,4,0,0],
['박경수',0.185,22,6,0,5],
['이홍구',0.178,8,0,0,1],
]
var kt_pitcher = [
['선수명', '볼넷%', '피안타율'],
['데스파이네', 11.3, 0.213],
['고영표', 3.9, 0.243],
['배제성', 14.0, 0,224],
['배제성', 13.8, 0.226],
['소형준', 12.3, 0.269],
['김민수', 11.8, 0.299],
['쿠에바스', 12.0, 0.306],
......@@ -156,17 +169,21 @@ var kt_pitcher = [
var lg_hitter = [
['선수명', 'AVG', 'H', '2B', '3B', 'HR'],
['김현수', 0.316, 42, 7, 0, 6],
['홍창기', 0.313, 46, 8, 1, 2],
['채은성', 0.271, 29, 6, 0, 5],
['문보경', 0.267, 12, 4, 0, 1],
['정주현', 0.266, 25, 6, 1, 2],
['라모스', 0.248, 34, 5, 0, 5],
['유강남', 0.241, 27, 4, 0, 3],
['오지환', 0.22, 28, 5, 0, 2],
['이형종', 0.209, 14, 5, 0, 3],
['이천웅', 0.202, 17, 5, 0, 1],
['김민성', 0.192, 23, 8, 0, 2],
['홍창기', 0.316, 60, 8, 1, 3],
['김현수', 0.317, 59, 9, 0, 8],
['채은성', 0.303, 47, 11, 0, 7],
['문보경', 0.275, 19, 7, 0, 2],
['유강남', 0.241, 40, 6, 0, 5],
['오지환', 0.231, 37, 9, 1, 2],
['이형종', 0.222, 22, 6, 0, 4],
['한석현', 0.286, 6, 2, 1, 0],
['라모스', 0.243, 45, 7, 1, 8],
['김재성', 0.188, 6, 1, 1, 1],
['신민재', 0.167, 3, 0, 0, 0],
['정주현', 0.222, 30, 6, 1, 2],
['구본혁', 0.150, 3, 2, 0, 0],
['김민성', 0.207, 34, 9, 0, 3],
['이천웅', 0.211, 27, 6, 0, 2],
]
var lg_pitcher = [
......@@ -175,32 +192,40 @@ var lg_pitcher = [
['정찬헌', 5.6, 0.271],
['켈리', 9.6, 0.228],
['이민호', 11.5, 0.234],
['이우찬', 10.2, 0.264]
['배재준', 6.2, 0.356],
['차우찬', 9.5, 0.211],
['함덕주', 17.2, 0.224],
['김윤식', 17.2, 0.254],
['김윤식', 12.7, 0.254],
['임찬규', 25.8, 0.476],
['이상영', 12.0, 0.258],
['이상영', 11.1, 0.257],
]
var lotte_hitter = [
['선수명', 'AVG', 'H', '2B', '3B', 'HR'],
['이대호', 0.328, 44, 3, 0, 8],
['전준우', 0.316, 43, 8, 0, 2],
['안치홍', 0.299, 43, 8, 1, 3],
['정훈', 0.296, 37, 11, 0, 4],
['마차도', 0.28, 28, 6, 0, 3],
['추재현', 0.278, 10, 2, 0, 0],
['손아섭', 0.255, 40, 3, 0, 0],
['김준태', 0.25, 21, 5, 0, 3],
['오윤석', 0.25, 10, 5, 0, 1],
['한동희', 0.248, 30, 6, 0, 5],
['이병규', 0.235, 8, 0, 0, 0],
['전준우', 0.325, 65, 12, 0, 2],
['정훈', 0.305, 57, 13, 0, 6],
['마차도', 0.272, 43, 9, 0, 4],
['안치홍', 0.310, 54, 11, 2, 3],
['이대호', 0.328, 44, 3, 0, 8],
['한동희', 0.241, 41, 8, 0, 7],
['추재현', 0.318, 28, 6, 0, 3],
['김준태', 0.221, 23, 5, 0, 4],
['김재유', 0.290, 9, 2, 0, 0],
['배성근', 0.270, 10, 1, 0, 0],
['이병규', 0.235, 8, 0, 0, 0],
['지시완', 0.237, 14, 2, 0, 2],
['오윤석', 0.245, 13, 7, 0, 1],
['장두성', 0.214, 6, 2, 0, 0],
['나승엽', 0.268, 11, 1, 0, 0],
['김민수', 0.232, 16, 5, 0, 1],
['강태율', 0.100, 2, 1, 0, 1],
['손아섭', 0.271, 57, 6, 0, 0],
]
var lotte_pitcher = [
['선수명', '볼넷%', '피안타율'],
['스트레일리', 8.7, 0.268],
['스트레일리', 9.3, 0.268],
['박세웅', 8.3, 0.230],
['나균안', 9.4, 0.274],
['프랑코', 11.0, 0.234],
......@@ -212,20 +237,25 @@ var lotte_pitcher = [
var nc_hitter = [
['선수명', 'AVG', 'H', '2B', '3B', 'HR'],
['양의지', 0.361, 44, 10, 1, 9],
['알테어', 0.326, 44, 8, 0, 13],
['박석민', 0.325, 25, 4, 0, 8],
['박민우', 0.303, 27, 1, 1, 1],
['김태군', 0.278, 20, 5, 0, 2],
['나성범', 0.269, 42, 8, 1, 10],
['이명기', 0.266, 29, 6, 0, 1],
['노진혁', 0.265, 30, 3, 0, 4],
['박준영', 0.26, 19, 2, 1, 4],
['강진성', 0.239, 16, 5, 0, 1],
['권희동', 0.233, 20, 3, 0, 5],
['이원재', 0.196, 10, 2, 0, 0],
['지석훈', 0.156, 5, 1, 0, 0],
['도태훈', 0.067, 2, 0, 0, 0],
['양의지', 0.349, 60, 11, 1, 11],
['알테어', 0.303, 56, 10, 0, 14],
['박석민', 0.299, 35, 8, 0, 10],
['나성범', 0.280, 60, 12, 1, 13,]
['노진혁', 0.296, 45, 5, 0, 5],
['이명기', 0.296, 47, 10, 0, 2],
['박민우', 0.287, 41, 5, 1, 1],
['권희동', 0.237, 22, 3, 0, 6],
['김태군', 0.248, 26, 5, 0, 3],
['윤형준', 0.400, 10, 0, 0, 3],
['박준영', 0.238, 24, 2, 1, 5],
['김찬형', 0.364, 8, 1, 0, 0],
['정진기', 0.333, 7, 3, 0, 0],
['전민수', 0.318, 7, 0, 0, 0],
['강진성', 0.234, 26, 7, 0, 1],
['지석훈', 0.147, 5, 1, 0, 0],
['최정원', 0.158, 3, 0, 0, 0],
['도태훈', 0.067, 2, 0, 0, 0],
['이원재', 0.226, 14, 2, 0, 0],
]
var nc_pitcher = [
......@@ -236,26 +266,27 @@ var nc_pitcher = [
['신민혁', 7.8, 0.245],
['강동연', 9.0, 0.271],
['김진호', 42.9, 0.500],
['김영규', 11.5, 0.309],
['김영규', 11.9, 0.312],
['이재학', 24.4, 0.290],
]
var samsung_hitter = [
['선수명', 'AVG', 'H', '2B', '3B', 'HR'],
['김민수', 0.4, 12, 4, 0, 2],
['피렐라', 0.358, 57, 7, 1, 12],
['강민호', 0.35, 41, 7, 0, 5],
['박해민', 0.312, 43, 7, 0, 1],
['구자욱', 0.299, 43, 9, 3, 5],
['오재일', 0.257, 18, 4, 0, 3],
['김지찬', 0.25, 17, 3, 0, 0],
['강한울', 0.247, 21, 2, 0, 0],
['송준석', 0.24, 12, 2, 0, 2],
['이학주', 0.22, 18, 6, 0, 2],
['김헌곤', 0.208, 11, 1, 0, 2],
['이원석', 0.204, 20, 3, 0, 3],
['김상수', 0.191, 25, 2, 1, 0],
['김동엽', 0.125, 4, 0, 0, 0],
['피렐라',0.347,77,10,1,13],
['강민호',0.351,54,8,0,6],
['박해민',0.292,52,8,0,3],
['구자욱',0.287,58,10,4,6],
['오재일',0.295,36,8,0,8],
['김헌곤',0.310,31,2,0,3],
['김민수',0.313,15,4,0,2],
['이원석',0.241,33,8,0,3],
['김지찬',0.259,30,5,0,1],
['이학주',0.220,18,6,0,2],
['김호재',0.222,8,1,0,0],
['송준석',0.235,12,2,0,2],
['강한울',0.231,24,3,0,0],
['김상수',0.206,37,4,1,0],
['김동엽',0.157,8,1,0,0],
]
var samsung_pitcher = [
......@@ -264,27 +295,32 @@ var samsung_pitcher = [
['원태인', 8.6, 0.246],
['라이블리', 9.3, 0.190],
['백정현', 10.5, 0.250],
['최채흥', 14.5, 0.346],
['최채흥', 9.7, 0.346],
['이승민', 10.2, 0.294],
['김윤수', 19.3, 0.348],
['김대우', 8.3, 0.275],
['구준범', 25.0, 0.250],
]
var ssg_hitter = [
['선수명', 'AVG', 'H', '2B', '3B', 'HR'],
['최주환', 0.365, 27, 6, 0, 4],
['최정', 0.309, 38, 6, 0, 10],
['이흥련', 0.295, 13, 0, 0, 0],
['박성한', 0.287, 25, 6, 0, 1],
['김성현', 0.286, 22, 3, 0, 1],
['이재원', 0.277, 26, 7, 0, 2],
['로맥', 0.254, 33, 4, 0, 9],
['한유섬', 0.252, 32, 7, 0, 4],
['김강민', 0.243, 17, 4, 0, 1],
['정의윤', 0.241, 14, 0, 0, 4],
['추신수', 0.228, 29, 1, 0, 8],
['최지훈', 0.195, 15, 2, 1, 1],
['오태곤', 0.193, 11, 2, 0, 2],
['최정',0.293,49,8,0,13],
['추신수',0.263,44,4,1,8],
['로맥',0.253,46,6,0,13],
['박성한',0.297,38,8,0,1],
['최주환',0.304,35,7,0,4],
['최지훈',0.237,32,4,1,3],
['김성현',0.278,27,4,0,2],
['한유섬',0.250,41,9,0,6],
['이흥련',0.281,16,1,0,0],
['이재원',0.258,34,9,0,2],
['정현',0.190,4,2,0,0],
['김강민',0.242,22,5,1,3],
['김찬형',0.174,4,1,0,0],
['오태곤',0.232,19,2,0,4],
['오준혁',0.207,6,1,0,1],
['정의윤',0.224,22,0,0,5],
['고종욱',0.250,13,0,0,0],
]
var ssg_pitcher = [
......@@ -298,5 +334,5 @@ var ssg_pitcher = [
['양선률', 30.0, 0.500],
['정수민', 17.3, 0.284],
['김정빈', 19.4, 0.304],
['이건욱', 28.1, 0.317],
['이건욱', 26.4, 0.333],
]
\ No newline at end of file
......
function add_predict(){
var s="";
s+=("<option value="+10+">"+10+"</option>");
s+=("<option value="+20+">"+20+"</option>");
s+=("<option value="+50+">"+50+"</option>");
s+=("<option value="+70+">"+70+"</option>");
s+=("<option value="+100+">"+100+"</option>");
s+=("<option value="+500+">"+500+"</option>");
s+=("<option value="+1000+">"+1000+"</option>");
s+=("<option value="+5000+">"+5000+"</option>");
s+=("<option value="+10000+">"+10000+"</option>");
s+=("<option value="+50000+">"+50000+"</option>");
s+=("<option value="+100000+">"+100000+"</option>");
document.getElementById('pr').innerHTML=s;
}
function predict(value, hitter_list1, hitter_list2, pitcher1, pitcher2){
var score=[0,0];
var w=0;
var h=0;
var d=0;
for(var i=0; i<value; i++){
score=algorithms(hitter_list1, hitter_list2, pitcher1, pitcher2);
if(score[0]>score[1]){
w++;
}else if(score[0]<score[1]){
h++;
}else{
d++;
}
}
document.getElementById('jstest').innerHTML="예측 결과"+"<br\>"+"TEST "+value+"번"+"<br\><br\>"+"원정팀 승리 횟수 : "+w+"<br\>"
+"홈팀 승리 횟수 : "+h+"<br\>"+"무승부 횟수 : "+d+"<br\><br\>"+"원정팀 승리 확률 : "+w*100/value+"%"+"<br\>"+"홈팀 승리 확률 : "+h*100/value+"%"+"<br\>";
}
function algorithms(hitter_list1, hitter_list2, pitcher1, pitcher2){
var base1 = 0; var base2 = 0; var base3 = 0; //1이면 주자 있고 0이면 비어있는것
var out = 0; var ining = 1; var home_away = 1;//아웃카운트, 이닝, home이면 1이고 away이면 2.
var score1 = 0; var score2 = 0;
var hitter_num1 = 1; var hitter_num2 = 1;
var hit=false;
while(true){
if(ining == 9 && home_away == 2 && score1 < score2){//9회 초 후 home팀이 이기고 있을 때!
break;
}
else if(ining==10 && home_away==1 && score1>score2 && hit==false){//9회 말 후 home팀이 이기고 있을 때!
break;
}
else if(ining>9 && score1 < score2){//9회 말 후 home팀이 이기고 있을 때!
break;
}
else if(ining>=11 && home_away==1 && hit==false && score1>score2){//연장 이후 원정팀이 이기고 있을 때!
break;
}
else if(ining>=10 && home_away==2 && hit==true && score1<score2){//끝내기
break;
}
else if(ining==13 && score1==score2){//무승부
break;
}
if(home_away == 1){
var hitter = hitter_list1[hitter_num1]; //hitter = hitter_list1[hitter_number1%9]
var pitcher = pitcher2; //pitcher = pitcher1
}
else if(home_away == 2){
var hitter = hitter_list2[hitter_num2]; //hitter = hitter_list2[hitter_number2%9]
var pitcher = pitcher1; //pitcher = pitcher2
}
var num = Math.random();
//hitter_number1 = hitter_number(kia); hitter_number2 = hitter_number(dusan);
var one = 0; var two = 0; var three = 0; var homerun = 0;
one = pitcher[2] * (hitter[2] - hitter[3] - hitter[4] - hitter[5])/hitter[2];
two = pitcher[2] * hitter[3]/hitter[2];
three = pitcher[2] * hitter[4]/hitter[2];
homerun = pitcher[2] * hitter[5]/hitter[2];
hit=true;
if(num <= one){ //안타
var num1 = Math.random();
if(num1 <= 0.5){
switch(home_away){
case 1:
score1 = score1 + base3;
break;
case 2:
score2 = score2 + base3;
break;
}
base3 = base2;
base2 = base1;
base1 = 1;
}
else{
switch(home_away){
case 1:
score1 = score1 + base3 + base2;
break;
case 2:
score2 = score2 + base3 + base2;
break;
}
base3 = base1;
base2 = 0;
base1 = 1;
}
}
else if((one < num) && (num <= one + two)){//2루타
var num2 = Math.random();
if(num2 <= 0.4){
switch(home_away){
case 1:
score1 = score1 + base3 + base2;
break;
case 2:
score2 = score2 + base3 + base2;
break;
}
base3 = base1;
base2 = 1;
base1 = 0;
}
else if(0.4 < num2 && num2 <=0.7){
switch(home_away){
case 1:
score1 = score1 + base3 + base2 + base1;
break;
case 2:
score2 = score2 + base3 + base2 + base1;
break;
}
base3 = 0;
base2 = 1;
base1 = 0;
}
else{
switch(home_away){
case 1:
score1 = score1 + base3 + base2;
break;
case 2:
score2 = score2 + base3 + base2;
break;
}
base3 = 0;
base2 = 1;
base1 = 0;
}
}
else if((one + two < num) && (num <= one + two + three)){//3루타
switch(home_away){
case 1:
score1 = score1 + base3 + base2 + base1;
break;
case 2:
score2 = score2 + base3 + base2 + base1;
break;
}
base3 = 1;
base2 = 0;
base1 = 0;
}
else if(one + two + three < num && num <= one + two + three + homerun){//홈런
switch(home_away){
case 1:
score1 = score1 + base3 + base2 + base1 + 1;
break;
case 2:
score2 = score2 + base3 + base2 + base1 + 1;
break;
}
base3 = 0;
base2 = 0;
base1 = 0;
}
else if( pitcher[2] < num && (num <= pitcher[2] +pitcher[1]*0.01)){//볼넷
if(base1==1 && base2==1 && base3==1){//만루 밀어내기 득점 -> 스코어 ++
if(home_away==1){
score1++;
}
else{
score2++;
}
}
else{//스코어 추가되지 않는 경우
if((base2==1 && base1==0 )||(base3==1 && base1==0)||(base2==1&&base3==1&&base1==0)){//2루만 채워져있거나 3루만 채워져있거나 2,3루만 채워져있거나
base1=1;
}
else if(base1==1 && base3==1 && base2==0){//1루 3루 채워져있고 2루 비워져있거나
base2=base1;
base1=1;
}
else{
base3 = base2;
base2 = base1;
base1 = 1;
}
}
}
else{//아웃
out++;
}
if(out >= 3){
switch(home_away){
case 1:
home_away = 2;
hit=false;
break;
case 2:
home_away = 1;
ining++;
hit=false;
break;
}
out=0;
base1=0; base2=0; base3=0;
}
else{
if(home_away == 1){
hitter_num1++;
if(hitter_num1>=10){
hitter_num1=1;
}
}
else if(home_away == 2){
hitter_num2++;
if(hitter_num2>=10){
hitter_num2=1;
}
}
}
}
var score = [score1, score2];
return score;
}
const express = require('express');
const app = express();
app.use(express.static(__dirname));
app.listen(8080, function(){
console.log('listening on 8080');
});
app.get('/', function(req, res){
res.sendFile(__dirname + '/main.html');
app.get('/test', function(req, res){
res.send('test');
});
app.get('/main.html', function(req, res){
app.get('/', function(req, res){
res.sendFile(__dirname + '/main.html');
});
app.get('/introduction.html', function(req, res){
res.sendFile(__dirname + '/introduction.html');
});
app.get('/calendar.html', function(req, res){
res.sendFile(__dirname + '/calendar.html');
});
app.get('/simulation.html', function(req, res){
res.sendFile(__dirname + '/simulation.html');
});
res.sendFile(__dirname + '/main.css');
});
\ No newline at end of file
......
......@@ -78,6 +78,10 @@ body{
font-size:15px;
border-radius:5px;
}
.t1:hover{
color:#0053b3;
background-color: #2E294E;
}
.row{
display:flex;
justify-content: space-evenly;
......@@ -102,6 +106,10 @@ body{
font-size:15px;
border-radius:5px;
}
.t2:hover{
color:#be4209;
background-color: #2E294E;
}
.l{
width:33%;
height:200px;
......@@ -118,24 +126,26 @@ body{
text-align:center;
}
.simul{
width:50%;
height:150px;
display:flex;
float:left;
margin-top:50px;
margin-left:250px;
}
.but{
height:150px;
margin: 0px auto;
margin: auto;
text-align:center;
}
.simulbtr{
width:250px;
width:200px;
height:50px;
color: #c9d6de;
border: 1px solid #c9d6de;
background: black;
font-size:30px;
margin-top:50px;
font-size:20px;
border-radius:5px;
margin-right:5px;
}
.simulbtr:hover{
color:#7700ff;
background-color: #2E294E;
}
.tb{
padding: 10px 0px 0px 90px;
......@@ -155,4 +165,10 @@ td{
overflow-y: scroll;
overflow-x: auto;
background-color:white;
}
#select_list{
width:50%;
margin: auto;
text-align:center;
margin-bottom:50px;
}
\ No newline at end of file
......
......@@ -6,6 +6,7 @@
<script src = "player.js"></script>
<script src = "temp_algorithm.js"></script>
<script src = "simulation.js"></script>
<script src = "predict.js"></script>
</head>
<body>
<div class="container1">
......@@ -125,12 +126,11 @@
<img src="pngs/dusan.png" id="home" class="vs">
</div>
<div class="simul">
<div class="but">
<input type="button" onclick="pre_algorithm(hitter_list1, hitter_list2, pitcher1, pitcher2);" class="simulbtr" value="시뮬레이션">
</div>
<div class="result">
</div>
<input type="button" onclick="pre_algorithm(hitter_list1, hitter_list2, pitcher1, pitcher2);" class="simulbtr" value="시뮬레이션">
<input type="button" onclick="add_predict();" class="simulbtr" value="승률예측">
</div>
<div id="select_list">
<select name="pr" id="pr" onclick="predict(this.value, hitter_list1, hitter_list2, pitcher1, pitcher2);"></select>
</div>
<div id="jstest"></div>
</div>
......
......@@ -193,8 +193,84 @@ function pre_algorithm(hitter_list1, hitter_list2, pitcher1, pitcher2){//algorit
}
else{//아웃
out++;
document.getElementById('jstest').innerHTML+=("아웃!");
var ran = Math.random()*0.2;
if(ran>0.197){
switch(home_away){
case 1:
score1 = score1 + base3 + base2 + base1 + 1;
break;
case 2:
score2 = score2 + base3 + base2 + base1 + 1;
break;
}
base3 = 0;
base2 = 0;
base1 = 0;
document.getElementById('jstest').innerHTML+=("홈런!");
}else if(ran>0.1955){
switch(home_away){
case 1:
score1 = score1 + base3 + base2 + base1;
break;
case 2:
score2 = score2 + base3 + base2 + base1;
break;
}
base3 = 1;
base2 = 0;
base1 = 0;
document.getElementById('jstest').innerHTML+=("3루타!");
}else if(ran>0.18){
var n = Math.random();
if(n <= 0.4){
switch(home_away){
case 1:
score1 = score1 + base3 + base2;
break;
case 2:
score2 = score2 + base3 + base2;
break;
}
base3 = base1;
base2 = 1;
base1 = 0;
document.getElementById('jstest').innerHTML+=("2루타!");
}
else if(0.4 < n && n <=0.7){
switch(home_away){
case 1:
score1 = score1 + base3 + base2 + base1;
break;
case 2:
score2 = score2 + base3 + base2 + base1;
break;
}
base3 = 0;
base2 = 1;
base1 = 0;
document.getElementById('jstest').innerHTML+=("2루타!");
}
else{
switch(home_away){
case 1:
score1 = score1 + base3 + base2;
break;
case 2:
score2 = score2 + base3 + base2;
break;
}
base3 = 0;
base2 = 1;
base1 = 0;
document.getElementById('jstest').innerHTML+=("2루타!");
}
}else{
out++;
document.getElementById('jstest').innerHTML+=("아웃!");
}
}
......@@ -234,4 +310,6 @@ function pre_algorithm(hitter_list1, hitter_list2, pitcher1, pitcher2){//algorit
}
document.getElementById('jstest').innerHTML+=("<br\><br\>"+"최종스코어 : "+score1+"vs"+score2);
var score = [score1, score2];
return score;
}
\ No newline at end of file
......