Technical implementation

a: .scr file (name1, name2, name3, name4, (nx: eh, sh, wh, nh, round+hstat), score1, score2, score3, score4)

b: .sts file = stats (games, hands, wos (not out),  4x: name, wins, mjs, lims, totmj, totnmj, pungs, mpungs, cpungs, dbls)

c: .sts (see b)

d: mjrules (strings:#index-200


The heart of the mahjong score program, is the mj_rules datbase table. It contains all rules for the game. It can contain multiple rulesets according to which mahjong can be played. The user selects a ruleset.

After the user has indicated the combinations at hand, the program will assign rules to the given combination. A example of a rule is "concealed pung". If it finds a match, it will query the database for the unique rulenumber assigned to the rule (in the given ruleset), and evaluate the data (scores, doubles, actions) in the ruleset.


Overzicht van database tabellen

games

Current games (gamesets)

  • id
  • ruleset_id
  • password
  • p1_id
  • p2_id
  • p3_id
  • p4_id
  • p1_total_score
  • p2_total_score
  • p3_total_score
  • p4_total_score
  • cur_round (also prevailing wind)
  • cur_wall
  • last_played_datetime

gamescores

Results of previous games, related to current games (gamesets)

  • id
  • game_id
  • num_walls
  • p1_totalscore
  • p2_totalscore
  • p3_totalscore
  • p4_totalscore
  • start_datetime
  • end_datetime

players

Overview of the players, and statistics about their scores
  • id
  • name
  • e-mail
  • last_played_datetime
  • num_walls
  • num_game_wins
  • last_game_win_datetime
  • total_score
  • max_score
  • max_score_datetime
  • num_mjs
  • num_limits
  • score_mjs
  • score_nmjs
  • num_pungs
  • num_spec_pungs
  • num_closed_pungs
  • num_doubles

scores

Overview of results for every round (wall) and every player
Contains intial record with player winds and start scores. No hands.

  • game_id
  • player_id
  • round (also prevailing wind)
  • wall_num
  • played_datetime
  • finished (yes or no)
  • combo1 (type, closed, pattern, suite, value)
  • combo2 (type = pair, chow, pung, kong, limit)
  • combo3 (closed = y,n)
  • combo4 (pattern=value,r dragon,g dragon, w dragon, e, s, n, w)
  • combo5 (suite = characters, bamboo, dots)
  • combo6 (value = 1-9)
  • combo7 (if limit: limit type (=rule num))
  • season1 (flower, season, both)
  • season2
  • season3
  • season4
  • mahjong (y,n)
  • last_tile_type (discard, wall, loose (roof), last wall (sea), last discard (river), robbed kong, first discard of east, own tile (east), kong on kong)
  • last_tile (pattern, suite, value (see above))
  • hand_type (all honours, one suit, clear suite (with winds/dragons), rubbish)
  • players_wind (e, s, n, w)
  • punishment_type
  • punisment_score
  • hand_score (total score for this player, this round)
  • accumulated_score (in relation to other players, this round)
  • num_doubles
  • players_data_filled (y,n)

Versimpeling en verbreding bovenstaande tabel:

  • game_id
  • round (also prevailing wind)
  • wall_num
  • wind (e, s, n, w)
  • played_datetime
  • finished (yes or no)
  • num_doubles
  • hand (comma separated codes of stones)
  • rules (comma separated codes of rules that apply, in order of calculation)
  • starting_stone_per_rule (comma separated codes of first (lowest) stone per rule)
  • punishment_type
  • hand_score (total score for this player, this round)
  • accumulated_score (in relation to other players, this round)

rulesets

  • id
  • name
  • description

rules

  • id
  • ruleset_id
  • item_id (rule id, unique identification of the algorithm for this rule)
  • rule_order (order in which the rules are processed, generally from specific to generic)
  • name
  • score (score in points, when the rule is matched)
  • doubles (number of doubles when rule is matched)
  • mjonly (only for mahjong player?)
  • penalty_type
  • action (special action description when rule matched, examples like next round wind, turn winds)
  • rule_type (score, penalty, rule_explanation, ui_string)
  • description (description for rule overview)
  • explanation (explanation of rule (technical for rule designers)

Actions

The following actions are possible in the "actions" field:

  • None
  • Stop counting
  • Turn of hands
  • Change of prevailing wind
  • Game over