index.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <!--
  2. Copyright (c) 2013 Fabrice ECAILLE aka Febbweiss
  3. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
  4. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  5. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  6. -->
  7. <!DOCTYPE html>
  8. <html>
  9. <head>
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11. <title>Yahtzee</title>
  12. <!--[if IE]>
  13. <style type="text/css" media="screen">
  14. body {
  15. behavior: url("/css/hack/csshover3.htc");
  16. }
  17. </style>
  18. <![endif]-->
  19. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  20. <link href='http://fonts.googleapis.com/css?family=Zeyada' rel='stylesheet' type='text/css'>
  21. <script src="lib/jquery-1.7.1.min.js" type="text/javascript" ></script>
  22. <link href="css/yahtzee.css" type="text/css" rel="stylesheet" media="screen, projection" />
  23. <link href="../../extra/css/extra.css" type="text/css" rel="stylesheet" media="screen, projection" />
  24. <script src="../../extra/js/yahtzee.js" type="text/javascript" ></script>
  25. </head>
  26. <body>
  27. <div style="width: 50%;float: left;">
  28. <div class="dice empty" id="dice1"></div>
  29. <div class="dice empty" id="dice2"></div>
  30. <div class="dice empty" id="dice3"></div>
  31. <div class="dice empty" id="dice4"></div>
  32. <div class="dice empty" id="dice5"></div>
  33. <div class="dice empty" id="dice6"></div>
  34. <div class="clear"></div>
  35. <div>
  36. <span>Launch</span>
  37. <span id="launch"></span>
  38. </div>
  39. <a href="javascript:void(0)" id="launchBtn">Launch</a>
  40. <div style="margin-top: 25px;">
  41. <dl>
  42. <dt>Three of a kind</dt>
  43. <dd>Three dice showing the same face</dd>
  44. <dd>Sum of all dice</dd>
  45. <dt>Four of a kind</dt>
  46. <dd>Four dice showing the same face</dd>
  47. <dd>Sum of all dice</dd>
  48. <dt>Full</dt>
  49. <dd>A three-of-a-kind and a pair</dd>
  50. <dd>25 points</dd>
  51. <dt>Small straight</dt>
  52. <dd>Four sequential dice</dd>
  53. <dd>30 points</dd>
  54. <dt>Large straight</dt>
  55. <dd>Five sequential dice</dd>
  56. <dd>40 points</dd>
  57. <dt>Yahtzee</dt>
  58. <dd>Five dice showing the same face</dd>
  59. <dd>50 points</dd>
  60. <dt>Chance</dt>
  61. <dd>Sum of all dice</dd>
  62. </dl>
  63. </div>
  64. <div id="scorePanel" style="display: none;">
  65. <table class="table table-bordered">
  66. <tr>
  67. <td>Upper grid score</td>
  68. <td id="upperScore" style="text-align: center"></td>
  69. </tr>
  70. <tr>
  71. <td>Bonus</td>
  72. <td id="bonus" style="text-align: center"></td>
  73. </tr>
  74. <tr>
  75. <td>Lower grid score</td>
  76. <td id="lowerScore" style="text-align: center"></td>
  77. </tr>
  78. <tr>
  79. <td><b>Total</b></td>
  80. <td id="totalScore" style="text-align: center"><b></b></td>
  81. </tr>
  82. </table>
  83. </div>
  84. </div>
  85. <div style="width: 50%;float: left;">
  86. <table border="1">
  87. <thead>
  88. <tr>
  89. <th style="text-align: center;">Combinaison</th>
  90. <th style="text-align: center;" width="84px">
  91. Score
  92. </th>
  93. <th style="text-align: center;" width="100px"></th>
  94. </tr>
  95. </thead>
  96. <tbody>
  97. <tr>
  98. <td>
  99. <span id="oneLabel">
  100. One
  101. </span>
  102. </td>
  103. <td style="text-align: center;">
  104. <span id="oneScore" class="score">&nbsp;</span>
  105. </td>
  106. <td>
  107. <a href="javascript:void(0)"id="oneKeep" data-id="one" class="keep">Keep</a>
  108. <a href="javascript:void(0)"id="oneTrash" data-id="one" class="trash">Trash</a>
  109. </td>
  110. </tr>
  111. <tr>
  112. <td>
  113. <span id="twoLabel">
  114. Two
  115. </span>
  116. </td>
  117. <td style="text-align: center;">
  118. <span id="twoScore" class="score">&nbsp;</span>
  119. </td>
  120. <td>
  121. <a href="javascript:void(0)"id="twoKeep" data-id="two" class="keep">Keep</a>
  122. <a href="javascript:void(0)"id="twoTrash" data-id="two" class="trash">Trash</a>
  123. </td>
  124. </tr>
  125. <tr>
  126. <td>
  127. <span id="threeLabel">
  128. Three
  129. </span>
  130. </td>
  131. <td style="text-align: center;">
  132. <span id="threeScore" class="score">&nbsp;</span>
  133. </td>
  134. <td>
  135. <a href="javascript:void(0)"id="threeKeep" data-id="three" class="keep">Keep</a>
  136. <a href="javascript:void(0)"id="threeTrash" data-id="three" class="trash">Trash</a>
  137. </td>
  138. </tr>
  139. <tr>
  140. <td>
  141. <span id="fourLabel">
  142. Four
  143. </span>
  144. </td>
  145. <td style="text-align: center;">
  146. <span id="fourScore" class="score">&nbsp;</span>
  147. </td>
  148. <td>
  149. <a href="javascript:void(0)"id="fourKeep" data-id="four" class="keep">Keep</a>
  150. <a href="javascript:void(0)"id="fourTrash" data-id="four" class="trash">Trash</a>
  151. </td>
  152. </tr>
  153. <tr>
  154. <td>
  155. <span id="fiveLabel">
  156. Five
  157. </span>
  158. </td>
  159. <td style="text-align: center;">
  160. <span id="fiveScore" class="score">&nbsp;</span>
  161. </td>
  162. <td>
  163. <a href="javascript:void(0)"id="fiveKeep" data-id="five" class="keep">Keep</a>
  164. <a href="javascript:void(0)"id="fiveTrash" data-id="five" class="trash">Trash</a>
  165. </td>
  166. </tr>
  167. <tr>
  168. <td>
  169. <span id="sixLabel">
  170. Six
  171. </span>
  172. </td>
  173. <td style="text-align: center;">
  174. <span id="sixScore" class="score">&nbsp;</span>
  175. </td>
  176. <td>
  177. <a href="javascript:void(0)"id="sixKeep" data-id="six" class="keep">Keep</a>
  178. <a href="javascript:void(0)"id="sixTrash" data-id="six" class="trash">Trash</a>
  179. </td>
  180. </tr>
  181. </tbody>
  182. </table>
  183. <table border="1">
  184. <thead>
  185. <tr>
  186. <th style="text-align: center;">Combinaison</th>
  187. <th style="text-align: center;">Probability</th>
  188. <th style="text-align: center;" width="84px">
  189. Score
  190. </th>
  191. <th style="text-align: center;" width="100px"></th>
  192. </tr>
  193. </thead>
  194. <tbody>
  195. <tr>
  196. <td>
  197. <span id="threeOfAKindLabel">
  198. Three of a kind
  199. </span>
  200. </td>
  201. <td>
  202. <div class="progress">
  203. <div class="bar" id="threeOfAKindBar"></div>
  204. <span id="threeOfAKindProbability" style="padding-left: 1px;">&nbsp;</span>
  205. </div>
  206. </td>
  207. <td style="text-align: center;">
  208. <span id="threeOfAKindScore" class="score">&nbsp;</span>
  209. </td>
  210. <td>
  211. <a href="javascript:void(0)"id="threeOfAKindKeep" data-id="threeOfAKind" class="keep">Keep</a>
  212. <a href="javascript:void(0)"id="threeOfAKindTrash" data-id="threeOfAKind" class="trash">Trash</a>
  213. </td>
  214. </tr>
  215. <tr>
  216. <td>
  217. <span id="fourOfAKindLabel">
  218. Four of a kind
  219. </span>
  220. </td>
  221. <td>
  222. <div class="progress">
  223. <div class="bar" id="fourOfAKindBar"></div>
  224. <span id="fourOfAKindProbability" style="padding-left: 1px;">&nbsp;</span>
  225. </div>
  226. </td>
  227. <td style="text-align: center;">
  228. <span id="fourOfAKindScore" class="score">&nbsp;</span>
  229. </td>
  230. <td>
  231. <a href="javascript:void(0)"id="fourOfAKindKeep" data-id="fourOfAKind" class="keep">Keep</a>
  232. <a href="javascript:void(0)"id="fourOfAKindTrash" data-id="fourOfAKind" class="trash">Trash</a>
  233. </td>
  234. </tr>
  235. <tr>
  236. <td>
  237. <span id="fullLabel">
  238. Full
  239. </span>
  240. </td>
  241. <td>
  242. <div class="progress">
  243. <div class="bar" id="fullBar"></div>
  244. <span id="fullProbability" style="padding-left: 1px;">&nbsp;</span>
  245. </div>
  246. </td>
  247. <td style="text-align: center;">
  248. <span id="fullScore" class="score">&nbsp;</span>
  249. </td>
  250. <td>
  251. <a href="javascript:void(0)"id="fullKeep" data-id="full" class="keep">Keep</a>
  252. <a href="javascript:void(0)"id="fullTrash" data-id="full" class="trash">Trash</a>
  253. </td>
  254. </tr>
  255. <tr>
  256. <td>
  257. <span id="smallStraightLabel">
  258. Small straight
  259. </span>
  260. </td>
  261. <td>
  262. <div class="progress">
  263. <div class="bar" id="smallStraightBar"></div>
  264. <span id="smallStraightProbability" style="padding-left: 1px;">&nbsp;</span>
  265. </div>
  266. </td>
  267. <td style="text-align: center;">
  268. <span id="smallStraightScore" class="score">&nbsp;</span>
  269. </td>
  270. <td>
  271. <a href="javascript:void(0)"id="smallStraightKeep" data-id="smallStraight" class="keep">Keep</a>
  272. <a href="javascript:void(0)"id="smallStraightTrash" data-id="smallStraight" class="trash">Trash</a>
  273. </td>
  274. </tr>
  275. <tr>
  276. <td>
  277. <span id="largeStraightLabel">
  278. Large straight
  279. </span>
  280. </td>
  281. <td>
  282. <div class="progress">
  283. <div class="bar" id="largeStraightBar"></div>
  284. <span id="largeStraightProbability" style="padding-left: 1px;">&nbsp;</span>
  285. </div>
  286. </td>
  287. <td style="text-align: center;">
  288. <span id="largeStraightScore" class="score">&nbsp;</span>
  289. </td>
  290. <td>
  291. <a href="javascript:void(0)"id="largeStraightKeep" data-id="largeStraight" class="keep">Keep</a>
  292. <a href="javascript:void(0)"id="largeStraightTrash" data-id="largeStraight" class="trash">Trash</a>
  293. </td>
  294. </tr>
  295. <tr>
  296. <td>
  297. <span id="yahtzeeLabel">
  298. Yahtzee
  299. </span>
  300. </td>
  301. <td>
  302. <div class="progress">
  303. <div class="bar" id="yahtzeeBar"></div>
  304. <span id="yahtzeeProbability" style="padding-left: 1px;">&nbsp;</span>
  305. </div>
  306. </td>
  307. <td style="text-align: center;">
  308. <span id="yahtzeeScore" class="score">&nbsp;</span>
  309. </td>
  310. <td>
  311. <a href="javascript:void(0)"id="yahtzeeKeep" data-id="yahtzee" class="keep">Keep</a>
  312. <a href="javascript:void(0)"id="yahtzeeTrash" data-id="yahtzee" class="trash">Trash</a>
  313. </td>
  314. </tr>
  315. <tr>
  316. <td>
  317. <span id="luckLabel">
  318. Chance
  319. </span>
  320. </td>
  321. <td>
  322. <div class="progress">
  323. <div class="bar" id="luckBar"></div>
  324. <span id="luckProbability" style="padding-left: 1px;">&nbsp;</span>
  325. </div>
  326. </td>
  327. <td style="text-align: center;">
  328. <span id="luckScore" class="score">&nbsp;</span>
  329. </td>
  330. <td>
  331. <a href="javascript:void(0)"id="luckKeep" data-id="luck" class="keep">Keep</a>
  332. <a href="javascript:void(0)"id="luckTrash" data-id="luck" class="trash">Trash</a>
  333. </td>
  334. </tr>
  335. </tbody>
  336. </table>
  337. </div>
  338. </div>
  339. </div> <!-- End of span9 -->
  340. <div style="text-align: center;margin-top: 00px;">
  341. <button id="startBtn" class="push--skeuo">Start</button>
  342. </div>
  343. <script src="js/yahtzee.js" type="text/javascript" ></script>
  344. <script type="text/javascript">
  345. $(document).ready(function () {
  346. $(".dice").click(function(evt) {
  347. if( $(this).hasClass("selected") )
  348. $(this).removeClass("selected");
  349. else
  350. $(this).addClass("selected");
  351. });
  352. $(".keep").click(function(evt) {
  353. console.log("Keeping " + $(this).attr('data-id'));
  354. Yahtzee.keep($(this).attr('data-id'));
  355. });
  356. $(".trash").click(function(evt) {
  357. console.log("Trashing " + $(this).attr('data-id'));
  358. Yahtzee.trash($(this).attr('data-id'));
  359. });
  360. $("#launchBtn").click(function() {
  361. Yahtzee.shuffle();
  362. Yahtzee.findCombinaisons();
  363. if( Yahtzee.launch < 3 )
  364. Yahtzee.findPossibilities();
  365. });
  366. });
  367. </script>
  368. </body>
  369. </html>