Post Reply 
(11C) Mahjong scores
11-14-2018, 08:47 PM (This post was last modified: 11-15-2018 09:12 AM by Rogier.)
Post: #1
(11C) Mahjong scores
Play and scoring characteristics:
Various variants of this game exist. This program was written to support score keeping according to the system I am used to.

Gameplay:
  • The players represent winds. When the game starts 1 = EAST, 2 = SOUTH, 3 = WEST, 4 = NORTH.
  • Each time someone other than EAST wins, the winds rotate counterclockwise. So if player 3 wins the first game, in the next game 1 = NORTH, 2 = EAST, 3 = SOUTH, 4 = WEST. And so on.

Scoring:
  • EAST pays and receives double points.
  • The winner pays nothing. The winner receives the number of points he/she scored from all other players. If EAST, the winner receives double points.
  • The other players receive their points scored from the other two. EAST pays and receives double.
  • When a games ends undecided no points are exchanged.

The program:
If you indicate who won and you input the scores for player 1, 2, 3 and 4, the program takes care of doubling for EAST and exchanging points between players. It also keeps track of the player who is EAST.

Notes:
Fitting this in the memory of an 11C proved tricky and my first efforts didn’t fit. In the end my brother in law worked out this system which I turned into a program with 9 lines to spare. It took us so long we didn’t have time left to play.
  • Each player receives 4 times the number of points he/she scored, unless EAST won, in which case he/she receives 3 times the number of points scored.
  • Each player pays the total number of points scored, except for the winner, who doesn’t pay at all, and EAST, who pays double


USE OF THE PROGRAM
  • Gsb 9: Starts new series of games, each player receives 10.000 points (lines 027-028, vary at will), player 1 = EAST, 2 = SOUTH, 3 = WEST, 4 = NORTH).
  • After each game:
    Indicate trough A / B / C / D who won. A = player 1 won, B = player 2 won, C = player 3 won, D = player 4 won. Then:
    1 > input points player 1 > r/s >
    2 > input points player 2 > r/s >
    3 > input points player 3 > r/s >
    4 > input points player 4 > r/s >
  • The calculator then displays 1 / 2 / 3 of 4 to indicate who is EAST in the following game
  • Do not do anything for games that end undecided!!


Code:

001    Lbl A    
002    5
003    GTO 0    
004    Lbl B
005    6
006    GTO 0    
007    Lbl C
008    7
009    GTO 0
010    Lbl D
011    8
012    GTO 0
013    Lbl 7
014    CF 0
015    Rcl I
016    x=y?
017    SF 0
018    0
019    F 0?
020    Rcl 0
021    Rcl 0
022    +
023    Rtn
024    Lbl 9
025    5
026    Sto I
027    EEX
028    4
029    Sto 1
030    Sto 2
031    Sto 3        
032    Sto 4
033    Rtn
034    Lbl 0
035    Sto 9
036    1
037    R/S
038    Sto 5
039    2
040    R/S
041    Sto 6
042    3
043    R/S
044    Sto 7
045    4
046    R/S
047    Sto 8
048    Rcl (i)
049    Sto + (i)
050    Rcl 5
051    Sto 0
052    3
053    Sto 5
054    Rcl 9
055    Rcl I
056    x=y?
057    GTO 2    
058    1
059    Sto + 5    
060    Lbl 2
061    Rcl 0
062    Rcl 5
063    *
064    Sto + 1    
065    Rcl 6
066    Sto + 0    
067    Rcl 5
068    *
069    Sto + 2    
070    Rcl 7
071    Sto + 0
072    Rcl 5
073    *
074    Sto + 3    
075    Rcl 8
076    Sto + 0    
077    Rcl 5
078    *
079    Sto + 4    
080    Rcl 9
081    5
082    x=y?
083    GTO 2    
084    GSB 7
085    Sto – 1    
086    Lbl 2
087    Rcl 9
088    6
089    x=y?
090    GTO 2
091    GSB 7
092    Sto – 2
093    Lbl 2
094    Rcl 9
095    7
096    x=y?
097    GTO 2
098    GSB 7
099    Sto – 3
100    Lbl 2
101    Rcl 9
102    8
103    x=y?
104    GTO 1
105    GSB 7
106    Sto – 4
107    Lbl 1
108    Rcl 9
109    Rcl I
110    x=y?
111    GTO 2
112    1
113    +
114    Sto I
115    8
116    x <=> y
117    x≤y?
118    GTO 2
119    5
120    Sto I
121    Lbl 2
122    4
123    –
124    Rtn


Used Registers:
I: EAST
R0: Total points scored
R1: Total player 1
R2: Total player 2
R3: Total player 3
R4: Total player 4
R5: Points scored by player 1 // replaced by 3 or 4 (muliplier for payments)
R6: Points scored by player 2
R7: Points scored by player 3
R8: Points scored by player 4
R9: Winner

Used Labels:
Lbl A: Player 1 wins
Lbl B: Player 2 wins
Lbl C: Player 3 wins
Lbl D: Player 4 wins
Lbl 0: Input points scored
Lbl 1: Determine EAST for next the game
Lbl 2: Simple jumps forward
Lbl 7: Calculates points to pay to each player
Lbl 9: Start new game

HP 33E, HP 11C, HP 48 SX, HP 35S
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(11C) Mahjong scores - Rogier - 11-14-2018 08:47 PM
RE: (11C) Mahjong scores - Albert Chan - 11-15-2018, 03:24 PM
RE: (11C) Mahjong scores - Rogier - 11-15-2018, 09:47 PM
RE: (11C) Mahjong scores - Albert Chan - 11-16-2018, 05:26 PM
RE: (11C) Mahjong scores - Rogier - 11-16-2018, 10:26 PM
RE: (11C) Mahjong scores - Albert Chan - 11-17-2018, 12:01 AM
RE: (11C) Mahjong scores - Rogier - 11-17-2018, 10:10 AM



User(s) browsing this thread: 1 Guest(s)