's WiLiKi

れさぴょん(lesserpyon)をいじってみる




書籍


Linux (CentOS5) + gcc でコンパイルする

kyokumen.h:340: error: extra qualication ‘TsumeHash::’ on member ‘CalcHand’

$ make
gcc -D_GCC_ -c KomaMoves.cpp
kyokumen.h:340: error: extra qualification ‘TsumeHash::’ on member ‘CalcHand’
make: *** [KomaMoves.o] エラー 1

ヘッダーでメンバー関数をクラス名で修飾すると出る。gcc4.1から厳しくなったらしい。

diff -uNr lesserpyon.orig/kyokumen.h lesserpyon/kyokumen.h
--- lesserpyon.orig/kyokumen.h  2011-05-30 04:36:07.000000000 +0900
+++ lesserpyon/kyokumen.h       2011-05-30 04:41:19.000000000 +0900
@@ -337,7 +337,7 @@
        static uint64 HI_BIT_TBL[3];
        static TsumeVal *FindFirst(uint64 KyokumenHashVal);
        static TsumeVal *FindNext(TsumeVal* Now);
-       static uint64 TsumeHash::CalcHand(int Motigoma[]);
+       static uint64 CalcHand(int Motigoma[]);
 public:
        static void Clear();
        static void Add(uint64 KyokumenHashVal,uint64 HandHashVal,int Motigoma[],int mate,Te te);

漢字のバイト数を2固定で計算している部分がある

--- lesserpyon.orig/kyokumen.cpp        2011-05-30 04:36:07.000000000 +0900
+++ lesserpyon/kyokumen.cpp     2011-05-30 05:28:20.000000000 +0900
@@ -825,7 +825,7 @@
        for (x = EHI; x >=EFU; x--) {
                if (Hand[x] > 1) {
                        y = 1;
-                       fprintf(fp,"%s%2.2s", komaStr2[x], "一二三四五六七八九101112131415161718"+2*Hand[x]-2);
+                       fprintf(fp,"%s%2.2s", komaStr2[x], "1 2 3 4 5 6 7 8 9101112131415161718"+2*Hand[x]-2);
                } else if (Hand[x] == 1) {
                        y = 1;
                        fprintf(fp,"%s", komaStr2[x]);
@@ -843,7 +843,7 @@
                for(x=9;x>=1;x--) {
                        fprintf(fp,komaStr[ban[x*16+y]]);
                }
-               fprintf(fp,"|%2.2s","一二三四五六七八九" + y*2-2);
+               fprintf(fp,"|%3.3s","一二三四五六七八九" + y*3-3);
                fprintf(fp,"\n");
        }
        fprintf(fp,"+---------------------------+\n");
@@ -852,7 +852,7 @@
        for (x = SHI; x >= SFU; x--) {
                if (Hand[x] > 1) {
                        y = 1;
-                       fprintf(fp,"%s%2.2s", komaStr2[x], "一二三四五六七八九101112131415161718"+2*Hand[x]-2);
+                       fprintf(fp,"%s%2.2s", komaStr2[x], "1 2 3 4 5 6 7 8 9101112131415161718"+2*Hand[x]-2);
                } else if (Hand[x] == 1) {
                        y = 1;
                        fprintf(fp,"%s", komaStr2[x]);

盤面表示をKifu for Windowsに貼れる形式にする(空白を・で表す)

--- ../lesserpyon.orig/KomaMoves.cpp    2011-05-30 04:36:07.000000000 +0900
+++ KomaMoves.cpp       2011-07-19 12:30:42.000000000 +0900
@@ -194,7 +194,7 @@

 // 駒を盤面に表示するための文字列
 char *komaStr[]={
-"   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ",
+" ・","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ",
 "   "," 歩"," 香"," 桂"," 銀"," 金"," 角"," 飛"," 王"," と"," 杏"," 圭"," 全"," 金"," 馬"," 龍",
 "   ","v歩","v香","v桂","v銀","v金","v角","v飛","v王","vと","v杏","v圭","v全","v金","v馬","v龍",
 " 壁","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ",

LAN対戦時処理が変

この部分、ss=3 と代入するつもりではないはず。

--- lesserpyon/main.cpp 2011-10-28 08:05:43.000000000 +0900
+++ sakurapyon/main.cpp 2011-10-28 07:57:36.000000000 +0900
@@ -595,7 +595,7 @@
                                        if (strcmp(buf,"%TORYO")==0) {
                                                te=Te(0);
                                        } else {
                                                if (ss<2) continue;
                                                if (from<OU) {
                                                        koma=SorE|from;
@@ -604,7 +604,7 @@
                                                        koma=k.ban[from];
                                                }
                                                capture=k.ban[to];
-                                               if (ss=3 && promote[0]=='*') {
+                                               if (ss==3 && promote[0]=='*') {
                                                        te=Te(from,to,koma,capture,1);
                                                } else {
                                                        te=Te(from,to,koma,capture,0);

読みの深さ

main.cpp:278 あたりの depthMax=5。最大はMAX_DEPTHの32。 手元のCPUだとdepthMax=7のときは終盤で1手30秒を超える。

定跡ファイル

うさぴょんの配布バイナリの public.bin を shogi のあるディレクトリにコピーする。これを行わないと、初手から考える。

先人の知恵

参考資料

バグらしきもの

高速化

細かい高速化

手生成

強くするために

int Kyokumen::Eval(const int pos)

持ち駒:なし
  9 8 7 6 5 4 3 2 1
+---------------------------+
|v香v桂 ・ ・ 銀 ・v金v桂v香|一
| ・v王v飛 ・ ・ ・v歩 ・ ・|二
| ・v銀 ・v金 ・ 馬 ・ ・ ・|三
|v歩 ・v歩 ・ ・ ・ ・ ・v歩|四
| ・v歩 ・ ・v角 ・ ・ ・ ・|五
| ・ ・ 歩 ・v歩 ・ 歩v歩 歩|六
| 歩 歩 銀 ・ 歩 歩 銀 ・ ・|七
| ・ ・ 王 金 金 ・ ・ 飛 ・|八
| 香 桂 ・ ・ ・ ・ ・ 桂 香|九
+---------------------------+
持ち駒:歩四

リンク








[トップ] / [最近の更新] [一覧] [編集履歴] [RSS]
Last modified : 2011/11/05 04:10:13 JST
WiLiKi 0.5.3 running on Gauche 0.9.4