较高人工智能的人机博弈程序实现(多个算法结合)含C++源码
较高人工智能的人机博弈程序实现(多个算法结合)含C++源码本文由恋花蝶最初发表于http://blog.csdn.net/lanphaday上,您可以转载、引用、打印和分发等,但必须保留本文完整和包含本声明,否则必究责任。
到昨天晚上,Topcoder Marathon Match 6结束了,我取得了第18名的成绩,已经是自己参加Marathon四次以来的最好名次啦,高兴ing。因为这次的题目比较偏:写一个人工智能程序和服务器端的程序进行博弈。人机博弈是一门比较专的学科,大部分中国高手都不能快速的在比赛中学习和实现一些复杂的算法,以致成绩不太如意;我挟之前对这方面的了解,做得还算行,所以把代码公开出来,可以多一点中文方面的资料和源码给大家参考,我也感到非常荣幸。
比赛的题目请看这里:http://www.topcoder.com/longcontest/?module=ViewProblemStatement&rd=10118&pm=6759主要的游戏规则也是在这里的,我就不在这里重复啦,主要讲讲我的代码用到了什么算法。麻将虽小,五脏俱全,主要应用的算法有主要变量搜索(PVS)、历史启发(HH)、杀手启发(KH)、Null Move和迭代深化(ID),可惜后来不够时间实现置换表(TT),不然可以多一个算法了。代码里还实现了时间控制策略,可以几乎用尽20秒的测试时间,为争取更好的着法提供了保证。还有值得一提的是棋盘表示,我使用了棋盘表、棋子位置表结合的方式来表示,后来发现加上空位表的话,可以加快不少走法生成和估值的速度。反正棋盘表示是一切的基础,一种好的表示方法可以带来很大的性能提升。对于代码,大家注意class SE里的search_move和pvs两个函数,上述的算法和策略都在那里。class MG是关于棋盘表示、走法生成和估值的,class KH和class HH分别是杀手启发和历史启发。Null Move是简单有效的算法,不过我的实现里是比较简单的那种,如果有兴趣,可以查询其它资料。
讲了这么多,应该说一下这份代码的计算能力:以6*6的棋盘为例,这份代码在VC6的release模式下编译运行可以在1秒内搜索并评估83万个叶子节点,计算层次在8-9层;如果用MiniMax算法不进行剪枝,只能搜索到3-4层(测试机器皆为超线程P4 3.0G+1G内存)。这就是算法的力量吧。另声明一下,本代码未作优化,不代表我不懂,只是没有时间,看的朋友请海涵了。
下面是代码,在VC和G++上皆可编译、执行
因为比赛期间写的,代码比较乱,但整体的风格还是可以的,复制到IDE上看可能会更好看些
<div style="padding: 4px 5.4pt; width: 95%;">http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif#include<iostream>
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif#include<cstdlib>
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif#include<ctime>
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif#include<cassert>
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif#include<vector>
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif#include<algorithm>
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gifusingnamespacestd;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.giftypedefunsignedintUINT;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.giftypedefUINTMOVE;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gifconstintINFINITY=100000000;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gifconstintMAX_DEPTH=16;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gifconstUINTmax_board_size=256;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gifconstUINTmax_stones_cnt=256;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gifconstUINTempty=0;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gifconstUINTmy_color=1;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gifconstUINTsvr_color=2;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif#ifdefWIN32
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gifconstclock_tall_time=19200;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif#else
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gifconstclock_tall_time=19200000;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif#endif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gifconstUINTcheck_time_cnt=0x00001fff;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif#defineis_empty(x)(x==empty)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif#defineopp_color(x)(x==my_color?svr_color:my_color)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gifintleaf_cnt=0;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gifclassMG
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifprivate:
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifUINTN_;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifUINTboard_;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifUINTstones_;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifprivate:
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifvoidextend(UINTpos,unsignedchar*eht,unsignedchar*est,UINT&area,UINT&round);
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifpublic:
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifMOVEmove_table;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifUINTcurr_stones_cnt;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifUINTcurr_board_size;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gifvoidset_N(intn)...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifN_=n;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifcurr_board_size=n*n;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifcurr_stones_cnt=0;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifmemset(board_,0,sizeof(UINT)*max_board_size);
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifmemset(stones_,0,sizeof(UINT)*max_stones_cnt);
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gifvoidmake_move(intidx,intcolor)...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifboard_=color;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifstones_++]=idx;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gifvoidunmake_move(intidx)...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifboard_=empty;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif--curr_stones_cnt;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gifinlineboolis_game_over()...{returncurr_stones_cnt==curr_board_size;}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifUINTgen_move(intdepth);
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifintevaluatoin(intcolor);
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifintevaluatoin_4_end(intcolor);
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifvoidprint_board()
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifintcnt=0;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.giffor(UINTi=0;i<curr_board_size;++i)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifif(is_empty(board_))
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifcout<<"o";
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifelse
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifcout<<((board_==my_color)?"@":"-");
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif++cnt;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifif(cnt==N_)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifcnt=0;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifcout<<endl;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gifboolcan_move(MOVEmove)...{returnis_empty(board_);}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifvoidremove_killers(intdepth,intmove_cnt,MOVE*killers,intkillers_cnt)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.giffor(inti=0;i<killers_cnt;++i)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifMOVEm=killers;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.giffor(intj=0;j<move_cnt;++j)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifif(move_table!=m)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifcontinue;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.giffor(intk=j+1;k<move_cnt;++k)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifmove_table-1]=move_table;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifbreak;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif};
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gifUINTMG::gen_move(intdepth)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifintcnt=0;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.giffor(UINTi=0;i<curr_board_size;++i)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifif(is_empty(board_))
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifmove_table++]=i;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifreturncnt;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gifintMG::evaluatoin(intcolor)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifif(curr_stones_cnt+1==curr_board_size)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.giffor(inti=0;i<curr_board_size;++i)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifif(is_empty(board_))
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifboard_=color;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifintvalue=-evaluatoin_4_end(opp_color(color));
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifboard_=empty;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifreturnvalue;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif++leaf_cnt;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gifunsignedcharextended_hash_table=...{0};
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifintmy_score=0,svr_score=0;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.giffor(UINTi=0;i<curr_stones_cnt;++i)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifUINTpos=stones_;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifif(extended_hash_table)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifcontinue;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifUINTarea=0,round=0;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gifunsignedcharextended_space_table=...{0};
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifextend(pos,extended_hash_table,extended_space_table,area,round);
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifif(board_==my_color)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifmy_score+=area*area*round;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifelse
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifsvr_score+=area*area*round;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifif(color==my_color)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifreturnmy_score-svr_score;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifreturnsvr_score-my_score;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gifintMG::evaluatoin_4_end(intcolor)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif++leaf_cnt;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gifunsignedcharextended_hash_table=...{0};
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifintmy_score=0,svr_score=0;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.giffor(UINTi=0;i<curr_stones_cnt;++i)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifUINTpos=stones_;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifif(extended_hash_table)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifcontinue;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifUINTarea=0,round=0;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gifunsignedcharextended_space_table=...{0};
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifextend(pos,extended_hash_table,extended_space_table,area,round);
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifif(board_==my_color)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifmy_score+=area*area;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifelse
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifsvr_score+=area*area;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifif(color==my_color)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifreturnmy_score-svr_score;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifreturnsvr_score-my_score;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gifvoidMG::extend(UINTpos,unsignedchar*eht,unsignedchar*est,UINT&area,UINT&round)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifconstUINTround_cnt=4<span style="color: #000000;">;
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://www.agoit.com/bbs/http://images.csdn.net/syntaxhighlighting
页:
[1]