Farkle
How do I make an farkle?
What is a farkle? How do you make a farkle? This script and codes were developed by Kyle Freed on 31 October 2022, Monday.
Farkle - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Farkle</title>
</head>
<body> <script src='https://codepen.io/efreed/pen/yVVyra.js'></script> <script src="js/index.js"></script>
</body>
</html>
Farkle - Script Codes JS Codes
game.name = "Farkle";
function roll(object, how_many) { for (i = 0; i < how_many; i++) { var randNum = Math.floor((Math.random() * 6) + 1); object.push(randNum); }
}
game.play = function(board, players) { var dice = []; var options = []; roll(dice, 6); dice.sort(); board.log(dice); var diceObject = { 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0 }; $.each(dice, function() { diceObject[this]++; }); board.log(diceObject); var threes = 0; $.each(diceObject, function() { if (this == 3) { threes++; } }); if (threes == 2) { options.push(2); } $.each(diceObject, function() { if (this == 6) { options.push(1); } }); var twos = 0; $.each(diceObject, function() { if (this == 2) { twos++; } }); if (twos == 3) { options.push(4); } var ones = 0; $.each(diceObject, function() { if (this == 1) { ones++; } }); if (ones == 6) { options.push(5) } $.each(diceObject, function() { if (this == 5) { options.push(3); } }); $.each(diceObject, function() { if (this == 4) { options.push(6); } }); for (var i = 2; i <= 6; i++) { if (diceObject[i] == 3) { options.push(13 - i); } } if (diceObject[1] == 3) { options.push(9); } if (diceObject[1] > 0 || diceObject[5] > 0) { options.push(12); } board.log(options);
}
Developer | Kyle Freed |
Username | kfpen |
Uploaded | October 31, 2022 |
Rating | 3 |
Size | 1,747 Kb |
Views | 18,216 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Fate of The Nine Dragons | 6,589 Kb |
A Pen by Kyle Freed | 43,217 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
AngularJS Animated Todo List | Ehaase | 2,975 Kb |
A Pen by Jonas Bjork | Jonasbjork | 3,115 Kb |
Animated rainbow wave on canvas | Icodeforlove | 2,777 Kb |
Test | Dviate | 2,668 Kb |
Form Labels | Bartuc | 2,717 Kb |
CSS3 keyframe onload animation. | Samueljseay | 1,706 Kb |
Layout 11 | Altynai | 1,690 Kb |
Transition | Shayhowe | 1,632 Kb |
Click Based Rotation Demo | Zeaklous | 2,086 Kb |
Google Maps API Ground Overlay | Boycetrus | 2,961 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!