(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:
Scoring:
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.
USE OF THE PROGRAM
Code:
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 |
|||
11-15-2018, 03:24 PM
(This post was last modified: 11-15-2018 09:07 PM by Albert Chan.)
Post: #2
|
|||
|
|||
RE: (11C) Mahjong scores
(11-14-2018 08:47 PM)Rogier Wrote: Scoring: I have not heard of this mahjong variant ... what is it ? The scoring rules looks confusing. Example: first rule, EAST pays (with what ? points ?) *and* receives double points ... A worked out example might clear things up. An example with EAST wins, another with other players win ... When the game ended, does the whole pot, still added to 40 thousand points ? If yes, the code only need to track 3 players ... |
|||
11-15-2018, 09:47 PM
(This post was last modified: 11-16-2018 10:28 PM by Rogier.)
Post: #3
|
|||
|
|||
RE: (11C) Mahjong scores
This is not the puzzle-style Mahjong. It's quite a complex game, with a lot of rules but it's fun. I will try and explain it in brief.
In this game the tiles are laid out in a square forming four walls 18 tiles long an 2 tiles high. By throwing dice the player who will be EAST for the first game is established and this player trhows dice to determine in which wall dealing will begin. The ' owner' of that wall throws dice te determine at which spot the dealing of tiles will begin. Three players start out with 13 tiles, East starts out with 14. He will discard the fist tile. After that the players take turns drawing a tile. You may take a tile from the wall, but under circumstances you may also claim a discarded tile.
A winning combination is a combination of 14 tiles consisting of 4 triplets and 1 pair of identical tiles. If all players agree you can also accept other combinations as winning, like 7 "twins". Winning games have all sorts of beautiful Chinese names, which I don't know. Triplets can be a combination of 3 identical tiles (like 3 times 3 bamboo) of 3 different tiles of the same colour and in ascending order (eg sign3-sign4-sign5). The first variety is called Pung, the second is called Tsjou. In some cases a Pung may be extended to a quadruplet, called Kong. In that case the player must take 1 extra tile from the wall (otherwise you can't win anymore). If the tile completing a pung/kong was discarded by another player, the pung/kong is laid out on the table. Ifs the player took the tile from the stock, the tiles are kept hidden. A tsjou scores no points, a kong scores double what a pung would do, hidden pungs and kongs score double points. Example. WEST wins with this hand: 3X 7 of signs (in the hand) 3X 2 of signs (on table) 3X West wind (in the hand) 3X Red dragon (on the table) 2X North wind The winning tile was North wind, discarded by another player This would score: 2 points for the 2's of signs 4 points for the 7's of sings (hidden scores double) 4 points for the Red dragons (dragons and winds score double) 8 points for the West winds (hidden scores double) Bonus for only way to win: 2 points Bonus for winning: 20 points Total so far: 40 points This score is doubled for: Pung of Red dragon: 1 (pungs and kongs of dragons do that) Only one suit (so: no circles or bamboos) + honours (winds and dragons): 1 Pung of West wind: 1 (but only because our winner is WEST.) So final score = 8x40 points = 320 points. Now for the whole table: EAST: 8 points SOUTH: 20 points WEST: 320 points (Winner) NORTH: 64 points Result (and this is what the program takes care of): > SOUTH and NORTH pay WEST 320 points, EAST pays WEST 640 points > SOUTH receives 2x(20-8) = 24 points from EAST > SOUTH pays 64-20 = 44 points to NORTH > EAST pays 2x(64-8) = 112 points to NORTH EAST did not win, so the winds rotate. In the next game our winner will be SOUTH. There are numerous game variants and various ways of scoring, but this is the system we use. See also: https://en.m.wikipedia.org/wiki/Mahjong BTW: you are right about the total points. It's a closed system, so knowing 3 players should be enough, but only for the 'grand totals'. Points scored per game is not a closed system. I found it easier to keep the values for all 4 players. If I want to check a ' credit status' I just Rcl 1-4. If I only kept score on 3 players I would need an extra piece of code to calculate the fourth. HP 33E, HP 11C, HP 48 SX, HP 35S |
|||
11-16-2018, 05:26 PM
(This post was last modified: 11-17-2018 12:40 PM by Albert Chan.)
Post: #4
|
|||
|
|||
RE: (11C) Mahjong scores
(11-15-2018 09:47 PM)Rogier Wrote: ... Now for the whole table: Above cross exchange of points (from everyone) looks complicated. Maybe it can be simplified a bit by removing EAST calculation. players = {SOUTH, WEST, NORTH} points = {20, 320, 64} let c = sum(points) + 2*(EAST point) = 20 + 320 + 64 + 2*8 = 420 We use c to handle cross exchanges. Since WEST won, exchange = {c, 0, c} scores = 4*points - exchange = 4 * {20, 320, 64} - {420, 0, 420} = {-340, +1280, -164} EAST score = -sum(scores) = -(-340 + 1280 - 164) = -776 Can you provide an example where EAST win ? My guess is, this should work (EAST win 6X his points): scores = 3*points - c |
|||
11-16-2018, 10:26 PM
(This post was last modified: 11-16-2018 10:56 PM by Rogier.)
Post: #5
|
|||
|
|||
RE: (11C) Mahjong scores
The cross-exchange is complicated. That' s why my first efforts didn't fit. It's just too cumbersome. The example is the way it's done by hand, the old fashioned way with chips of bone representing money.
The fastest way we came up with is:
Maybe your idea comes down to the same. Now, presume in my example EAST wins: EAST: 28 points (at least 20 more; bonus for winning. Let's keep it at that) SOUTH: 20 points WEST: 144 points (8*22 points less, because no bonuses for winning and winning tile) NORTH: 64 points Result: > SOUTH, NORTH and WEST each pay 2x28= 56 points to EAST > NORTH pays 144-64 = 80 points to WEST > SOUTH pays 64-20 = 44 points to NORTH > SOUTH pays 144-20 = 124 points to WEST All in all: > EAST gains 3x2x28 = 168 points > SOUTH loses 56 + 44 +124 = 224 points > WEST gains (124 + 80) - 56= 148 points > NORTH loses 44 - (56 + 80) = 92 points check: 168 + 148 - 224 - 92 = 0 HP 33E, HP 11C, HP 48 SX, HP 35S |
|||
11-17-2018, 12:01 AM
Post: #6
|
|||
|
|||
RE: (11C) Mahjong scores
(11-16-2018 10:26 PM)Rogier Wrote: Now, presume in my example EAST wins: Thanks, Rogier So, the guessed formula is correct: scores = 3*points - c c = 20 + 144 + 64 + 2*28 = 284 EAST won, so scores = 3 * {20, 144, 64} - 284 = {-224, +148, -92} EAST score = -(-224 + 148 - 92) = +168 My setup is almost the same as yours, except EAST score is derived from others. This simplified coding, since EAST had very different rules than others. Example: what if NORTH was the winner ? scores = 4 * {20, 144, 64} - {284, 284, 0} = {-204, +292, +256} EAST score = -(-204 + 292 + 256) = -344 WEST, not a winner, gain most points ! WEST, gain points no matter who win !! |
|||
11-17-2018, 10:10 AM
(This post was last modified: 11-17-2018 10:19 AM by Rogier.)
Post: #7
|
|||
|
|||
RE: (11C) Mahjong scores
Albert,
You are right. That is really interesting. Now the question is of course: will that lead to a more compact program? I'll give it a try. BTW: As my example shows you don't have to win to earn points. This leads tot 2 basic playing styles:
HP 33E, HP 11C, HP 48 SX, HP 35S |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)