20 lines
457 B
Dart
20 lines
457 B
Dart
|
|
import 'divination_params.dart';
|
||
|
|
|
||
|
|
class YaoCoinConverter {
|
||
|
|
const YaoCoinConverter._();
|
||
|
|
|
||
|
|
static YaoType fromHuaCount(int huaCount) {
|
||
|
|
return switch (huaCount) {
|
||
|
|
0 => YaoType.oldYin,
|
||
|
|
1 => YaoType.youngYang,
|
||
|
|
2 => YaoType.youngYin,
|
||
|
|
3 => YaoType.oldYang,
|
||
|
|
_ => throw ArgumentError.value(huaCount, 'huaCount', 'must be 0..3'),
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
static YaoType fromZiCount(int ziCount) {
|
||
|
|
return fromHuaCount(3 - ziCount);
|
||
|
|
}
|
||
|
|
}
|