• PUDN用户
    了解作者
  • DOS
    开发工具
  • 1.7MB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 51
    下载次数
  • 2012-05-02 20:24
    上传日期
一个六子棋的小程序,采用六子棋标准对弈协议,在对弈平台下可以实现人机对弈或者程序间对弈。具有较好的棋力。
connect6.zip
  • 课后作业
  • SimpleConnect6
  • Debug
  • main.sbr
    241.7KB
  • SimpleConnect6.ilk
    835.5KB
  • SimpleConnect6.pch
    2.1MB
  • EvaluateSystem.sbr
    123.2KB
  • SimpleConnect6.pdb
    1.1MB
  • vc60.pdb
    116KB
  • vc60.idb
    89KB
  • EvaluateSystem.obj
    50KB
  • main.obj
    384.3KB
  • SearchEngine.obj
    15.7KB
  • MoveGenerator.obj
    13.6KB
  • MoveGenerator.sbr
    117.1KB
  • SearchEngine.sbr
    117.9KB
  • SimpleConnect6.exe
    600.1KB
  • EvaluateSystem.h
    1.2KB
  • Global.h
    722B
  • EvaluateSystem.cpp
    9.4KB
  • SearchEngine.cpp
    1.9KB
  • main.cpp
    10.1KB
  • SimpleConnect6.ncb
    57KB
  • SearchEngine.h
    660B
  • SimpleConnect6.plg
    1.6KB
  • SimpleConnect6.opt
    49.5KB
  • SimpleConnect6.dsp
    4.5KB
  • MoveGenerator.h
    228B
  • SimpleConnect6.dsw
    553B
  • MoveGenerator.cpp
    1.7KB
  • SingleStep.exe
    186.5KB
  • AlphaBeta.exe
    187KB
  • Max-Min.exe
    186.5KB
内容介绍
#include "Global.h" #include "EvaluateSystem.h" #include "SearchEngine.h" using namespace std; //辅助函数 void ShowTypeCount(int typeCount[2][13]); void Print(int chessBoard[GRID_NUM][GRID_NUM]); void ImportChessBoard(char *fileName,int chessBoard[][GRID_NUM]); void Save(char *fileName,int chessBoard[][GRID_NUM]); int main() { //int chessBoard[GRID_NUM][GRID_NUM]={ // {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, // {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, // {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, // {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, // {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, // {0, 255, 255, 255, 255, 255, 1, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, // {255, 255, 255, 255, 255, 255, 1, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, // {255, 255, 0, 255, 255, 255, 1, 255, 255, 1, 255, 255, 255, 255, 255, 255, 255, 255, 255}, // {255, 255, 255, 0, 255, 255, 1, 255, 255, 255, 0, 255, 255, 255, 255, 255, 255, 255, 255}, // {255, 255, 255, 255, 0, 1, 1, 1, 1, 1, 1, 255, 255, 255, 255, 255, 255, 255, 255}, // {255, 255, 255, 255, 255, 0, 1, 255, 255, 1, 255, 255, 255, 255, 255, 255, 255, 255, 255}, // {255, 255, 255, 1, 1, 1, 0, 255, 255, 1, 255, 255, 255, 255, 255, 255, 255, 255, 255}, // {255, 255, 255, 255, 1, 0, 255, 1, 255, 1, 255, 255, 255, 255, 255, 255, 255, 255, 255}, // {255, 255, 255, 255, 0, 1, 1, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, // {255, 255, 255, 0, 255, 255, 1, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, // {255, 255, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, // {255, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, // {0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, // {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255} //}; int chessBoard[GRID_NUM][GRID_NUM]={ {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, {255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255}, {255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 1, 255, 255, 255, 255, 255, 255, 255, 255}, {255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 255, 1, 255, 255, 255, 255, 255, 255, 255}, {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 1, 1, 255, 255, 255, 255, 255, 255, 255}, {255, 255, 255, 255, 255, 255, 255, 255, 255, 1, 255, 1, 255, 255, 255, 255, 255, 255, 255}, {255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255}, {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}, {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255} }; char command[100],fileName[100]; int i,j; while(true) { cin.clear(); cout<<"$"; cin>>command; //显示棋型扫描结果 if(!stricmp(command,"show")) { scan(chessBoard); ShowTypeCount(TypeCount); } //打印棋盘 else if(!stricmp(command,"print")) { Print(chessBoard); } //显示评估值 else if(!stricmp(command,"eval")) { scan(chessBoard); cout<<"Black:"<<GetEvaluatedValue(chessBoard,Black); cout<<"\tWhite:"<<GetEvaluatedValue(chessBoard,White)<<endl; } //b i j,黑方走棋 else if(!stricmp(command,"b")) { cin>>i; cin>>j; if(!IsLegal(i,j)||chessBoard[i][j]!=Empty) { cout<<"Illegal Move!"<<endl; } else { chessBoard[i][j]=Black; Print(chessBoard); WhoWin(chessBoard); } } //w i j,白方走棋 else if(!stricmp(command,"w")) { cin>>i; cin>>j; if(!IsLegal(i,j)||chessBoard[i][j]!=Empty) { cout<<"Illegal Move!"<<endl; } else { chessBoard[i][j]=White; Print(chessBoard); WhoWin(chessBoard); } } //mb,黑方走棋 else if(!stricmp(command,"mb")) { Move bestMoves[2]; int start=clock(); i=GetBestMove(chessBoard,Black,bestMoves); for(j=0;j<i;j++) { cout<<"("<<bestMoves[j].x<<","<<bestMoves[j].y<<")"<<'\t'; MakeMove(chessBoard,bestMoves[j],Black); } cout<<endl; cout<<(double)(clock()-start)/CLOCKS_PER_SEC<<"s"<<endl; Print(chessBoard); WhoWin(chessBoard); } //mw,白方走棋 else if(!stricmp(command,"mw")) { Move bestMoves[2]; int start=clock(); i=GetBestMove(chessBoard,White,bestMoves); for(j=0;j<i;j++) { cout<<"("<<bestMoves[j].x<<","<<bestMoves[j].y<<")"<<'\t'; MakeMove(chessBoard,bestMoves[j],White); } cout<<endl; cout<<(double)(clock()-start)/CLOCKS_PER_SEC<<"s"<<endl; Print(chessBoard); WhoWin(chessBoard); } //u i j,退棋 else if(!stricmp(command,"u")) { cin>>i; cin>>j; if(!IsLegal(i,j)||chessBoard[i][j]==Empty) { cout<<"Illegal UnMove!"<<endl; } else { chessBoard[i][j]=Empty; Print(chessBoard); } } //导入棋盘 import fileName else if(!stricmp(command,"import")) { //cin>>fileName; char buffer[100],*p; cin.getline(buffer,100); p=buffer; //掠过空白符 while(*p==' '||*p=='\t') { p++; } //去除双引号 if(*p=='"') { p++; *(p+strlen(p)-1)='\0'; } strcpy(fileName,p); ImportChessBoard(fileName,chessBoard); } //保存棋盘 save fileName else if(!stricmp(command,"save")) { char buffer[100],*p; cin.getline(buffer,100); p=buffer; //掠过空白符 while(*p==' '||*p=='\t') { p++; } //去除双引号 if(*p=='"') { p++; *(p+strlen(p)-1)='\0'; } strcpy(fileName,p); Save(fileName,chessBoard); } //新建棋盘 else if(!stricmp(command,"new")) { for(i=0;i<GRID_NUM;i++) { for(j=0;j<GRID_NUM;j++) { chessBoard[i][j]=Empty; } } } //退出 else if(!stricmp(command,"quit")) { break; } } return 0; } ///<summary> /// 输出棋型扫描的结果 ///<summary/> void ShowTypeCount(int typeCount[2][13] ) { cout<<"黑方:\t\t\t\t白方:" <<"\n眠二:"<<typeCount[Black][STWO]<<"\t活二:"<<typeCount[Black][TWO] <<"\t\t\t" <<"眠二:"<<typeCount[White][STWO]<<"\t活二:"<<typeCount[White][TWO] <<"\n眠三:"<<typeCount[Black][STHREE]<<"\t活三:"<<typeCount[Black][THREE]<<"\t朦胧三:"<<typeCount[Black][MTHREE] <<"\t" <<"眠三:"<<typeCount[White][STHREE]<<"\t活三:"<<typeCount[White][THREE]<<"\t朦胧三:"<<typeCount[White][MTHREE] <<"\n眠四:"<<typeCount[Black][SFOUR]<<"\t
评论
    相关推荐
    • connect6.rar
      六子棋人机对弈程序,本人机器人博弈棋力一般,可供初学者参考使用。
    • connect_6.rar
      可运行的六子棋源码,可供学习研究使用,很好的算法研究材料
    • Connect6GUI.rar
      六子棋人机博弈程序,可实现人人,机机,人机对战,有较强棋力。
    • 六子棋.rar
      实现局面空位估值算法的六子棋程序,具有较好的AI性能,但仍需提高!
    • connect6.rar
      六子棋作为五子棋改进的产物,问世很迟,推广的前景很广,我们旨在制作一个具有友好界面和完整功能的六子棋人机对弈的游戏软件,供六子棋爱好者进行人机对弈或者人人对弈。
    • 六子棋 五子棋框架
      六子棋框架,C++代码,MFC实现,可用visual studio直接打开。没有加入算法,算法为随机数值。改为五子棋十分简单。
    • 六子棋源程序
      六子棋的源代码,实现了六子棋的基本功能。 中间夹杂了比较多的资源文件,所以有点大。 导入eclipse工程应该就可以运行
    • 子棋【人人/人机对战】
      子棋 数据结构 C++ 人人对战 人机对战
    • 六子棋 ZSC幸存版
      六子棋人机游戏。算法还可以,深度7,棋力还可以,搜索比较弱,速度比较慢,可供参考学习。可用visual studio直接打开
    • snowglobe-src-viewer-2.0.0-r0.tar.gz
      国外的开源游戏引擎,能够承载上千人,属于社交类的游戏