Farkle

Developer
Size
1,747 Kb
Views
18,216

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 Previews

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);
}
Farkle - Script Codes
Farkle - Script Codes
Home Page Home
Developer Kyle Freed
Username kfpen
Uploaded October 31, 2022
Rating 3
Size 1,747 Kb
Views 18,216
Do you need developer help for Farkle?

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!

Kyle Freed (kfpen) Script Codes
Create amazing sales emails with AI!

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!