Desktop Yahtzee
by Mike Ironmonger

Yahtzee is a Desktop version of the popular dice game for one to six players. When the application is run, it installs itself on the icon bar; click on its icon and the main window will appear. On the left of this window is a list of options, and on the right is a column for each player showing their scores for each option, their bonus and their total score.

Clicking Menu over the main window opens a menu with seven entries, the first of which is 'New game'. If you choose this entry a dice window will appear and the five dice will roll for a moment and then stop. Above the dice on the left is the name of the player whose turn it is, and this is also indicated in the main window by the name being inverted. Above the dice on the right there are two tumblers which allow the dice to be shaken twice. Before taking each of these shakes, any or all of the dice can be held simply by clicking on them.

After both shakes, the dice have to be placed into one of the fifteen available options by clicking on an option. The score you obtain for the dice depends on where you place them and the numbers on the dice. The basic idea is to get the right combination of numbers on the dice so that you can get as large a score as possible for them. Of course, all the options are different - some require very specific combinations, and others are less restricted.
 
The options are split into two sections, and as the lower section is the simplest I'll explain those options first: 

'1 pair....' is the simplest of all the options. If you place the dice in here, you get the score of the highest pair that you have on the dice. For example:
 
1,5,1,2,3 earns 1+1=2 points.
3,1,4,4,6 earns 4+4=8 points.
2,2,1,5,5 earns 5+5=10 points.
3,4,4,4,3 earns 4+4=8 points.
5,5,5,6,5 earns 5+5=10 points
2,2,2,2,2 earns 2+2=4 points.
 

'2 pairs...' will earn you the total of two pairs of dice, although the pairs must be of different numbers:

2,4,5,5,4 earns 4+4+5+5=18 points.
6,2,6,6,2 earns 6+6+2+2=16 points.
4,3,4,4,4 earns no points.
1,1,1,1,1 earns no points.


'3 alike...' is what its name suggests:

1,6,2,6,6 earns 6+6+6=18 points.
3,2,3,3,3 earns 3+3+3=9 points.
4,4,4,4,4 earns 4+4+4=12 points.


'4 alike...' is what its name suggests:

3,3,4,3,3 earns 3+3+3+3=12 points.
5,5,5,5,5 earns 5+5+5+5=20 points.


'Small.....' is a run of 1,2,3,4,5 in any order, and earns 1+2+3+4+5=15 points.


'Large.....' is a run of 2,3,4,5,6 in any order, and earns 2+3+4+5+6=20 points.


'Full house' is a combination of '1 pair....' and '3 alike...', although the pair and the 3 alike must be of different numbers:

1,2,1,2,2 earns 1+1+2+2+2=8 points.
4,4,4,4,4 earns no points.


'Chance....' earns the total of all five dice:

1,3,6,5,5 earns 1+3+6+5+5=20 points.


'Yahtzee...' requires all five dice to be the same and scores as follows:

1,1,1,1,1 earns 100 points
2,2,2,2,2 earns 60 points
3,3,3,3,3 earns 65 points
4,4,4,4,4 earns 70 points
5,5,5,5,5 earns 75 points
6,6,6,6,6 earns 80 points
   
                          
The top section of the main window is a little more complicated, mainly because if you do well with these six options you can earn a fifty point bonus. The options themselves are straightforward enough. For example, if you place the dice in the 'Aces......' option you earn one point for each ace you have:
                                        
2,5,4,3,6 earns 0 points.
2,3,1,4,2 earns 1 point.
1,2,3,1,1 earns 1+1+1=3 points.
1,1,1,1,1 earns 1+1+1+1+5=5 points.
   
Similarly, in the 'Twos......' option you earn two points for each two you have, and this pattern continues up to the 'Sixes.....', where you earn six points for every six you have.

To earn the fifty point bonus you have to get three of each number, or its equivalent. Your progress towards this target is shown as a figure in the bonus row. This starts off at zero and changes whenever you get more or less than three of a certain number.

For example, at the start of a game if you put two aces into the 'Aces......' option you earn 2 points which is added to your total. However, you're one ace short of the target of three aces, so your bonus figure goes down by this one ace to -1, which is then shown in red. If you then put four sixes in 'Sixes.....' you earn 24 points which is added to your total. However, in this case you're one six ahead of the target of three sixes, so your bonus figure goes up by 6 to +5, which is then shown in black.

Note that the bonus figure isn't added to your total, but it simply indicates your progress towards the bonus target. The aim is to achieve a non-negative bonus figure when all six of these options have been filled, and if you do this you get a bonus of fifty points which is added to your total.

If you do particularly well in the top section, you may get your bonus before you've filled all six of these options. For example, suppose you have a bonus figure of +2 with just the 'Twos......' and 'Fives.....' options remaining. If you then put four fives into 'Fives.....' you get the fifty point bonus straight away. The reason for this is because the four fives take your bonus figure to +7, and with only the 'Twos......' left, the worst you can do is reduce your bonus figure by 6 to +1.

When all the players have filled all their options, the game finishes and the dice window disappears. The winner is the player with the highest total. If anyone gets onto the high score table, the high score window appears with the player highlighted.

Now back to the main menu, starting with the second entry:

'Finish game' - Choosing this will end the current game.

'Undo turn' - Choosing this will undo the last move.

'New player' - This has a submenu that allows you to enter a new player.

'Player leave' - This has a submenu which lists all the current players, and choosing a player from this menu removes then from the game. Note that both the 'New player' and 'Player leave' options are shaded out during a game.

'High scores' - This entry has a submenu (see below) which gives control over the high score table.

'Init players' - If you regularly play Yahtzee with the same players, this entry allows you to set up the application so that it always starts with these players. The submenu is a window with six writable icons into which you can enter six names. When you've done this, click on the SAVE icon and the names will be saved to disc ready for the next time you play.

The high score menu consists of four entries:

'Show' - Choosing this entry will open the high score window.

'Save' - Choosing this entry will save the current high scores to disc.

'Auto save' - When this option is on (indicated by a tick), any change in the high score table is automatically saved to disc. The state of the option is also stored on disc, so when it's toggled on or off the new state is always saved to disc.

'Zero scores' - Choosing this entry will wipe the high scores, although the application asks for confirmation before this goes ahead.

 RISC User 1992
