Poker Dice Game
by G.N. Steeper

N.B. This application requires Trinity.Medium font. If you are running it on RISC OS 2 you must ensure that the font is available, otherwise an error will be generated. With RISC OS 3, Trinity.Medium is in ROM and therefore always available.

The game is designed to be run in a 256-colour mode. If your computer's monitor type is configured to 1 (multi-sync) then mode 21 will be selected. If the monitor type is 3 (VGA) then mode 28 will be selected. Otherwise mode 15 will be selected. In mode 28 a small amount of the playing area will be lost at the top and side of the screen, since the screen co-ordinates for thismode are different from the others. This will not affect the playing of the game.

Poker Dice is an implementation of the popular dice game. The game is played by one player against the computer. Running the program displays the screen showing the playing area. Initially each player has nine lives, and each player's current number of lives remaining is shown at the sides of the screen. A random generator decides which player goes first - this is shown at the bottom of the screen. The players take it in turns to throw the dice; when it is the computer's turn, the throw is made automatically after a short delay, while the human player must press the space bar to throw, as prompted on the screen.

The object of the game is to throw five "dice", which are represented on the screen by sprites, and attempt to beat the other player's existing score. Each die has 6 faces: 9, 10, Jack, Queen, King and Ace. Scoring combinations are ranked in ascending order as follows:
  Ace high
  One Pair
  Two Pairs
  Three of a Kind
  Low Run (9,10,J,Q,K)
  High Run (10,J,K,Q,A)
  Full House
  Four of a Kind
  Five of a Kind
  
The first player throws the dice, whereupon a random generator simulates a throw of real dice; in other words, the five sprites displayed are the five faces which would be uppermost on the dice when they have come to rest. The second player now re-throws to see if he can better the first player's score; he does not need to throw all the dice and may hold any of those on display by using the function keys as prompted on the screen. This continues, with players taking alternate throws, until one player fails to better the other's score; that player then loses one of his lives, and the throwing sequence is restarted with fresh dice, the loser throwing first.

If a player throws a combination which ranks equal to the previous player's throw, then the values of the dice making up the combination are taken into account; in other words, three kings is higher than three jacks. If the scoring dice are the same value, then the other dice are taken into account; for example, four tens and an ace would be higher than four tens and a king.
  
If Five of a Kind is thrown, a special sequence comes into effect: the other player is given five throws in which to match or better the score, and if he fails, he loses a life.

A typical game might proceed as follows: player 1 throws two tens, a jack, a queen and an ace (One Pair). Player 2 holds the tens and re-throws the other three dice, producing a further ten plus a nine and a king (Three of a Kind). Player 1 then holds the three tens and re-throws the other two, giving two queens (Full House). Player 2 holds the three tens and re-throws the two queens, producing another ten plus a king (Four of a Kind). Up until this point each player has beaten the other's score with each throw. Player 1 now holds the four tens and throws the remaining die to get a queen. His four tens and a queen is lower than player 2's four tens and a king, so player 1 loses a life.
