-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Labels
Description
Description
Some methods that are currently instance methods are essentially pure functions, so we propose to turn them into static methods.
These include:
-
Agari.is_agari() -
Shanten.calculate_shanten() -
Shanten.calculate_shanten_for_chiitoitsu_hand() -
Shanten.calculate_shanten_for_kokushi_hand() -
Shanten.calculate_shanten_for_regular_hand() -
HandDivider.divide_hand() -
HandDivider.find_pairs() -
HandDivider.find_valid_combinations() -
FuCalculator.calculate_fu() -
FuCalculator.round_fu() -
HandCalculator.estimate_hand_value() -
ScoresCalculator.calculate_scores() -
Aotenjou.calculate_scores() -
Aotenjou.aotenjou_filter_yaku()
Pros
- Eliminates the need to create instances for calculations.
- Since static methods can also be called from instances, there is basically no need to modify existing code.
Cons
- This may result in a slight slower execution speed, since local variables instead of fields are created and destroyed each time.
- This is a breaking change because some classes, such as
Shanten, have class variables defined without a leading underscore.