Skip to content

Commit

Permalink
final_score command use Chinese rules by default
Browse files Browse the repository at this point in the history
  • Loading branch information
breakwa11 committed Nov 14, 2018
1 parent 4f6dbb0 commit 6a935d7
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
请参考gtp指令手册(http://www.lysator.liu.se/~gunnar/gtp/)或者使用sabaki等图形界面工具
2. 如果使用zen6的zen.dll,需要设置参数 gtp4zen.exe -z6
3. gtp4zen.exe所在的文件夹如果存在gtp4zen.lua,命令行-T参数自动失效并使用gtp4zen.lua的时间控制,
这个脚本用于精细化时间控制,如果不明白用途可以★★删除★★gtp4zen.lua,默认★★文件存在并生效★★
这个脚本用于精细化时间控制,如果不明白用途可以删除gtp4zen.lua,文件存在即表示生效
4. gtp4zen.exe --help输出帮助,-t是线程数(默认和cpu核数量相同),-T最大思考时间,-s最大计算步数,-l指定log文件,-d会输出调试信息到gtpshell,帮助信息如下:

C:\Users\clock\Desktop>gtp4zen.exe --help
Expand Down
5 changes: 5 additions & 0 deletions gtp4zen/gtp4zen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ float g_think_level_1 = 1.0;
float g_think_level_2 = 1.0;
int g_think_level_0 = 1;
int g_resign = 10;
bool g_chinese_rule = true;

#ifdef _DEBUG
string g_logfile = "gtp4zen_log.txt";
Expand Down Expand Up @@ -70,6 +71,7 @@ int _tmain(int argc, _TCHAR* argv[])
("logfile,l", value<string>(), "Enable logging and set the log file. (default none)")
("logfilenametime,L", "Add timestamp after log filename. (default off)")
("debug,d", "Enable debug output to gtp shell. (default off)")
("jpn_rules", "Set to Japanese rules. (default Chinese rules)")
;
/*
选项 -t -T -M -m -l -k -w -s -f
Expand Down Expand Up @@ -141,6 +143,9 @@ int _tmain(int argc, _TCHAR* argv[])
if (vm.count("logfile")) {
g_logfile = vm["logfile"].as<string>();
}
if (vm.count("jpn_rules")) {
g_chinese_rule = false;
}

if (error_options) {
cerr << "ERROR: unknown, check by gtp4zen --help" << endl;
Expand Down
1 change: 1 addition & 0 deletions gtp4zen/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ extern float g_think_level_1;
extern float g_think_level_2;
extern int g_think_level_0;
extern int g_resign;
extern bool g_chinese_rule;

extern int __ansi2num(char ch);
extern std::string __num2ansi(int x, int y, int boardsize);
Expand Down
49 changes: 36 additions & 13 deletions gtp4zen/zen6gtp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,25 +102,48 @@ std::string CZen6Gtp::score()
{
int territory[19][19];
((_zen_dll_proxy*)m_proxy)->ZenGetTerritoryStatictics(territory);
float moku_w = ((_zen_dll_proxy*)m_proxy)->ZenGetNumWhitePrisoners(), moku_b = ((_zen_dll_proxy*)m_proxy)->ZenGetNumBlackPrisoners();
for (int j = 0; j < ((_zen_dll_proxy*)m_proxy)->m_boardsize; ++j)
float moku_w = 0, moku_b = 0;
if (g_chinese_rule)
{
for (int i = 0; i < ((_zen_dll_proxy*)m_proxy)->m_boardsize; ++i)
for (int j = 0; j < ((_zen_dll_proxy*)m_proxy)->m_boardsize; ++j)
{
int color = ((_zen_dll_proxy*)m_proxy)->ZenGetBoardColor(i, j);
if (territory[j][i] <= -500)
for (int i = 0; i < ((_zen_dll_proxy*)m_proxy)->m_boardsize; ++i)
{
if (color == 2)
moku_w += 2;
else if (color == 0)
int color = ((_zen_dll_proxy*)m_proxy)->ZenGetBoardColor(i, j);
if (territory[j][i] <= -500)
{
moku_w += 1;
}
else if (territory[j][i] >= 500)
{
moku_b += 1;
}
}
else if (territory[j][i] >= 500)
}
}
else
{
moku_w = ((_zen_dll_proxy*)m_proxy)->ZenGetNumWhitePrisoners();
moku_b = ((_zen_dll_proxy*)m_proxy)->ZenGetNumBlackPrisoners();
for (int j = 0; j < ((_zen_dll_proxy*)m_proxy)->m_boardsize; ++j)
{
for (int i = 0; i < ((_zen_dll_proxy*)m_proxy)->m_boardsize; ++i)
{
if (color == 1)
moku_b += 2;
else if (color == 0)
moku_b += 1;
int color = ((_zen_dll_proxy*)m_proxy)->ZenGetBoardColor(i, j);
if (territory[j][i] <= -500)
{
if (color == 2)
moku_w += 2;
else if (color == 0)
moku_w += 1;
}
else if (territory[j][i] >= 500)
{
if (color == 1)
moku_b += 2;
else if (color == 0)
moku_b += 1;
}
}
}
}
Expand Down
49 changes: 36 additions & 13 deletions gtp4zen/zen7gtp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,25 +103,48 @@ std::string CZen7Gtp::score()
{
int territory[19][19];
((_zen_dll_proxy*)m_proxy)->ZenGetTerritoryStatictics(territory);
float moku_w = ((_zen_dll_proxy*)m_proxy)->ZenGetNumWhitePrisoners(), moku_b = ((_zen_dll_proxy*)m_proxy)->ZenGetNumBlackPrisoners();
for (int j = 0; j < ((_zen_dll_proxy*)m_proxy)->m_boardsize; ++j)
float moku_w = 0, moku_b = 0;
if (g_chinese_rule)
{
for (int i = 0; i < ((_zen_dll_proxy*)m_proxy)->m_boardsize; ++i)
for (int j = 0; j < ((_zen_dll_proxy*)m_proxy)->m_boardsize; ++j)
{
int color = ((_zen_dll_proxy*)m_proxy)->ZenGetBoardColor(i, j);
if (territory[j][i] <= -500)
for (int i = 0; i < ((_zen_dll_proxy*)m_proxy)->m_boardsize; ++i)
{
if (color == 2)
moku_w += 2;
else if (color == 0)
int color = ((_zen_dll_proxy*)m_proxy)->ZenGetBoardColor(i, j);
if (territory[j][i] <= -500)
{
moku_w += 1;
}
else if (territory[j][i] >= 500)
{
moku_b += 1;
}
}
else if (territory[j][i] >= 500)
}
}
else
{
moku_w = ((_zen_dll_proxy*)m_proxy)->ZenGetNumWhitePrisoners();
moku_b = ((_zen_dll_proxy*)m_proxy)->ZenGetNumBlackPrisoners();
for (int j = 0; j < ((_zen_dll_proxy*)m_proxy)->m_boardsize; ++j)
{
for (int i = 0; i < ((_zen_dll_proxy*)m_proxy)->m_boardsize; ++i)
{
if (color == 1)
moku_b += 2;
else if (color == 0)
moku_b += 1;
int color = ((_zen_dll_proxy*)m_proxy)->ZenGetBoardColor(i, j);
if (territory[j][i] <= -500)
{
if (color == 2)
moku_w += 2;
else if (color == 0)
moku_w += 1;
}
else if (territory[j][i] >= 500)
{
if (color == 1)
moku_b += 2;
else if (color == 0)
moku_b += 1;
}
}
}
}
Expand Down

0 comments on commit 6a935d7

Please sign in to comment.