| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464 |
- <!DOCTYPE html>
- <!--
- Copyright (c) 2013 Fabrice ECAILLE aka Febbweiss
- 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:
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
- 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.
- -->
- <html>
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Yahtzee</title>
- <!--[if IE]>
- <style type="text/css" media="screen">
- body {
- behavior: url("/css/hack/csshover3.htc");
- }
- </style>
- <![endif]-->
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <link href='http://fonts.googleapis.com/css?family=Zeyada' rel='stylesheet' type='text/css'>
- <link href="https://fonts.googleapis.com/css?family=Fredericka+the+Great" rel="stylesheet">
- <script src="lib/jquery-1.7.1.min.js" type="text/javascript" ></script>
- <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.bundle.min.js">
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
- <link href="css/yahtzee.css" type="text/css" rel="stylesheet" media="screen, projection" />
- </head>
- <body>
- <div id="banner"class="col-xs-12">
- <h1>FEBBWEISS' YAHTZEE!</h1>
- </div>
- <div class="container">
- <div class="row">
- <div class="col-xs-12 col-xl-4">
-
- <div>
- <dl><br>
- <dt>Three of a kind</dt>
- <dd>Three dice showing the same face (Ex. Three 3's)</dd>
- <dd>Scoring: Sum of all dice</dd>
- <br>
- <dt>Four of a kind</dt>
- <dd>Four dice showing the same face (Ex. Four 5's)</dd>
- <dd>Scoring: Sum of all dice</dd>
- <br>
- <dt>Full House</dt>
- <dd>A three-of-a-kind and a pair (Ex. Three 1's and Two 4's)</dd>
- <dd>Scoring: 25 points</dd>
- <br>
- <dt>Small straight</dt>
- <dd>Four sequential dice (Ex. 2, 3, 4, 5)</dd>
- <dd>Scoring: 30 points</dd>
- <br>
- <dt>Large straight</dt>
- <dd>Five sequential dice (Ex. 2, 3, 4, 5, 6)</dd>
- <dd>Scoring: 40 points</dd>
- <br>
- <dt>Yahtzee</dt>
- <dd>Five dice showing the same face (Ex. Five 4's)</dd>
- <dd>Scoring: 50 points</dd>
- <br>
- <dt>Chance</dt>
- <dd>Scoring: Sum of all dice</dd>
- </dl>
- </div>
-
-
-
- </div>
-
- <div class="col-xs-12 col-xl-4">
-
- <table border="1">
- <thead>
- <tr>
- <th style="text-align: center;">Combination</th>
- <th style="text-align: center;" width="84px">
- Score
- </th>
- <th style="text-align: center;" width="100px">Options</th>
- </tr>
- </thead>
- <tbody>
-
- <tr>
- <td>
- <span id="oneLabel">
- Ones
- </span>
- </td>
- <td style="text-align: center;">
- <span id="oneScore" class="score"> </span>
- </td>
- <td>
- <a href="javascript:void(0)"id="oneKeep" data-id="one" class="keep">Keep</a>
- <a href="javascript:void(0)"id="oneTrash" data-id="one" class="trash">Trash</a>
- </td>
- </tr>
-
- <tr>
- <td>
- <span id="twoLabel">
- Twos
- </span>
- </td>
- <td style="text-align: center;">
- <span id="twoScore" class="score"> </span>
- </td>
- <td>
- <a href="javascript:void(0)"id="twoKeep" data-id="two" class="keep">Keep</a>
- <a href="javascript:void(0)"id="twoTrash" data-id="two" class="trash">Trash</a>
- </td>
- </tr>
-
- <tr>
- <td>
- <span id="threeLabel">
- Threes
- </span>
- </td>
- <td style="text-align: center;">
- <span id="threeScore" class="score"> </span>
- </td>
- <td>
- <a href="javascript:void(0)"id="threeKeep" data-id="three" class="keep">Keep</a>
- <a href="javascript:void(0)"id="threeTrash" data-id="three" class="trash">Trash</a>
- </td>
- </tr>
-
- <tr>
- <td>
- <span id="fourLabel">
- Fours
- </span>
- </td>
- <td style="text-align: center;">
- <span id="fourScore" class="score"> </span>
- </td>
- <td>
- <a href="javascript:void(0)"id="fourKeep" data-id="four" class="keep">Keep</a>
- <a href="javascript:void(0)"id="fourTrash" data-id="four" class="trash">Trash</a>
- </td>
- </tr>
-
- <tr>
- <td>
- <span id="fiveLabel">
- Fives
- </span>
- </td>
- <td style="text-align: center;">
- <span id="fiveScore" class="score"> </span>
- </td>
- <td>
- <a href="javascript:void(0)"id="fiveKeep" data-id="five" class="keep">Keep</a>
- <a href="javascript:void(0)"id="fiveTrash" data-id="five" class="trash">Trash</a>
- </td>
- </tr>
-
- <tr>
- <td>
- <span id="sixLabel">
- Sixes
- </span>
- </td>
- <td style="text-align: center;">
- <span id="sixScore" class="score"> </span>
- </td>
- <td>
- <a href="javascript:void(0)"id="sixKeep" data-id="six" class="keep">Keep</a>
- <a href="javascript:void(0)"id="sixTrash" data-id="six" class="trash">Trash</a>
- </td>
- </tr>
- <tr>
- <td>
- <span>
- Upper Score
- </span>
- </td>
-
- <td style="text-align: center;">
- <span class="score" id="topScore"></span>
- </td>
-
- </tr>
-
- </tbody>
- </table>
- <br>
-
-
- <div id="btn">
- <a href="javascript:void(0)" id="launchBtn">Roll the Dice</a>
- </div>
- <br>
- <div>
- <span>Dice Roll #:</span>
- <span id="launch"></span>
- </div>
- <br>
- <div>
- <div class="dice empty" id="dice1"></div>
- <div class="dice empty" id="dice2"></div>
- <div class="dice empty" id="dice3"></div>
- <div class="dice empty" id="dice4"></div>
- <div class="dice empty" id="dice5"></div>
- <div class="dice empty" id="dice6"></div>
- <div class="clear"></div>
- </div>
-
- <div>
-
-
-
-
- </div>
- </div>
-
- <div class="col-xs-12 col-xl-4">
- <table border="1">
- <thead>
- <tr>
- <th style="text-align: center;">Combination</th>
- <th style="text-align: center;">Probability</th>
- <th style="text-align: center;" width="84px">
- Score
- </th>
- <th style="text-align: center;" width="100px">Options</th>
- </tr>
- </thead>
- <tbody>
-
- <tr>
- <td>
- <span id="threeOfAKindLabel">
- Three of a kind
- </span>
- </td>
- <td>
- <div class="progress">
- <div class="bar" id="threeOfAKindBar"></div>
- <span id="threeOfAKindProbability" style="padding-left: 1px;"> </span>
- </div>
- </td>
- <td style="text-align: center;">
- <span id="threeOfAKindScore" class="score"> </span>
- </td>
- <td>
- <a href="javascript:void(0)"id="threeOfAKindKeep" data-id="threeOfAKind" class="keep">Keep</a>
- <a href="javascript:void(0)"id="threeOfAKindTrash" data-id="threeOfAKind" class="trash">Trash</a>
- </td>
- </tr>
-
- <tr>
- <td>
- <span id="fourOfAKindLabel">
- Four of a kind
- </span>
- </td>
- <td>
- <div class="progress">
- <div class="bar" id="fourOfAKindBar"></div>
- <span id="fourOfAKindProbability" style="padding-left: 1px;"> </span>
- </div>
- </td>
- <td style="text-align: center;">
- <span id="fourOfAKindScore" class="score"> </span>
- </td>
- <td>
- <a href="javascript:void(0)"id="fourOfAKindKeep" data-id="fourOfAKind" class="keep">Keep</a>
- <a href="javascript:void(0)"id="fourOfAKindTrash" data-id="fourOfAKind" class="trash">Trash</a>
- </td>
- </tr>
-
- <tr>
- <td>
- <span id="fullLabel">
- Full House
- </span>
- </td>
- <td>
- <div class="progress">
- <div class="bar" id="fullBar"></div>
- <span id="fullProbability" style="padding-left: 1px;"> </span>
- </div>
- </td>
- <td style="text-align: center;">
- <span id="fullScore" class="score"> </span>
- </td>
- <td>
- <a href="javascript:void(0)"id="fullKeep" data-id="full" class="keep">Keep</a>
- <a href="javascript:void(0)"id="fullTrash" data-id="full" class="trash">Trash</a>
- </td>
- </tr>
-
- <tr>
- <td>
- <span id="smallStraightLabel">
- Small Straight
- </span>
- </td>
- <td>
- <div class="progress">
- <div class="bar" id="smallStraightBar"></div>
- <span id="smallStraightProbability" style="padding-left: 1px;"> </span>
- </div>
- </td>
- <td style="text-align: center;">
- <span id="smallStraightScore" class="score"> </span>
- </td>
- <td>
- <a href="javascript:void(0)"id="smallStraightKeep" data-id="smallStraight" class="keep">Keep</a>
- <a href="javascript:void(0)"id="smallStraightTrash" data-id="smallStraight" class="trash">Trash</a>
- </td>
- </tr>
-
- <tr>
- <td>
- <span id="largeStraightLabel">
- Large Straight
- </span>
- </td>
- <td>
- <div class="progress">
- <div class="bar" id="largeStraightBar"></div>
- <span id="largeStraightProbability" style="padding-left: 1px;"> </span>
- </div>
- </td>
- <td style="text-align: center;">
- <span id="largeStraightScore" class="score"> </span>
- </td>
- <td>
- <a href="javascript:void(0)"id="largeStraightKeep" data-id="largeStraight" class="keep">Keep</a>
- <a href="javascript:void(0)"id="largeStraightTrash" data-id="largeStraight" class="trash">Trash</a>
- </td>
- </tr>
-
- <tr>
- <td>
- <span id="yahtzeeLabel">
- Yahtzee
- </span>
- </td>
- <td>
- <div class="progress">
- <div class="bar" id="yahtzeeBar"></div>
- <span id="yahtzeeProbability" style="padding-left: 1px;"> </span>
- </div>
- </td>
- <td style="text-align: center;">
- <span id="yahtzeeScore" class="score"> </span>
- </td>
- <td>
- <a href="javascript:void(0)"id="yahtzeeKeep" data-id="yahtzee" class="keep">Keep</a>
- <a href="javascript:void(0)"id="yahtzeeTrash" data-id="yahtzee" class="trash">Trash</a>
- </td>
- </tr>
-
- <tr>
- <td>
- <span id="luckLabel">
- Chance
- </span>
- </td>
- <td>
- <div class="progress">
- <div class="bar" id="luckBar"></div>
- <span id="luckProbability" style="padding-left: 1px;"> </span>
- </div>
- </td>
- <td style="text-align: center;">
- <span id="luckScore" class="score"> </span>
- </td>
- <td>
- <a href="javascript:void(0)"id="luckKeep" data-id="luck" class="keep">Keep</a>
- <a href="javascript:void(0)"id="luckTrash" data-id="luck" class="trash">Trash</a>
- </td>
- </tr>
- <tr>
- <td>
- <span>
- Lower Score
- </span>
- </td>
- <td>
-
- </td>
- <td style="text-align: center;">
- <span id="bottomScore" class="score"></span>
- </td>
-
- </tr>
-
- </tbody>
- </table>
- <br>
- <div id="scorePanel" style="display: none;">
- <table class="table table-bordered">
- <tr>
- <th>Final Score</th>
- </tr>
- <tr>
- <td>Upper grid score</td>
- <td id="upperScore" style="text-align: center"></td>
- </tr>
- <tr>
- <td>Bonus</td>
- <td id="bonus" style="text-align: center"></td>
- </tr>
- <tr>
- <td>Lower grid score</td>
- <td id="lowerScore" style="text-align: center"></td>
- </tr>
- <tr>
- <td><b>Total</b></td>
- <td id="totalScore" style="text-align: center"><b></b></td>
- </tr>
- </table>
- </div>
- </div>
- </div>
- </div>
-
-
- <script src="js/yahtzee.js" type="text/javascript" ></script>
- <script type="text/javascript">
- $(document).ready(function ()
- {
- $(".dice").click(function(evt)
- {
- if( $(this).hasClass("selected") )
- $(this).removeClass("selected");
- else
- $(this).addClass("selected");
- });
-
- $(".keep").click(function(evt)
- {
- console.log("Keeping " + $(this).attr('data-id'));
- Yahtzee.keep($(this).attr('data-id'));
- });
-
- $(".trash").click(function(evt)
- {
- console.log("Trashing " + $(this).attr('data-id'));
- Yahtzee.trash($(this).attr('data-id'));
- });
-
- $("#launchBtn").click(function()
- {
- Yahtzee.shuffle();
- Yahtzee.findCombinations();
- if( Yahtzee.launch < 3 )
- Yahtzee.findPossibilities();
- });
- });
- </script>
- </body>
- </html>
|