ElephantEye Modified

ElephantEye是个开源象棋引擎。修改了下皮毛:

  • 用TDM-GCC编译,使用SSE3指令,比VC6编译出来的代码快。counting the number of 1-bits
  • 几十个元素时,插入排序可能是最快的。MoveStruct里wvl改为int. VC6的sort不是传说的那么差嘛
  • 虽然处理开局库的book.cpp调用次数很少,但不改不舒服斯基。和ELEEYE.EXE使用同一个BOOK.DAT.
  • 能用全局变量就不传函数参数。
  • 总之,程序应该跑得更快了一点点。同样时间,能多搜一点局面,理论上棋力会高一点点?
  • 增加Makefile,可用VC6的NMAKE.
  • 象棋巫师设置引擎级别时,单位是分钟。改成了无论是go depth还是go nodes,都强行go time. 默认是5000毫秒,该数从eemod.exe所在目录下的timelimit.txt里读入。
  • 增加eval命令:if (StartsWithAndSkip(p, "eval")) printf("score %d\n", Evaluate(-MATE_VALUE, MATE_VALUE));

    双方14种棋子可用4位表示。9x10x4位, 360位可精确表示任一局面。128位的Zobrist Hasing应该重复很少了(“不是火箭科技”—走错棋咋了?)。再加上16位的score,共18个字节,1千亿个局面是1.8TB. Sorting 1 terabyte was done in 3.48 minutes in 2008 by Yahoo! Inc. with 910 x 4 dual-core processors, but sorting 494.6 terabytes was done in the same amount of time in 2013 with 2100 nodes x hexa-core processors. 那就是27万亿个局面。:-) TeraSort hex是16, 3940个 vs 33,600个, 1 vs 494.6. 窃以为500行程序+5TB模型会挺厉害。:-) Alpha-Beta可是family啊。目前安装包最大的十款游戏,第一名275GB.

https://files.cnblogs.com/files/blogs/714801/EEMod.7z  63KB  含源码和.exe

Makefile:

# ElephantEye - a Chinese Chess Program (UCCI Engine)
# Designed by Morning Yellow, Version: 3.0, Last Modified: Nov. 2007
# Copyright (C) 2004-2007 www.elephantbase.net
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
#
# ElephantEye源程序使用的匈牙利命名法约定:
# sq: 格子序号(整数,从0到255)
# pc: 棋子序号(整数,从0到47)
# pt: 棋子类型序号(整数,从0到6)
# mv: 着法(整数,从0到65535)
# sd: 走子方(整数,0代表红方)
# vl: 局面价值(整数,从"-MATE_VALUE"到"MATE_VALUE")
# (注:以上四个记号可与uc、dw等代表整数的记号配合使用)
# [注:uc,dw等能删尽删。“匈牙利命名法”不是褒义词]
# pos: 局面(Position)
# sms: 位行和位列的着法生成预置结构
# smv: 位行和位列的着法判断预置结构
#
## 没有用高级语法,所以用NMAKE.EXE也行
H=ee.h
O=evaluate.o main.o move.o position.o tables.o
eemod.exe : $(O)
	g++ -o $@ $(O)
	strip -s $@

.cpp.o:
	g++ -c -m32 -msse3 -Ofast -DNDEBUG -Wall $<

*.cpp:$(H)

clean:
## Make ignores the returned status on command lines that begin with a dash.
## .BAT文件@打头的命令不echo
	-@del/q *.o
View Code

TDM-GCC is a compiler suite for Microsoft Windows. It is a commonly recommended compiler in many books, both for beginners and more experienced programmers. It combines the most recent stable release of the GCC toolset, a few patches for Windows-friendliness, and the free and open-source MinGW runtime APIs to create an open-source alternative to Microsoft's compiler and platform SDK. It is able to build 32-bit or 64-bit binaries, for any version of Windows since Windows 98.

posted @ 2022-12-15 20:18  Fun_with_Words  阅读(45)  评论(0编辑  收藏  举报









 张牌。