Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

手役计算错误 #32

Closed
zyr17 opened this issue May 14, 2022 · 0 comments
Closed

手役计算错误 #32

zyr17 opened this issue May 14, 2022 · 0 comments

Comments

@zyr17
Copy link
Contributor

zyr17 commented May 14, 2022

/* 牌型对/刻/杠,全幺九,不包括字牌,例如999p 1111m */
bool 纯老头(const string &s) {
if (s[2] == 'K' || s[2] == ':' || s[2] == '|') return s[0] == '1' || s[0] == '9';
return false;
}
bool 纯绿牌(const string &s) {
const char* green_types[] = {"2sK", "3sK", "4sK", "2sS", "6sK", "8sK", "6zK",
"2s:", "3s:", "4s:", "6s:", "8s:", "6z:" };
return all_of(begin(green_types), end(green_types),
[&s](const char* green) {return tile_group_match(s, green); });
}

纯老头和纯绿牌两个函数判断不正确,导致混老头会被误认为清老头,以及无法识别绿一色。
混老头例:https://tenhou.net/5/?log=2019051522gm-00a9-0000-8c64c236 南三局0本场
绿一色例:https://tenhou.net/5/?log=2019061604gm-00a9-0000-55019a3a 南一局1本场

/* 牌型对/刻/杠,全幺九,不包括字牌,例如999p 1111m */
bool 纯老头(const string &s) {
	if (s[2] == 'K' || s[2] == ':' || s[2] == '|') return (s[0] == '1' || s[0] == '9') && s[1] != 'z';
	return false;
}

bool 纯绿牌(const string &s) {
	const char* green_types[] = {"2sK", "3sK", "4sK", "2sS", "6sK", "8sK", "6zK",
		"2s:", "3s:", "4s:", "6s:", "8s:", "6z:", "2s|", "3s|", "4s|", "6s|", "8s|", "6z|", };

	return any_of(begin(green_types), end(green_types), 
		[&s](const char* green) {return tile_group_match(s, green); });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant