yx=1;
break;
default:
break;
}
if(ks==1)
gotoxy(35,15);
else
gotoxy(34,18);
if(ks==1&&yx==1)
break;
else if(ks==0&&yx==1)
{
textcolor(240);
gotoxy(0,0);
for(i=0;i<=500;i++)
{
printf(" ");
}
gotoxy(0,0);
ct(12,5,58,10,223);
gotoxy(13,6);
printf(" 2048游戏说明");
gotoxy(13,8);
printf(" 通过按数字键移动数字,合并相同的数字来的取得更大的数。");
gotoxy(13,9);
printf(" 得到2048时游戏即胜利,当然您也可以选择继续挑战。");
gotoxy(13,11);
printf(" 按键操作:");
gotoxy(13,13);
printf(" 上:↑ 下:↓ 左:← 右:→ 重新开始:r 退出游戏:e");
textcolor(240);
printf("\n\n\n\n\n I know ");
getch();
p2048(17,1);
textcolor(255);
gotoxy(34,18);
}
yx=0;
}
//隐藏光标
HANDLE hOut=GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO cci;
GetConsoleCursorInfo(hOut,&cci);
cci.bVisible=FALSE;
SetConsoleCursorInfo(hOut,&cci);
//刷新画面
textcolor(240);
gotoxy(0,0);
for(i=0;i<=500;i++)
{
printf(" ");
}
gotoxy(0,0);
/*设置时间种子*/
srand((int)time(0));
/* 设置初始值 */
sj = rands();
sj1 = rands();
sj2 = rands();
for (;;)
{
if (sj == sj1 || sj == sj2 || sj1 == sj2)
{
sj1 = rands();
sj2 = rands();
}
else
break;
}
a[sj] = shu();
a[sj1] = shu();
a[sj2] = shu();
/*显示*/
prin(a,&score,&scoremax);
for (;;)
{