Febbweiss 12 rokov pred
commit
7fed13950d
8 zmenil súbory, kde vykonal 805 pridanie a 0 odobranie
  1. 7 0
      LICENSE.md
  2. 31 0
      README.md
  3. 65 0
      css/yahtzee.css
  4. BIN
      images/dices.png
  5. BIN
      images/red_dices.png
  6. 391 0
      index.html
  7. 310 0
      js/yahtzee.js
  8. 1 0
      lib/jquery-1.7.1.min.js

+ 7 - 0
LICENSE.md

@@ -0,0 +1,7 @@
+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.

+ 31 - 0
README.md

@@ -0,0 +1,31 @@
+The classical dice game Yahtzee
+
+
+How to :
+--------
+
+The goal is to complete the two combinaisons grids with five dice
+
+Each player can launch three times the dice to have a combinaison. After each launch, the player chooses to keep or not some dice. Each combinaison has a score.
+
+When both grids are completed, their scores are added and the player with the higher score wins. If the upper grid has a score higher than 63 points, the player wins a bonus of 35 points.
+
+A live demo is avalaible [here](http://www.pavnay.fr/yahtzee/)
+
+Credits :
+---------
+
+* Graphics : Fabrice Ecaille aka Febbweiss
+* Code : Fabrice Ecaille aka Febbweiss
+
+Licences :
+----------
+
+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.
+

+ 65 - 0
css/yahtzee.css

@@ -0,0 +1,65 @@
+.possibility {
+}
+
+.dice {
+	float: left;
+	margin: 4px;
+	width: 50px;
+	height: 50px;
+	background-image: url('../images/dices.png');
+}
+
+.dice.face6 {
+	background-position: 0 0;
+}
+
+.dice.face5 {
+	background-position: -50px 0;
+}
+
+.dice.face4 {
+	background-position: -100px 0;
+}
+
+.dice.face3 {
+	background-position: -149px 0;
+}
+
+.dice.face2 {
+	background-position: -199px 0;
+}
+
+.dice.face1 {
+	background-position: -249px 0;
+}
+
+.dice.empty {
+	visibility: hidden;
+}
+
+.dice.selected {
+	background-image: url('../images/red_dices.png');
+}
+
+.keep {
+	visibility: hidden;
+}
+
+.trash {
+	visibility: hidden;
+}
+
+.score {
+	font-family: "Zeyada", verdana, arial, helvetica, cursive;
+	color: blue;
+	font-size: 2em;
+	font-weight: bold;
+	text-align: center;
+}
+.score.trashed {
+	color: red;
+}
+
+.progress {
+	margin-bottom: 0;
+}

BIN
images/dices.png


BIN
images/red_dices.png


+ 391 - 0
index.html

@@ -0,0 +1,391 @@
+<!--
+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.
+-->
+<!DOCTYPE html>
+<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'>
+        <script src="lib/jquery-1.7.1.min.js" type="text/javascript" ></script>
+		<link href="css/yahtzee.css" type="text/css" rel="stylesheet" media="screen, projection" />
+
+    </head>
+    <body>
+			<div style="width: 50%;float: left;">
+				<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>
+					<span>Launch</span>
+					<span id="launch"></span>
+				</div>
+				<a href="javascript:void(0)" id="launchBtn">Launch</a>
+				<div>
+					<dl>
+						<dt>Three of a kind</dt>
+						<dd>Three dice showing the same face</dd>
+						<dd>Sum of all dice</dd>
+						<dt>Four of a kind</dt>
+						<dd>Four dice showing the same face</dd>
+						<dd>Sum of all dice</dd>
+						<dt>Full</dt>
+						<dd>A three-of-a-kind and a pair</dd>
+						<dd>25 points</dd>
+						<dt>Small straight</dt>
+						<dd>Four sequential dice</dd>
+						<dd>30 points</dd>
+						<dt>Large straight</dt>
+						<dd>Five sequential dice</dd>
+						<dd>40 points</dd>
+						<dt>Yahtzee</dt>
+						<dd>Five dice showing the same face</dd>
+						<dd>50 points</dd>
+						<dt>Chance</dt>
+						<dd>Sum of all dice</dd>
+					</dl>
+				</div>
+				<div id="scorePanel" style="display: none;">
+					<table class="table table-bordered">
+						<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 style="width: 50%;float: left;">
+				
+				<table border="1">
+					<thead>
+						<tr>
+							<th style="text-align: center;">Combinaison</th>
+							<th style="text-align: center;" width="84px">
+								Score
+							</th>
+							<th style="text-align: center;" width="100px"></th>
+						</tr>
+					</thead>
+					<tbody>
+						
+							<tr>
+								<td>
+									<span id="oneLabel">
+										One
+									</span>
+								</td>
+								<td style="text-align: center;">
+									<span id="oneScore" class="score">&nbsp;</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">
+										Two
+									</span>
+								</td>
+								<td style="text-align: center;">
+									<span id="twoScore" class="score">&nbsp;</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">
+										Three
+									</span>
+								</td>
+								<td style="text-align: center;">
+									<span id="threeScore" class="score">&nbsp;</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">
+										Four
+									</span>
+								</td>
+								<td style="text-align: center;">
+									<span id="fourScore" class="score">&nbsp;</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">
+										Five
+									</span>
+								</td>
+								<td style="text-align: center;">
+									<span id="fiveScore" class="score">&nbsp;</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">
+										Six
+									</span>
+								</td>
+								<td style="text-align: center;">
+									<span id="sixScore" class="score">&nbsp;</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>
+						
+					</tbody>
+				</table>
+				
+				<table border="1">
+					<thead>
+						<tr>
+							<th style="text-align: center;">Combinaison</th>
+							<th style="text-align: center;">Probability</th>
+							<th style="text-align: center;" width="84px">
+								Score
+							</th>
+							<th style="text-align: center;" width="100px"></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;">&nbsp;</span>
+									</div>
+								</td>
+								<td style="text-align: center;">
+									<span id="threeOfAKindScore" class="score">&nbsp;</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;">&nbsp;</span>
+									</div>
+								</td>
+								<td style="text-align: center;">
+									<span id="fourOfAKindScore" class="score">&nbsp;</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
+									</span>
+								</td>
+								<td>
+									<div class="progress">
+										<div class="bar" id="fullBar"></div>
+										<span id="fullProbability" style="padding-left: 1px;">&nbsp;</span>
+									</div>
+								</td>
+								<td style="text-align: center;">
+									<span id="fullScore" class="score">&nbsp;</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;">&nbsp;</span>
+									</div>
+								</td>
+								<td style="text-align: center;">
+									<span id="smallStraightScore" class="score">&nbsp;</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;">&nbsp;</span>
+									</div>
+								</td>
+								<td style="text-align: center;">
+									<span id="largeStraightScore" class="score">&nbsp;</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;">&nbsp;</span>
+									</div>
+								</td>
+								<td style="text-align: center;">
+									<span id="yahtzeeScore" class="score">&nbsp;</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;">&nbsp;</span>
+									</div>
+								</td>
+								<td style="text-align: center;">
+									<span id="luckScore" class="score">&nbsp;</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>
+						
+					</tbody>
+				</table>
+				
+			</div>
+		</div>
+	
+				    </div> <!-- End of span9 -->
+
+<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.findCombinaisons();
+					if( Yahtzee.launch < 3 )
+						Yahtzee.findPossibilities();
+				});
+			});
+		</script>
+    </body>
+</html>

+ 310 - 0
js/yahtzee.js

@@ -0,0 +1,310 @@
+/*
+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.
+
+*/
+var SMALL_STRAIGHT_MASK1 = (1 << 0) + (1 << 1) + (1 << 2) + (1 << 3);
+var SMALL_STRAIGHT_MASK2 = (1 << 1) + (1 << 2) + (1 << 3) + (1 << 4);
+var SMALL_STRAIGHT_MASK3 = (1 << 2) + (1 << 3) + (1 << 4) + (1 << 5);
+var LARGE_STRAIGHT_MASK1 = (1 << 0) + (1 << 1) + (1 << 2) + (1 << 3) + (1 << 4);
+var LARGE_STRAIGHT_MASK2 = (1 << 1) + (1 << 2) + (1 << 3) + (1 << 4) + (1 << 5);
+var INCOMPLETE_STRAIGHT_MASK1 = (1 << 0) + (1 << 1) + (1 << 2);
+var INCOMPLETE_STRAIGHT_MASK2 = (1 << 1) + (1 << 2) + (1 << 3);
+var INCOMPLETE_STRAIGHT_MASK3 = (1 << 2) + (1 << 3) + (1 << 4);
+var INCOMPLETE_STRAIGHT_MASK4 = (1 << 3) + (1 << 4) + (1 << 5);
+
+Yahtzee = {
+		
+		launch : 0,
+		dices : [],
+		combinaisons : [],
+		pair : false,
+		doublePair : false,
+		three_of_a_kind : false,
+		four_of_a_kind : false,
+		full : false,
+		yahtzee : false,
+		small_straight : false,
+		large_straight : false,
+		straight : 0,
+
+		scoreUp : 0,
+		scoreDown: 0,
+		keptCombinaisons: [],
+		
+		clear: function(all) {
+			if( all )
+				Yahtzee.launch = 0;
+			
+			Yahtzee.pair = false;
+			Yahtzee.doublePair = false;
+			Yahtzee.three_of_a_kind = false;
+			Yahtzee.four_of_a_kind = false;
+			Yahtzee.full = false;
+			Yahtzee.yahtzee = false;
+			Yahtzee.small_straight = false;
+			Yahtzee.large_straight = false;
+			Yahtzee.straight = 0;
+			
+			if( all )
+				for( var i = 0; i < 5; i++ ) {
+					Yahtzee.dices[i] = 0;
+					$("#dice" + (i+1)).removeClass().addClass("dice").addClass("empty");
+				}
+			
+			for( var i = 0; i < 6; i++ ) {
+				Yahtzee.combinaisons[i] = 0;
+			}
+			
+			$(".possibility").each(function(incr, elt) {
+				$(elt).removeClass("possibility");
+				$(elt).empty();
+			});
+			
+			$(".keep").each(function(incr, elt) {
+				$(elt).attr('style', 'visibility:hidden;');
+			})
+			$(".trash").each(function(incr, elt) {
+				$(elt).attr('style', 'visibility:hidden;');
+			})
+		},
+		
+		shuffle: function() {
+			if($("#launchBtn").hasClass("disabled") )
+				return false;
+			
+			if( Yahtzee.launch == 3 )
+				Yahtzee.clear(true);
+			else
+				Yahtzee.clear(false);
+			
+			Yahtzee.launch++;
+			
+			for( var i = 0; i < 5; i++ ) {
+				var html = $("#dice" + (i+1));
+				if( !html.hasClass("selected") ) {
+					var value = Math.round(5 * Math.random());
+					Yahtzee.dices[i] = value;
+					html.removeClass().addClass("dice").addClass("face" + (value + 1));
+				}
+			}
+			
+			$("#launch").html(Yahtzee.launch);
+			if( Yahtzee.launch == 3 )
+				$("#launchBtn").addClass("disabled");
+		},
+		
+		findCombinaisons: function() {
+			for( var i = 0; i < 5; i++) {
+				Yahtzee.combinaisons[Yahtzee.dices[i]]++;
+				Yahtzee.straight = Yahtzee.straight | (1 << Yahtzee.dices[i]);
+			}
+			
+			for( var i = 0; i < 6; i++ ) {
+				var value = Yahtzee.combinaisons[i];
+				switch( value ) {
+				case 2:
+					if( Yahtzee.pair )
+						Yahtzee.doublePair = true;
+					Yahtzee.pair = true;
+					break;
+				case 5:
+					Yahtzee.yahtzee = true;
+				case 4:
+					Yahtzee.four_of_a_kind = true;
+				case 3:
+					Yahtzee.three_of_a_kind = true;
+					break;
+				}
+				
+			}
+			
+			Yahtzee.full = Yahtzee.pair && Yahtzee.three_of_a_kind && !Yahtzee.doublePair;
+			
+			if( (Yahtzee.straight & LARGE_STRAIGHT_MASK1) == LARGE_STRAIGHT_MASK1 ) {
+				Yahtzee.large_straight = true;		
+				Yahtzee.small_straight = true;		
+			} else if( (Yahtzee.straight & LARGE_STRAIGHT_MASK2) == LARGE_STRAIGHT_MASK2 ) {
+				Yahtzee.large_straight = true;
+				Yahtzee.small_straight = true;
+			} else if( (Yahtzee.straight & SMALL_STRAIGHT_MASK1) == SMALL_STRAIGHT_MASK1 ) {
+				Yahtzee.small_straight = true;		
+			} else if( (Yahtzee.straight & SMALL_STRAIGHT_MASK2) == SMALL_STRAIGHT_MASK2  ) {
+				Yahtzee.small_straight = true;
+			} else if( (Yahtzee.straight & SMALL_STRAIGHT_MASK3) == SMALL_STRAIGHT_MASK3  ) {
+				Yahtzee.small_straight = true;		
+			}
+			
+			if( Yahtzee.three_of_a_kind && Yahtzee.keptCombinaisons.indexOf("threeOfAKind") == -1 )
+				$("#threeOfAKindKeep").attr('style', 'visibility:visible;');
+			if( Yahtzee.four_of_a_kind && Yahtzee.keptCombinaisons.indexOf("fourOfAKind") == -1 )
+				$("#fourOfAKindKeep").attr('style', 'visibility:visible;');
+			if( Yahtzee.full && Yahtzee.keptCombinaisons.indexOf("full") == -1 )
+				$("#fullKeep").attr('style', 'visibility:visible;');
+			if( Yahtzee.yahtzee && Yahtzee.keptCombinaisons.indexOf("yahtzee") == -1 )
+				$("#yahtzeeKeep").attr('style', 'visibility:visible;');
+			if( Yahtzee.small_straight && Yahtzee.keptCombinaisons.indexOf("smallStraight") == -1 )
+				$("#smallStraightKeep").attr('style', 'visibility:visible;');
+			if( Yahtzee.large_straight && Yahtzee.keptCombinaisons.indexOf("largeStraight") == -1 )
+				$("#largeStraightKeep").attr('style', 'visibility:visible;');
+			
+			if( Yahtzee.combinaisons[0] > 0 && Yahtzee.keptCombinaisons.indexOf("one") == -1 )
+				$("#oneKeep").attr('style', 'visibility:visible;');
+			if( Yahtzee.combinaisons[1] > 0  && Yahtzee.keptCombinaisons.indexOf("two") == -1 )
+				$("#twoKeep").attr('style', 'visibility:visible;');
+			if( Yahtzee.combinaisons[2] > 0  && Yahtzee.keptCombinaisons.indexOf("three") == -1 )
+				$("#threeKeep").attr('style', 'visibility:visible;');
+			if( Yahtzee.combinaisons[3] > 0  && Yahtzee.keptCombinaisons.indexOf("four") == -1 )
+				$("#fourKeep").attr('style', 'visibility:visible;');
+			if( Yahtzee.combinaisons[4] > 0  && Yahtzee.keptCombinaisons.indexOf("five") == -1 )
+				$("#fiveKeep").attr('style', 'visibility:visible;');
+			if( Yahtzee.combinaisons[5] > 0  && Yahtzee.keptCombinaisons.indexOf("six") == -1 )
+				$("#sixKeep").attr('style', 'visibility:visible;');
+			
+			if( Yahtzee.keptCombinaisons.indexOf("luck") == -1 )
+				$("#luckKeep").attr('style', 'visibility:visible;');
+			
+			$(".trash").each(function(incr, elt){
+				var html = $(elt)
+				if( Yahtzee.keptCombinaisons.indexOf(html.attr('data-id')) == -1 )
+					html.attr('style', 'visibility:visible;');
+			});
+		},
+		
+		findPossibilities: function() {
+			var possibilities = {
+					"threeOfAKind" : 0,
+					"fourOfAKind" : 0,
+					"full" : 0,
+					"yahtzee" : 0,
+					"smallStraight" : 0,
+					"largeStraight" : 0
+			};
+			
+			if( Yahtzee.three_of_a_kind && !Yahtzee.full) {
+				possibilities["full"] = Math.max( possibilities["full"], 17 );
+				possibilities["fourOfAKind"] = Math.max( possibilities["fourOfAKind"], 31);
+				possibilities["yahtzee"] = Math.max( possibilities["yahtzee"],  3);
+			}
+			if( Yahtzee.pair ) {
+				if( !Yahtzee.three_of_a_kind )
+					possibilities["threeOfAKind"] = Math.max( possibilities["threeOfAKind"], 42);
+				possibilities["fourOfAKind"] = Math.max( possibilities["fourOfAKind"], 7);
+				if( !Yahtzee.full )
+					possibilities["full"] = Math.max( possibilities["full"], 10);
+				possibilities["yahtzee"] = Math.max( possibilities["yahtzee"], 7);
+			}
+			if( Yahtzee.four_of_a_kind ) {
+				possibilities["yahtzee"] = Math.max( possibilities["yahtzee"], 17);
+			}
+			if( Yahtzee.doublePair ) {
+				possibilities["full"] = Math.max( possibilities["full"], 33);
+			}
+			if( !Yahtzee.large_straight && 
+					((Yahtzee.straight & SMALL_STRAIGHT_MASK1) == SMALL_STRAIGHT_MASK1 || (Yahtzee.straight & SMALL_STRAIGHT_MASK3) == SMALL_STRAIGHT_MASK3) ) {
+				possibilities["largeStraight"] = Math.max( possibilities["largeStraight"], 17);
+			} else if( !Yahtzee.large_straight && (Yahtzee.straight & SMALL_STRAIGHT_MASK2) == SMALL_STRAIGHT_MASK2 ) {
+				possibilities["largeStraight"] = Math.max( possibilities["largeStraight"], 33);
+			}
+			
+			$.each(possibilities, function(key, value) {
+				var html = $("#" + key + "Probability");
+				html.empty().addClass("possibility");
+				if( value > 0 && Yahtzee.keptCombinaisons.indexOf(key) == -1 ) {
+					html.append(value + "%");
+				} else
+					html.append("&nbsp;");
+			});
+		},
+		
+		keep: function(id) {
+			var score = 0;
+			switch(id) {
+			case "one" :
+				score = Yahtzee.combinaisons[0] * 1;
+				Yahtzee.scoreUp += score;
+				break;
+			case "two" :
+				score = Yahtzee.combinaisons[1] * 2;
+				Yahtzee.scoreUp += score;
+				break;
+			case "three" :
+				score = Yahtzee.combinaisons[2] * 3;
+				Yahtzee.scoreUp += score;
+				break;
+			case "four" :
+				score = Yahtzee.combinaisons[3] * 4;
+				Yahtzee.scoreUp += score;
+				break;
+			case "five" :
+				score = Yahtzee.combinaisons[4] * 5;
+				Yahtzee.scoreUp += score;
+				break;
+			case "six" :
+				score = Yahtzee.combinaisons[5] * 6;
+				Yahtzee.scoreUp += score;
+				break;
+			case "threeOfAKind" :
+			case "fourOfAKind" :
+			case "luck" :
+				$.each(Yahtzee.dices, function(index, elt){score += (elt + 1)});
+				Yahtzee.scoreDown += score;
+				break;
+			case "full" :
+				score = 25;
+				Yahtzee.scoreDown += score;
+				break;
+			case "smallStraight" :
+				score = 30;
+				Yahtzee.scoreDown += score;
+				break;
+			case "largeStraight" :
+				score = 40;
+				Yahtzee.scoreDown += score;
+				break;
+			case "yahtzee" :
+				score = 50;
+				Yahtzee.scoreDown += score;
+				break;
+			}
+			
+			$("#" + id + "Score").html(score);
+			
+			Yahtzee.keptCombinaisons.push(id);
+			Yahtzee.clear(true);
+			
+			if( Yahtzee.keptCombinaisons.length < 13 )
+				$("#launchBtn").removeClass("disabled");
+			else
+				Yahtzee.show_game_over();
+		},
+		
+		trash : function(id) {
+			$("#" + id + "Score").html(0).addClass('trashed');
+			$("#" + id + "Label").attr('style', 'text-decoration:line-through;');
+			Yahtzee.keptCombinaisons.push(id);
+			Yahtzee.clear(true);
+			if( Yahtzee.keptCombinaisons.length < 13 )
+				$("#launchBtn").removeClass("disabled");
+			else
+				Yahtzee.show_game_over();
+		},
+		
+		show_game_over: function() {
+			$("#upperScore").append(Yahtzee.scoreUp);
+			if( Yahtzee.scoreUp > 63 ) {
+				$("#bonus").append(35);
+				Yahtzee.scoreUp += 35;
+			} else
+				$("#bonus").append(0);
+			$("#lowerScore").append(Yahtzee.scoreDown);
+			$("#totalScore").append(Yahtzee.scoreDown + Yahtzee.upperScore);
+
+			$("#scorePanel").show();
+		}
+}

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 0
lib/jquery-1.7.1.min.js


Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov