i = k + 1;
flag = true;
}
else if (chessboard[i][j] != chessboard[k][j] && k < 4)//不匹配
{
i = k;
}
}
}
for (j = 0; j < m; j++)//排列棋盘
for (i = 0, count2 = 0; i < m; i++)
{
if (chessboard[i][j] != 0)
{
temp2 = chessboard[i][j];
chessboard[i][j] = 0;
chessboard[count2][j] = temp2;
count2++;
}
}
}
四、判断游戏结束
bool game::gameover()
{
if (flag)
count1++;//判连消
if (temp1 == count1)
count1 = 0;//未消除,连消归零
add(count1);
for (i = m - 1, j = 0; j < m; j++)//最后一行
{
if (j == m - 1)//右下角
{
if (chessboard[i][j] == 0)
return false;
else if (chessboard[i][j] == 2048)
{
cout << "You Win~\n";
return true;
}
}
else
{
if (chessboard[i][j] == 0 || chessboard[i][j] == chessboard[i][j + 1])
return false;
else if (chessboard[i][j] == 2048)
{
cout << "You Win~\n";
return true;
}
}
}
for (i = 0, j = m - 1; i < m; i++)//最后一列
{
if (i == m - 1)//右下角
{
if (chessboard[i][j] == 0)
return false;
else if (chessboard[i][j] == 2048)
{
cout << "You Win~\n";
return true;
}
}
else
{
if (chessboard[i][j] == 0 || chessboard[i][j] == chessboard[i + 1][j])
推荐阅读
- 如何放风筝,怎么玩放风筝
- 如何戒掉游戏,如何快速地戒掉游戏
- 如何使用app,发现app怎么玩
- lol如何走a,lol怎么走a怎么设置 键位
- 如何代理游戏,手游加盟怎么样
- 如何查身份证号码,2021年游戏实名认证身份证号最新
- 如何换ip,网易我的世界锁ip怎么办
- 如何开发游戏,没有开发软件怎么开发游戏
- 我的世界如何联机,我的世界pc远程联机
- 【莲花】宝莲花如何繁殖,宝莲花的繁殖方法/以扦插繁殖为主