• 大小: 0.79M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2024-04-13
  • 语言: C/C++
  • 标签: MFC  五子棋  游戏  

资源简介


音乐文件太大没上传 可以自行找一个 ".wav" 文件
改名为 "Boom.wav" 添加到 "Source"文件夹下

或者修改代码

资源截图

代码片段和文件信息

#define _CRT_SECURE_NO_WARNINGS
#include
#include
#include
#include
#define H 15

int map[15][15]; //0为空,1为黑,2为白3为待选,4为13融合,5为23融合

//光标结构体
struct cursor 
{
int x;
int y;
}point;

//棋盘初始化
void ini()
{
for (int  i = 0; i <15; i++)
{
for (int  j = 0; j < 15; j++)
{
map[i][j] = 0;
}
}
}

//是否继续 待完善
void go()
{
printf(“是否继续:\n是 y\t否 n“);
system(“pause“);
char choose;
scanf(“%c“ &choose);
if (choose==‘y‘)
{
ini();
}
else
{
exit(1);
}


}

//胜负判断
void check(int xint y)
{
int hei = 0 bai = 0;
for (int i = 0; i < H; i++) //横向判断
{
if ((map[x][i] == 0) || (map[x][i] == 3))
{
hei = 0;
bai = 0;
}
if ((map[x][i]==1)||(map[x][i]==4))
{
hei++;
bai = 0;
if (hei==5)
{
printf(“\t\t\t********黑方胜***********\n“);
go();

}
}
if ((map[x][i] == 2) || (map[x][i] == 5))
{
bai++;
hei = 0;
if (bai==5)
{
printf(“\t\t\t********白方胜***********\n“);
go();
}
}

}

 hei = 0 bai = 0;
for (int  i = 0; i < H; i++) //纵向判断
{

if ((map[i][y] == 0) ||( map[i][y] == 3))
{
hei = 0;
bai = 0;
}
if ((map[i][y] == 1) || (map[i][y] == 4))
{
hei++;
bai = 0;
if (hei == 5)
{
printf(“\t\t\t********黑方胜***********\n“);
go();
}
}
if ((map[i][y] == 2) || (map[i][y] == 5))
{
bai++;
hei = 0;
if (bai == 5)
{
printf(“\t\t\t********白方胜***********\n“);
go();
}
}
}

//斜向(\向)判断
int x1 = x y1 = y;
if (x1>y1)
{
x1 = x1 - y1;
y1 = 0;
}
else
{
y1 = y1 - x1;
x1 = 0;
}
hei = 0 bai = 0;
while ((x1 {
if ((map[x1][y1]==0)||(map[x1][y1]==3))
{
hei = 0;
bai = 0;
}
if ((map[x1][y1] == 1) || (map[x1][y1] == 4))
{
hei++;
bai = 0;
if (hei==5)
{
printf(“\t\t\t********黑方胜***********\n“);
go();
}
}
if ((map[x1][y1] == 2) || (map[x1][y1] == 5))
{
bai++;
hei = 0;
if (bai==5)
{
printf(“\t\t\t********白方胜***********\n“);
go();
}
}
x1++;
y1++;
}

//斜向(/向)判断
int x2 = x y2 = y;
if (x2>y2)
{
x2 = (x - (H - y));
y2 = H-1;
}
else
{
x2 =0;
y2 = (y +x);
}
hei = 0 bai = 0;
while ((y2>=0)&&(x2 {
if ((map[x2][y2] == 0) || (map[x2][y2] == 3))
{
hei = 0;
bai = 0;
}
if ((map[x2][y2] == 1) || (map[x2][y2] == 4))
{
hei++;
bai = 0;
if (hei == 5)
{
printf(“\t\t\t********黑方胜***********\n“);
go();
}
}
if ((map[x2][y2] == 2) || (map[x2][y2] == 5))
{
bai++;
hei = 0;
if (bai == 5)
{
printf(“\t\t\t********白方胜***********\n“);
go();
}
}
x2++;
y2--;
}


}

//打印棋盘
void prin()
{

system(“cls“);
for (int i = 0; i <15; i++)
{
printf(“\t\t“);
for (int j = 0; j < 15; j++)
{
if (map[i][j]==0)
{
printf(“╋“);
}
else
{
if ((map[i][j]==1) || (map[i][j] == 4))
{
printf(“●“);
}
if ((map[i][j]==2) || (map[i][j] == 5))
{
printf(“○“);
}
if ((map[i][j]==3))
{
printf

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-03-30 02:42  five-in-a-row-master\
     目录           0  2019-03-30 02:42  five-in-a-row-master\MFC_Five\
     文件         891  2019-03-30 02:42  five-in-a-row-master\MFC_Five\MFC_Five.sln
     文件       32256  2019-03-30 02:42  five-in-a-row-master\MFC_Five\MFC_Five.v11.suo
     目录           0  2019-03-30 02:42  five-in-a-row-master\MFC_Five\MFC_Five\
     文件       78755  2019-03-30 02:42  five-in-a-row-master\MFC_Five\MFC_Five\FiveTest.cpp
     文件        2018  2019-03-30 02:42  five-in-a-row-master\MFC_Five\MFC_Five\FiveTest.h
     文件       73480  2019-03-30 02:42  five-in-a-row-master\MFC_Five\MFC_Five\MFC_Five.aps
     文件        2394  2019-03-30 02:42  five-in-a-row-master\MFC_Five\MFC_Five\MFC_Five.cpp
     文件         454  2019-03-30 02:42  five-in-a-row-master\MFC_Five\MFC_Five\MFC_Five.h
     文件       10438  2019-03-30 02:42  five-in-a-row-master\MFC_Five\MFC_Five\MFC_Five.rc
     文件        6274  2019-03-30 02:42  five-in-a-row-master\MFC_Five\MFC_Five\MFC_Five.vcxproj
     文件        2335  2019-03-30 02:42  five-in-a-row-master\MFC_Five\MFC_Five\MFC_Five.vcxproj.filters
     文件         164  2019-03-30 02:42  five-in-a-row-master\MFC_Five\MFC_Five\MFC_Five.vcxproj.user
     文件        7351  2019-03-30 02:42  five-in-a-row-master\MFC_Five\MFC_Five\MFC_FiveDlg.cpp
     文件         888  2019-03-30 02:42  five-in-a-row-master\MFC_Five\MFC_Five\MFC_FiveDlg.h
     文件        3880  2019-03-30 02:42  five-in-a-row-master\MFC_Five\MFC_Five\ReadMe.txt
     目录           0  2019-03-30 02:42  five-in-a-row-master\MFC_Five\MFC_Five\res\
     文件       67777  2019-03-30 02:42  five-in-a-row-master\MFC_Five\MFC_Five\res\MFC_Five.ico
     文件         672  2019-03-30 02:42  five-in-a-row-master\MFC_Five\MFC_Five\res\MFC_Five.rc2
     文件        1380  2019-03-30 02:42  five-in-a-row-master\MFC_Five\MFC_Five\resource.h
     文件         141  2019-03-30 02:42  five-in-a-row-master\MFC_Five\MFC_Five\stdafx.cpp
     文件        1578  2019-03-30 02:42  five-in-a-row-master\MFC_Five\MFC_Five\stdafx.h
     文件         234  2019-03-30 02:42  five-in-a-row-master\MFC_Five\MFC_Five\targetver.h
     目录           0  2019-03-30 02:42  five-in-a-row-master\MFC_Five\Source\
     文件         488  2019-03-30 02:42  five-in-a-row-master\MFC_Five\Source\DefaultOut.txt
     文件         489  2019-03-30 02:42  five-in-a-row-master\MFC_Five\Source\DefaultSave.txt
     文件         759  2019-03-30 02:42  five-in-a-row-master\MFC_Five\Source\DefaultScore.txt
     文件         480  2019-03-30 02:42  five-in-a-row-master\MFC_Five\Source\DefaultScoreWhite.txt
     文件        4891  2019-03-30 02:42  five-in-a-row-master\MFC_Five\Source\Fail.png
     文件        4550  2019-03-30 02:42  five-in-a-row-master\MFC_Five\Source\Level1.png
............此处省略17个文件信息

评论

共有 条评论