How I Designed a Farkel Dice Game

Jul 13, 2021

The eLearning Challenge for the week beginning 7/10 was to use random numbers and variables.

I created this game of Farkel: https://360.articulate.com/review/content/cbc61924-aa5c-4851-84bc-17925cbc0206/review

The Process

Personally, I have never played the game Farkel (or Farkle) but I was aware that it was a dice game.  I did a search in the Articulate community and found that one person had created a Farkle game once, but they said it was never fully implemented.

So, I did a google search for Farkle and found these rules posted on how to score it.

scoring combos for Farkel

Alright, so assume you are like me and have never played the game before, with a set of score combos like this you can see that (1) this is a dice game (2) it uses six dice (3) various combos provide a payout.

I also discovered some rules of play: http://farkle.games/official-rules/#:~:text=Farkle%20Rules%201%20Number%20of%20Players.%20Anywhere%20from,5%2C%20and%206.%20...%205%20Gameplay%20Variations.%20

Farkle is a game of chance and strategy where two or more players roll dice which earn points. The goal is to be the player with 10,000 or more points on the final turn.

  • Each player starts their turn by rolling six dice.
  • After rolling, the player sets aside specific dice combinations which have a score value.
  • The player can either bank the points earned that turn to their total points and pass the dice to the next player or risk the points earned that turn and roll the remaining dice again, hoping to earn more points.
  • If the remaining dice rolled do not have a scoring combination, then the player has “FARKLED” and points earned that turn are gone forever.

The setup

I'm not going to spend a lot of time on how to create a rolling dice game with six dice here.  A few pictures should suffice.  We are dealing with a random number from 1-6 drawn 6 times, and a dice cube with six states.  Change the state of the dice cube to match the random number.

Notice the "Normal" state is a blank die, and each side is named from 1-6.  There is also a selected state.

The Game Engine

Alright, we have the basic setup and we know how to change the state of each die based on the random number drawn. 

Here are the triggers for die one

Ok, so die_roll_1 is the object, dice_1 is the state, roll1 is the random number.

Holding the Dice

It is a simple thing to click on an object and change it's state to selected.  It is a built in Storyline feature.  Remember, our selected state looks like this:

The nice thing about this state, is that when you unselect by clicking again, the object goes back to its previous state.

So after rolling the dice, they are each either a number or SELECTED.

Now we can re-roll only the dice that aren't currently selected by using these triggers:

So if the die is not selected, we zero its value and then assign a new value by picking a random number between 1 and 6.

If the die is selected, we ignore these two triggers and move on.

Beginning to Calculate a Score

Unlike other games (like slot machines) the order of the dice makes no difference for scoring this game.  This means there are fewer combinations we have to consider to determine a score for any particular roll.

According to the Scoring Combos card any 1 is worth 100 points, unless you have three or more of them.  Any 5 is worth 50 points, unless you have three or more of them.  The other numbers, in general, have no value unless you have three or more of them.  The two exceptions are a straight, or three pairs.

What this means is that I don't care what position a particular die is in, I just need to know, how many of the six dies are ones, or twos, or threes . . .

So lets count them and add them to a variable with a simple name.

Here are the variable names for scoring:

Why did I name the variable for pairs and the variable for straight with a "0_ " in front of them?  So they would be easier to find when I was setting up triggers.

Alright?  Scoring will be in two phases.  Zero out the variable and count the number of dice in each variable (1s, 2s, 3s etc.) then assign scores based on those results.

Zero the variables

Count how many dice match

 

We repeat this for each of the variables and for each of the rolls (roll1, roll2, roll3, roll4, roll5, roll6)

Scoring the roll

We set up another variable to hold the score for this roll.  We zero it out, then we add to it based on how many dice are 1s, 2s, 3s, etc.

So calculating the score for the number of 1s we have would look like this:

Pretty readable right?  If I have one of them then first_roll_score will have a value of 100.  If I have two, 200.  But if I have three, then I get 1000.  I get 1000 more for each additional 1s.

Twos, threes, fours and sixes follow this pattern:

Fives do also, but pay 50 for one and 100 for two.

What about the straight?

Simple.

1s =1

2s=1

3s=1

4s=1

5s=1

6s=1

What about the pairs?

A little harder.  Although not impossible.  Thinking about the six dice and the possible pairs, how many combinations are there?

I found it easiest to get out a piece of scratch paper and list them.  Remember, it placement doesn't matter, so I don't have to worry about which position the dice are.

Here is my list of possible pairs with six dice.  

1 2 3

1 2 4

1 2 5

1 2 6

1 3 4

1 3 5

1 3 6

1 4 5

1 4 6

1 5 6

2 3 4

2 3 5

2 3 6

2 4 5

2 4 6

2 5 6

3 4 5

3 4 6

3 5 6

4 5 6

That's it.

So three pairs is worth 750 points.  This is what the beginning of the triggers look like:

By naming the variables the way I did it is pretty easy to read.  We just continue listing all the possible ways from our scratch paper, and scratch them off as they are added to the list.

Conclusion

As you can see, Articulate makes it fairly easy to create games with complex rules that mirror games in real world.

A variable is just a box to hold information.  Each variable only holds  one thing.  If you give your variables names that make sense, a complex game like this can be pretty straightforward to design.

Play the game: https://360.articulate.com/review/content/cbc61924-aa5c-4851-84bc-17925cbc0206/review

If you would like to explore the game further, I have attached a Zipped Storyline file.

 

 

 

 

 

1 Reply