资源简介
Visual studio实现带图形界面和简单动画的五子棋,包含悔棋,人机对战,人人对战,残局对战,等基本功能
代码片段和文件信息
#include“wuziqi.h“
void renji() //人机对战//
{
a[225] = 9;
if (music == 1)
PlaySound(L“zhandou.wav“ NULL SND_FILENAME | SND_ASYNC | SND_LOOP);
int wm=0 i = 9; //wm判断先后手//
if (b[226] == 9) //判别存档进行的先后手//
goto E;
if (b[226] == 10)
goto O;
wm=qishou(); //选则先/后手//
draw();
if (wm == 1){ //先手//
E:
b[225] = 9;
while (PieceLen != 0){
xiazi(&game1 1);
i = victory(&game1 1);
if (i == 1 || RenShu != 3) //判断是否点击认输//
break;
if (PieceLen == 0){
outtextxy(650 160 TEXT(“********游戏结束*********\n难以置信的平局!“));
goto L;
}
outtextxy(610 520 TEXT(“ “));
outtextxy(610 500 TEXT(“机器猫正在思考***“)); Sleep(500);
outtextxy(610 500 TEXT(“ “));
AI(&game1.X &game1.Y2);
i = victory(&game1 2); //判断是否胜利//
if (i == 2)
break;
}
if (i == 1){
if (music == 1)
PlaySound(L“shengli.wav“ NULL SND_FILENAME | SND_ASYNC);
MessageBox(NULL _T(“********难以置信********* \n您战胜了机器猫!【鲜花】【鲜花】“) _T(“喵喵棋—_—“) MB_SYSTEMMODAL);
if (cjtz == 0){
name(); savepaiming();
} goto L;
}
if (i == 2 || RenShu == 1 || RenShu == 2){
if (music == 1)
PlaySound(L“shibai.wav“ NULL SND_FILENAME | SND_ASYNC);
MessageBox(NULL _T(“********您输给了机器猫*********\n 机器猫拥有未来的黑科技\n 请不要灰心^_^“) _T(“喵喵棋—_—“) MB_SYSTEMMODAL);
goto L;
}
}
if (wm == 2){ //后手//
b[225] = 10;
while (PieceLen != 0){
outtextxy(610 520 TEXT(“ “));
outtextxy(610 500 TEXT(“机器猫正在思考***“)); Sleep(500);
outtextxy(610 500 TEXT(“ “));
AI(&game1.X &game1.Y1);
i = victory(&game1 1);
if (i == 1)
break;
if (PieceLen == 0){ //棋盘容量为0时输出平局//
MessageBox(NULL _T(“********游戏结束********* \n难以置信的平局!“) _T(“喵喵棋—_—“) MB_SYSTEMMODAL);
goto L;
}
O:
xiazi(&game1 2);
i = victory(&game1 2);
if (i == 2 || RenShu != 3)
break;
}
if (i == 2){ //战胜电脑后记录昵称和用子数//
if (music == 1)
PlaySound(L“shengli.wav“ NULL SND_FILENAME | SND_ASYNC);
MessageBox(NULL _T(“********难以置信********* \n您战胜了机器猫!【鲜花】【鲜花】“) _T(“喵喵棋—_—“) MB_SYSTEMMODAL);
if (cjtz == 0){ //如果是挑战残局则不记录//
name(); savepaiming();
} goto L;
}
if (i == 1 || RenShu == 2 || RenShu == 1){
if (music == 1)
PlaySound(L“shibai.wav“ NULL SND_FILENAME | SND_ASYNC);
MessageBox(NULL _T(“********您输给了机器猫********* \n 机器猫拥有未来的黑科技\n 请不要灰心^_^“) _T(“喵喵棋—_—“) MB_SYSTEMMODAL);
goto L;
}
}
L:
outtextxy(600 520 TEXT(“ 游戏结束 “));
outtextxy(600 550 TEXT(“ 点击鼠标左键返回 “));
outtextxy(600 580 TEXT(“ 点击鼠标右键回放 “));
MOUSEMSG m;
while (true){ //点击鼠标左键返回主界面//
while (MouseHi
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1410044 2017-06-07 11:56 ConsoleApplication1\ConsoleApplication1\1.wav
文件 1060044 2017-06-07 11:57 ConsoleApplication1\ConsoleApplication1\2.wav
文件 2640044 2017-06-07 18:14 ConsoleApplication1\ConsoleApplication1\chunzhuang.wav
文件 3520044 2017-06-07 18:23 ConsoleApplication1\ConsoleApplication1\chunzhuang1.wav
文件 4524 2017-06-11 17:30 ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.vcxproj
文件 1699 2017-06-11 17:30 ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.vcxproj.filters
文件 22342 2017-06-12 12:46 ConsoleApplication1\ConsoleApplication1\Debug\ConsoleA.830C2BE6.tlog\cl.command.1.tlog
文件 726158 2017-06-12 12:46 ConsoleApplication1\ConsoleApplication1\Debug\ConsoleA.830C2BE6.tlog\CL.read.1.tlog
文件 90402 2017-06-12 12:46 ConsoleApplication1\ConsoleApplication1\Debug\ConsoleA.830C2BE6.tlog\CL.write.1.tlog
文件 206 2017-06-12 12:46 ConsoleApplication1\ConsoleApplication1\Debug\ConsoleA.830C2BE6.tlog\ConsoleApplication1.lastbuildstate
文件 4626 2017-06-12 12:46 ConsoleApplication1\ConsoleApplication1\Debug\ConsoleA.830C2BE6.tlog\li
文件 5714 2017-06-12 12:46 ConsoleApplication1\ConsoleApplication1\Debug\ConsoleA.830C2BE6.tlog\li
文件 2176 2017-06-12 12:46 ConsoleApplication1\ConsoleApplication1\Debug\ConsoleA.830C2BE6.tlog\li
文件 2060 2017-06-12 12:46 ConsoleApplication1\ConsoleApplication1\Debug\ConsoleApplication1.log
文件 160148 2017-06-09 21:21 ConsoleApplication1\ConsoleApplication1\Debug\main.obj
文件 226264 2017-06-08 14:31 ConsoleApplication1\ConsoleApplication1\Debug\show.obj
文件 175975 2017-06-08 12:02 ConsoleApplication1\ConsoleApplication1\Debug\value.obj
文件 1182720 2017-06-12 12:46 ConsoleApplication1\ConsoleApplication1\Debug\vc120.idb
文件 479232 2017-06-12 12:46 ConsoleApplication1\ConsoleApplication1\Debug\vc120.pdb
文件 248864 2017-06-07 12:46 ConsoleApplication1\ConsoleApplication1\Debug\xiaqi.obj
文件 195382 2017-06-09 21:24 ConsoleApplication1\ConsoleApplication1\Debug\下棋.obj
文件 197956 2017-06-11 21:51 ConsoleApplication1\ConsoleApplication1\Debug\两种对局和下子.obj
文件 160233 2017-06-11 17:30 ConsoleApplication1\ConsoleApplication1\Debug\主函数.obj
文件 176594 2017-06-09 21:26 ConsoleApplication1\ConsoleApplication1\Debug\价值.obj
文件 176028 2017-06-08 18:11 ConsoleApplication1\ConsoleApplication1\Debug\价值计算.obj
文件 176045 2017-06-11 14:27 ConsoleApplication1\ConsoleApplication1\Debug\价值计算和悔棋.obj
文件 210040 2017-06-09 21:21 ConsoleApplication1\ConsoleApplication1\Debug\动画.obj
文件 232359 2017-06-11 14:34 ConsoleApplication1\ConsoleApplication1\Debug\动画和回放.obj
文件 232379 2017-06-11 17:32 ConsoleApplication1\ConsoleApplication1\Debug\始末动画和回放.obj
文件 222637 2017-06-11 17:13 ConsoleApplication1\ConsoleApplication1\Debug\存档读档.obj
............此处省略51个文件信息
评论
共有 条评论