HP Forums
(11C) Skat scoreboard with money counter - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (11C) Skat scoreboard with money counter (/thread-13222.html)



(11C) Skat scoreboard with money counter - Michael Zinn - 07-02-2019 12:06 PM

This is a scoreboard for Skat (3 player game). It also accounts for money that the losers have to pay to the group's cash box.

USER GUIDE
1. Set the calculator to USER mode
2. Init with GSB 9
3. Select the currently playing player with A/B/C
4. When the game ends, enter the score and then press D (LOSE) or E (WIN) from the perspective of the playing player.

DISPLAY
The display looks like this: #.SSSSMMM where # is the player number, SSSS is the score and MMM is the amount of penalty money in cents.

PENALTY MONEY
If a player wins, the other two players get the points as penalty points.
If a player loses, they get the points * 2 as penalty points.
Penalty money is score divided by 4, rounded up to 10 cent increments.

Code:

R0 current player
R1-3 score player 1-3
R4 score to add 

LBL 1 ; init
  1
  STO 1
  2
  STO 2
  3
  STO 3
LBL A
  1
  GTO 5

LBL B
  2
  GTO 5

LBL C
  3
  GTO 5

LBL 5 ; Switch to player X
  STO 0
LBL 2 ; print current player R0
  RCL 0
  STO I
  RCL (i)
  RTN

LBL D ; lose -> twice bad points
  2
  *
  STO 4
  RCL 0
LBL 4 ; add score R4 to player X
  STO I
  RCL (i)
  FRAC  ; remove player number
  EEX
  4
  *
  RCL 4
  +
  INT ; remove money
  ENTER
  ENTER
  1  ;
  9  ; to round up instead of mathematically
  +  ;
  4
  EEX
  3
  /
  + ; append newly calculated money
  EEX
  4
  / ; shift all after decimal
  FIX 6
  RND   ; round up to 10 cent increments
  FIX 7
  RCL I
  + ; add player number
  STO (i)
  RTN

LBL E ; win: add points for losers
  STO 4
  1
   GSB 3
  2
   GSB 3
  3
   GSB 3
  GTO 2 ; print player R0

LBL 3 ; if X not current player then give R4 points
  RCL 0
  x<>y
  x#y
    GTO 4
  RTN