mahjong_score

It is a package that calculates the score of Mahjong. Scores are calculated based on "hu" and "fan". It should be noted that this package does not distribute points to each player, so you need to implement it yourself.

Usage

BasePoint class

‘BasePoint’ is a class that handles the base points of points calculated by ‘hu’ and ‘fan’.

import 'package:mahjong_score/score.dart';

final basePoint = BasePoint(hu: 30, fan: 4);
Argumentdescription
hu符点数 int
fan翻点数 int

FixedPoint class

‘FixedPoint’ deals with base points such as ‘Mangan’ and ‘Yakuman’ that do not calculate ‘hu’ and ‘fan’. You can get an instance from the FixedPointType defined in the Enum.

import 'package:mahjong_score/score.dart';

final fixed = FixedPointType.value;
final mangan = FixedPointType.Mangan.detail;

Score class

The ‘Score’ class is from the calculated base point We will handle the points to be finally handed over in consideration of the way the game ended.

import 'package:mahjong_score/score.dart';

final score = Score(
  abstractPoint: basePoint,
  isHost: false,
  isPicked: false,
  consecutivelyConut: 0,
);
Argumentdescription
abstractPointClass that inherits abstractPoint
isHostWhether the winner is a parent
isPickedThe winner end with'Tsumo'
consecutivelyCountNumber of consecutive Hosts

Libraries

abstract
base
fixed
score