#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
#include<bits/stdc++.h>
#include<windows.h>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<time.h>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
using namespace std;
int allscore=0;
int playtime=0;
string player="wzh";
int main();
void printword(string a){/*打字*/
for(int i=0;i<a.size();i++){
cout<<a[i];
Sleep(100);
}
}
void reset(){/*重置界面*/
system("color 0f");
system("title wzh的游戏空间");
system("cls");
}
void rest(){/*暂停*/
system("pause");
}
int random(int a,int b){/*随机数*/
srand(time(NULL));
b-=a;
Sleep(100);
return(rand()%b)+a;
}
void all(){/*全屏*/
HWND hwnd=GetForegroundWindow();
int x=GetSystemMetrics(SM_CXSCREEN)+300;
int y=GetSystemMetrics(SM_CYSCREEN)+300;
char setting[30];
sprintf(setting,"mode con:cols=%d lines=%d",x,y);
system(setting);
SetWindowPos(hwnd,HWND_TOPMOST,0,0,x+300,y+300,NULL);
MoveWindow(hwnd,-10,-40,x+300,y+300,1);
main();
}
void hide(){/*隐藏光标*/
HANDLE h_GAME=GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO cursor_info;
GetConsoleCursorInfo(h_GAME,&cursor_info);
cursor_info.bVisible=false;
SetConsoleCursorInfo(h_GAME,&cursor_info);
main();
}
void see(){/*显示光标*/
HANDLE h_GAME=GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO cursor_info;
GetConsoleCursorInfo(h_GAME,&cursor_info);
cursor_info.bVisible=true;
SetConsoleCursorInfo(h_GAME,&cursor_info);
main();
}
void start(){/*开始界面*/
reset();
string a=" ";
string b="===============================================================";
cout<<endl<<b<<"欢迎来到"<<player<<"的游戏空间"<<b<<endl<<endl;
cout<<a<<"目前获得了"<<allscore<<"积分"<<endl<<endl;
cout<<a<<"退出:a/A"<<endl<<endl;
cout<<a<<"全屏:b/B"<<endl<<endl;
cout<<a<<"隐藏光标:c/C"<<endl<<endl;
cout<<a<<"隐藏光标:d/D"<<endl<<endl;
cout<<a<<"获得存档:e/E"<<endl<<endl;
cout<<a<<"打开存档:f/F"<<endl<<endl;
cout<<" 温馨提示:游戏前请切换至大写模式,游戏编号以最后一个字符为准"<<endl<<endl;
cout<<a<<"1.躲避障碍"<<endl<<endl;
cout<<a<<"2.手速射击"<<endl<<endl;
cout<<a<<"3.恐龙跳一跳"<<endl<<endl;
cout<<a<<"4.移动小人"<<endl<<endl;
cout<<a<<"5.扫雷"<<endl<<endl;
cout<<a<<"6.贪吃蛇"<<endl<<endl;
cout<<" ";
}
void write(){/*获得存档*/
reset();
string a,b;
vector<int> c;
int e=allscore;
while(e){
a+=e%10;
e/=10;
}
cout<<"请输入你的游戏昵称:";
string d;
getline(cin,d);
for(int i;i<=d.size();i++){
if(d[i]=='z'){
d[i]='a';
}else if(d[i]>='a'&&d[i]<='z'){
d[i]+=5;
}
}
for(int i=0;i<a.size();i++){
switch(a[i]){
case('0'):
c.push_back(1111);
break;
case('1'):
c.push_back(1110);
break;
case('2'):
c.push_back(1101);
break;
case('3'):
c.push_back(1100);
break;
case('4'):
c.push_back(1011);
break;
case('5'):
c.push_back(1010);
break;
case('6'):
c.push_back(1001);
break;
case('7'):
c.push_back(1000);
break;
case('8'):
c.push_back(0111);
break;
case('9'):
c.push_back(0110);
break;
}
}
cout<<"创建存档完成,存档码:";
for(int i=0;i<c.size();i++){
cout<<c[i];
}
cout<<" "<<d;
cout<<endl;
rest();
main();
}
void read(){/*读取存档*/
reset();
cout<<"请输入存档码:";
char g;
bool e=1;
string a,b;
string s;
getline(cin,s);
for(int i=0;i<s.size();i++){
if(s[i]==' '&&e){
e=0;
}
if(e){
a+=s[i];
}else{
b+=s[i];
}
}
int n;
vector<int> c;
for(int i=0;i<a.size();i+=4){
string d="";
for(int i=0;i<4;i++){
d+=a[i];
}
if(d=="1111"){
c.push_back(0);
n++;
}else if(d=="1110"){
c.push_back(1);
n++;
}else if(d=="1101"){
c.push_back(2);
n++;
}else if(d=="1100"){
c.push_back(3);
n++;
}else if(d=="1011"){
c.push_back(4);
n++;
}else if(d=="1010"){
c.push_back(5);
n++;
}else if(d=="1001"){
c.push_back(6);
n++;
}else if(d=="1000"){
c.push_back(7);
n++;
}else if(d=="0111"){
c.push_back(8);
n++;
}else if(d=="0110"){
c.push_back(9);
n++;
}else{
cout<<"存档开启失败";
main();
}
allscore=0;
}
while(n){
allscore*10+c[n-1];
n-=1;
}
for(int i=b.size()-1;i>=0;i--){
if(b[i]=='a'){
b[i]='z';
}else if(b[i]>='a'&&b[i]<=char('z'+4)){
b[i]-=5;
}
}
player=b;
reset();
cout<<"存档开启成功"<<endl;
rest();
main();
}
void dbza(){/*躲避障碍*/
reset();
int w=10,a=0,fs=0;
while(1){
int d=random(1,18);
for(int n=0;n<10;n++){
for(int i=0;i<10;i++){
for(int t=0;t<20;t++){
if(i==a&&t==d){
cout<<"v";
}else if(i==9&&t==w||(i==8&&t==w)){
cout<<"^";
}else{
cout<<" ";
}if((i==8||i==9)&&(d==w)){
reset();
cout<<"游戏结束,得分:"<<fs;
allscore+=fs;
Sleep(1000);
main();
}
}
cout<<endl;
}
cout<<"A向左,D向右";
a+=1;
if(KEY_DOWN('A')){
w-=1;
}else if(KEY_DOWN('D')){
w+=1;
}
if(w>18){
w=18;
}else if(w<1){
w=1;
}
if(KEY_DOWN('P')){
reset();
rest();
}
Sleep(100);
reset();
}
a=0;
fs+=1;
}
}
void sj(){/*手速射击*/
reset();
int x=0;
cout<<"按K射击";
char map[10][10]={{'\\',' ',' ',' ',' ',' ',' ',' ',' ','/'},
{' ','\\',' ',' ',' ',' ',' ',' ','/',' '},
{' ',' ','\\',' ',' ',' ',' ','/',' ',' '},
{' ',' ',' ','\\',' ',' ','/',' ',' ',' '},
{' ',' ',' ',' ','\\','/',' ',' ',' ',' '},
{' ',' ',' ',' ','/','\\',' ',' ',' ',' '},
{' ',' ',' ','/',' ',' ','\\',' ',' ',' '},
{' ',' ','/',' ',' ',' ',' ','\\',' ',' '},
{' ','/',' ',' ',' ',' ',' ',' ','\\',' '},
{'/',' ',' ',' ',' ',' ',' ',' ',' ','\\'},};
bool cg=0;
Sleep(2000);
Sleep(random(1,10)*100);
reset();
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
cout<<map[i][j];
}
cout<<endl;
}
if(KEY_DOWN('K')){
reset();
cout<<"游戏失败";
Sleep(2000);
main();
}
for(int i=0;i<1000000;i++){
if(KEY_DOWN('K')){
reset();
cout<<"游戏成功,得分:"<<100-i/10000<<endl;
allscore+=(100-i/10000)/10;
Sleep(2000);
cout<<"游戏结束";
Sleep(2000);
cg=1;
break;
}
}
if (cg==0){
reset();
cout<<"游戏失败"<<endl;
Sleep(2000);
cout<<"游戏结束";
Sleep(2000);
}
main();
}
void kltyt(){/*恐龙跳一跳*/
reset();
int z=0,d=30,lc=0,lq=0;
Sleep(2000);
while(1){
for(int n=1;n<=30;n++){
reset();
for(int i=1;i<=25;i++){
cout<<" ";
}
printf("%06d", lc);
cout<<endl<<endl<<endl<<endl;
if(z==1){
cout<<"$";
}
cout<<endl;
for(int i=1;i<=30;i++){
if(i==1&&z==0){
cout<<"$";
}
if(i==d){
cout<<"^";
}else{
cout<<" ";
}
}
cout<<endl;
for(int i=1;i<=30;i++){
cout<<"=";
}
cout<<endl<<"W跳";
if(KEY_DOWN('W')&&lq>=0){
z=1;
lq-=2;
}else{
z=0;
lq+=1;
}
if(KEY_DOWN('P')){
reset();
rest();
}
d-=1;
lc+=1;
if(d==1&&z==0){
reset();
cout<<"游戏失败,路程:"<<lc<<endl;
allscore+=lc/30;
Sleep(2000);
cout<<"游戏结束";
Sleep(2000);
main();
}
Sleep(100);
}
d=30;
}
}
void ydxr(){/*移动小人*/
reset();
cout<<"加载中";
int bx,by;
do{
bx=random(1,9);
}while(bx==5);
do{
by=random(1,9);
}while(by==5);
int x=4,y=4;
reset();
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
if(i==by&&j==bx){
cout<<"¥";
}else if(i==y&&j==x){
cout<<"()";
}else{
cout<<"_.";
}
}
cout<<endl;
}
cout<<"输入提示:W上S下A左D右 '()为人' '¥为宝藏'"<<endl<<"请输入:";
string a;
getline(cin,a);
for(int i=0;i<a.size();i++){
switch(a[i]){
case 'W':
y-=1;
break;
case 'S':
y+=1;
break;
case 'A':
x-=1;
break;
case 'D':
x+=1;
break;
case 'w':
y-=1;
break;
case 's':
y+=1;
break;
case 'a':
x-=1;
break;
case 'd':
x+=1;
break;
}
reset();
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
if(i==by&&j==bx&&i==y&&j==x){
cout<<"(¥)";
}else if(i==by&&j==bx){
cout<<"¥";
}else if(i==y&&j==x){
cout<<"()";
}else{
cout<<"_ ";
}
}
cout<<endl;
}
Sleep(500);
}
if(x==bx&&y==by){
reset();
cout<<"游戏成功,路程:"<<a.size()<<endl;
allscore+=1;
Sleep(2000);
cout<<"游戏结束";
Sleep(2000);
main();
}else{
cout<<"游戏失败"<<endl;
Sleep(2000);
cout<<"游戏结束";
Sleep(2000);
main();
}
}
void sl(){/*扫雷*/
reset();
int pl=0,lx,cx,cy,ly;
int sz[100][100]={0},seemap[100][100]={0},dx[8]={-1,1,0,0,-1,1,-1,1},dy[8]={0,0,-1,1,1,-1,-1,1},sum=0;
for(int i=1;i<=10;i++){
reset();
cout<<"加载中,已加载雷数量:"<<i<<endl;
lx=random(1,10);
ly=random(1,10);
while(sz[lx][ly]==9){
lx=random(1,10);
ly=random(1,10);
}
sz[lx][ly]=9;
for(int o=0;o<8;o++){
if(sz[lx+dx[o]][ly+dy[o]]!=9){
sz[lx+dx[o]][ly+dy[o]]+=1;
}
}
}
reset();
cout<<"加载完成";
while(1){
reset();
cout<<" ";
for(int i=1;i<=10;i++){
printf("%3.d ",i);
}
cout<<endl;
for(int i=0;i<=9;i++){
for(int j=-1;j<=9;j++){
if(j==-1){
printf("%2.d ",i+1);
continue;
}
if(seemap[i][j]==1){
cout<<" "<<sz[i][j]<<" ";
}else if(seemap[i][j]==0){
cout<<" __ ";
}
}
cout<<endl<<endl;
}
Sleep(1000);
if(sum>=90){
reset();
cout<<"游戏成功"<<endl;
allscore+=15;
Sleep(2000);
cout<<"游戏结束";
Sleep(2000);
main();
}
cout<<"请输入需要排查的地方在第几列:";
cin>>cx;
cout<<endl<<"请输入需要排查的地方在第几行:";
cin>>cy;
while(cx<1||cx>10){
cout<<endl<<"请重新输入需要排查的地方在第几列:";
cin>>cx;
}
while(cy<1||cy>10){
cout<<endl<<"请重新输入需要排查的地方在第几行:";
cin>>cy;
}
cy-=1;
cx-=1;
swap(cy,cx);
int ch=sz[cx][cy];
if(ch==9){
reset();
cout<<"游戏失败"<<endl;
Sleep(2000);
cout<<"游戏结束";
Sleep(2000);
main();
}
if(seemap[cx][cy]!=1){
sum+=1;
}
queue<int> x,y;
x.push(cx);
y.push(cy);
seemap[cx][cy]=1;
while(!(x.empty()&&y.empty())){
int nx=x.front();
int ny=y.front();
x.pop();
y.pop();
for(int i=0;i<4;i++){
int tx=nx+dx[i];
int ty=ny+dy[i];
if(0<=tx&&tx<10&&0<=ty&&ty<10&&((sz[tx][ty]==ch)||(sz[tx][ty]!=8&&sz[tx][ty]==char(ch+1)))&&seemap[tx][ty]==0){
x.push(tx);
y.push(ty);
seemap[tx][ty]=1;
sum+=1;
}
}
}
}
}
void tcs(){/*贪吃蛇*/
reset();
int nx=4,ny=4,score=0,abcd,sp=0,ax,ay,ox=3,oy=3,fa=3,ti=5;
char zf;
abcd%=4;
ax=random(1,9);
ay=random(1,9);
queue<int> x,y,x1,x2;
x.push(4);
y.push(4);
while(1){
reset();
cout<<"分数:"<<score<<","<<"冷却时间:"<<ti<<"/5"<<endl;
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
bool c=1;
for(int d=0;d<x.size()-1;d++){
if(j==x.front()&&i==y.front()){
zf='*';
c=0;
}
x.push(x.front());
y.push(y.front());
x.pop();
y.pop();
}
if(j==x.front()&&i==y.front()){
if(j==ax&&i==ay){
score+=1;
x.push(ox);
y.push(oy);
for(int d=0;d<x.size()-1;d++){
x.push(x.front());
y.push(y.front());
x.pop();
y.pop();
}
ax=random(1,9);
ay=random(1,9);
}
switch(abcd){
case 1:
zf='^';
break;
case 2:
zf='V';
break;
case 3:
zf='<';
break;
case 4:
zf='>';
break;
}
c=0;
}
if(j==ax&&i==ay){
zf='X';
c=0;
}
x.push(x.front());
y.push(y.front());
ox=x.front();
oy=y.front();
x.pop();
y.pop();
if(c){
cout<<"_ ";
}else{
cout<<zf<<" ";
}
}
cout<<endl;
}
cout<<"W上S下A左D右P暂停F加速 'O为蛇头' 'X为苹果'";
if(KEY_DOWN('W')){
abcd=1;
}
if(KEY_DOWN('S')){
abcd=2;
}
if(KEY_DOWN('A')){
abcd=3;
}
if(KEY_DOWN('D')){
abcd=4;
}
if(KEY_DOWN('P')){
reset();
rest();
}
if(KEY_DOWN('F')&&fa==3&&ti>=5){
fa=1;
ti=0;
}
if(fa<3){
fa+=1;
}
if(ti<5){
ti+=1;
}
if(nx>=10||ny>=10||nx<0||ny<0){
reset();
cout<<"游戏失败,分数:"<<score<<endl;
allscore+=score;
Sleep(2000);
cout<<"游戏结束";
Sleep(2000);
main();
}
if(sp%fa==0){
switch(abcd){
case 1:
ny-=1;
break;
case 2:
ny+=1;
break;
case 3:
nx-=1;
break;
case 4:
nx+=1;
break;
}
x.pop();
y.pop();
x.push(nx);
y.push(ny);
}
sp+=1;
Sleep(100);
}
}
int main(){
reset();
string yx;
start();
cout<<"请选择游戏,游戏编号:";
getline(cin,yx);
while(1){
switch(yx[yx.size()-1]){
case 'a':
exit(0);
break;
case 'b':
all();
break;
case 'c':
hide();
break;
case 'd':
see();
break;
case 'e':
write();
break;
case 'f':
read();
break;
case 'A':
exit(0);
break;
case 'B':
all();
break;
case 'C':
hide();
break;
case 'D':
see();
break;
case 'E':
write();
break;
case 'F':
read();
break;
case '1':
dbza();
break;
case '2':
sj();
break;
case '3':
kltyt();
break;
case '4':
ydxr();
break;
case '5':
sl();
break;
case '6':
tcs();
break;
default:
start();
cout<<"没有找到这个游戏,请重新选择游戏,游戏编号:";
getline(cin,yx);
}
}
}
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
#include<bits/stdc++.h>
#include<windows.h>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<time.h>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
using namespace std;
int allscore=0;
int playtime=0;
string player="wzh";
int main();
void printword(string a){/*打字*/
for(int i=0;i<a.size();i++){
cout<<a[i];
Sleep(100);
}
}
void reset(){/*重置界面*/
system("color 0f");
system("title wzh的游戏空间");
system("cls");
}
void rest(){/*暂停*/
system("pause");
}
int random(int a,int b){/*随机数*/
srand(time(NULL));
b-=a;
Sleep(100);
return(rand()%b)+a;
}
void all(){/*全屏*/
HWND hwnd=GetForegroundWindow();
int x=GetSystemMetrics(SM_CXSCREEN)+300;
int y=GetSystemMetrics(SM_CYSCREEN)+300;
char setting[30];
sprintf(setting,"mode con:cols=%d lines=%d",x,y);
system(setting);
SetWindowPos(hwnd,HWND_TOPMOST,0,0,x+300,y+300,NULL);
MoveWindow(hwnd,-10,-40,x+300,y+300,1);
main();
}
void hide(){/*隐藏光标*/
HANDLE h_GAME=GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO cursor_info;
GetConsoleCursorInfo(h_GAME,&cursor_info);
cursor_info.bVisible=false;
SetConsoleCursorInfo(h_GAME,&cursor_info);
main();
}
void see(){/*显示光标*/
HANDLE h_GAME=GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO cursor_info;
GetConsoleCursorInfo(h_GAME,&cursor_info);
cursor_info.bVisible=true;
SetConsoleCursorInfo(h_GAME,&cursor_info);
main();
}
void start(){/*开始界面*/
reset();
string a=" ";
string b="===============================================================";
cout<<endl<<b<<"欢迎来到"<<player<<"的游戏空间"<<b<<endl<<endl;
cout<<a<<"目前获得了"<<allscore<<"积分"<<endl<<endl;
cout<<a<<"退出:a/A"<<endl<<endl;
cout<<a<<"全屏:b/B"<<endl<<endl;
cout<<a<<"隐藏光标:c/C"<<endl<<endl;
cout<<a<<"隐藏光标:d/D"<<endl<<endl;
cout<<a<<"获得存档:e/E"<<endl<<endl;
cout<<a<<"打开存档:f/F"<<endl<<endl;
cout<<" 温馨提示:游戏前请切换至大写模式,游戏编号以最后一个字符为准"<<endl<<endl;
cout<<a<<"1.躲避障碍"<<endl<<endl;
cout<<a<<"2.手速射击"<<endl<<endl;
cout<<a<<"3.恐龙跳一跳"<<endl<<endl;
cout<<a<<"4.移动小人"<<endl<<endl;
cout<<a<<"5.扫雷"<<endl<<endl;
cout<<a<<"6.贪吃蛇"<<endl<<endl;
cout<<" ";
}
void write(){/*获得存档*/
reset();
string a,b;
vector<int> c;
int e=allscore;
while(e){
a+=e%10;
e/=10;
}
cout<<"请输入你的游戏昵称:";
string d;
getline(cin,d);
for(int i;i<=d.size();i++){
if(d[i]=='z'){
d[i]='a';
}else if(d[i]>='a'&&d[i]<='z'){
d[i]+=5;
}
}
for(int i=0;i<a.size();i++){
switch(a[i]){
case('0'):
c.push_back(1111);
break;
case('1'):
c.push_back(1110);
break;
case('2'):
c.push_back(1101);
break;
case('3'):
c.push_back(1100);
break;
case('4'):
c.push_back(1011);
break;
case('5'):
c.push_back(1010);
break;
case('6'):
c.push_back(1001);
break;
case('7'):
c.push_back(1000);
break;
case('8'):
c.push_back(0111);
break;
case('9'):
c.push_back(0110);
break;
}
}
cout<<"创建存档完成,存档码:";
for(int i=0;i<c.size();i++){
cout<<c[i];
}
cout<<" "<<d;
cout<<endl;
rest();
main();
}
void read(){/*读取存档*/
reset();
cout<<"请输入存档码:";
char g;
bool e=1;
string a,b;
string s;
getline(cin,s);
for(int i=0;i<s.size();i++){
if(s[i]==' '&&e){
e=0;
}
if(e){
a+=s[i];
}else{
b+=s[i];
}
}
int n;
vector<int> c;
for(int i=0;i<a.size();i+=4){
string d="";
for(int i=0;i<4;i++){
d+=a[i];
}
if(d=="1111"){
c.push_back(0);
n++;
}else if(d=="1110"){
c.push_back(1);
n++;
}else if(d=="1101"){
c.push_back(2);
n++;
}else if(d=="1100"){
c.push_back(3);
n++;
}else if(d=="1011"){
c.push_back(4);
n++;
}else if(d=="1010"){
c.push_back(5);
n++;
}else if(d=="1001"){
c.push_back(6);
n++;
}else if(d=="1000"){
c.push_back(7);
n++;
}else if(d=="0111"){
c.push_back(8);
n++;
}else if(d=="0110"){
c.push_back(9);
n++;
}else{
cout<<"存档开启失败";
main();
}
allscore=0;
}
while(n){
allscore*10+c[n-1];
n-=1;
}
for(int i=b.size()-1;i>=0;i--){
if(b[i]=='a'){
b[i]='z';
}else if(b[i]>='a'&&b[i]<=char('z'+4)){
b[i]-=5;
}
}
player=b;
reset();
cout<<"存档开启成功"<<endl;
rest();
main();
}
void dbza(){/*躲避障碍*/
reset();
int w=10,a=0,fs=0;
while(1){
int d=random(1,18);
for(int n=0;n<10;n++){
for(int i=0;i<10;i++){
for(int t=0;t<20;t++){
if(i==a&&t==d){
cout<<"v";
}else if(i==9&&t==w||(i==8&&t==w)){
cout<<"^";
}else{
cout<<" ";
}if((i==8||i==9)&&(d==w)){
reset();
cout<<"游戏结束,得分:"<<fs;
allscore+=fs;
Sleep(1000);
main();
}
}
cout<<endl;
}
cout<<"A向左,D向右";
a+=1;
if(KEY_DOWN('A')){
w-=1;
}else if(KEY_DOWN('D')){
w+=1;
}
if(w>18){
w=18;
}else if(w<1){
w=1;
}
if(KEY_DOWN('P')){
reset();
rest();
}
Sleep(100);
reset();
}
a=0;
fs+=1;
}
}
void sj(){/*手速射击*/
reset();
int x=0;
cout<<"按K射击";
char map[10][10]={{'\\',' ',' ',' ',' ',' ',' ',' ',' ','/'},
{' ','\\',' ',' ',' ',' ',' ',' ','/',' '},
{' ',' ','\\',' ',' ',' ',' ','/',' ',' '},
{' ',' ',' ','\\',' ',' ','/',' ',' ',' '},
{' ',' ',' ',' ','\\','/',' ',' ',' ',' '},
{' ',' ',' ',' ','/','\\',' ',' ',' ',' '},
{' ',' ',' ','/',' ',' ','\\',' ',' ',' '},
{' ',' ','/',' ',' ',' ',' ','\\',' ',' '},
{' ','/',' ',' ',' ',' ',' ',' ','\\',' '},
{'/',' ',' ',' ',' ',' ',' ',' ',' ','\\'},};
bool cg=0;
Sleep(2000);
Sleep(random(1,10)*100);
reset();
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
cout<<map[i][j];
}
cout<<endl;
}
if(KEY_DOWN('K')){
reset();
cout<<"游戏失败";
Sleep(2000);
main();
}
for(int i=0;i<1000000;i++){
if(KEY_DOWN('K')){
reset();
cout<<"游戏成功,得分:"<<100-i/10000<<endl;
allscore+=(100-i/10000)/10;
Sleep(2000);
cout<<"游戏结束";
Sleep(2000);
cg=1;
break;
}
}
if (cg==0){
reset();
cout<<"游戏失败"<<endl;
Sleep(2000);
cout<<"游戏结束";
Sleep(2000);
}
main();
}
void kltyt(){/*恐龙跳一跳*/
reset();
int z=0,d=30,lc=0,lq=0;
Sleep(2000);
while(1){
for(int n=1;n<=30;n++){
reset();
for(int i=1;i<=25;i++){
cout<<" ";
}
printf("%06d", lc);
cout<<endl<<endl<<endl<<endl;
if(z==1){
cout<<"$";
}
cout<<endl;
for(int i=1;i<=30;i++){
if(i==1&&z==0){
cout<<"$";
}
if(i==d){
cout<<"^";
}else{
cout<<" ";
}
}
cout<<endl;
for(int i=1;i<=30;i++){
cout<<"=";
}
cout<<endl<<"W跳";
if(KEY_DOWN('W')&&lq>=0){
z=1;
lq-=2;
}else{
z=0;
lq+=1;
}
if(KEY_DOWN('P')){
reset();
rest();
}
d-=1;
lc+=1;
if(d==1&&z==0){
reset();
cout<<"游戏失败,路程:"<<lc<<endl;
allscore+=lc/30;
Sleep(2000);
cout<<"游戏结束";
Sleep(2000);
main();
}
Sleep(100);
}
d=30;
}
}
void ydxr(){/*移动小人*/
reset();
cout<<"加载中";
int bx,by;
do{
bx=random(1,9);
}while(bx==5);
do{
by=random(1,9);
}while(by==5);
int x=4,y=4;
reset();
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
if(i==by&&j==bx){
cout<<"¥";
}else if(i==y&&j==x){
cout<<"()";
}else{
cout<<"_.";
}
}
cout<<endl;
}
cout<<"输入提示:W上S下A左D右 '()为人' '¥为宝藏'"<<endl<<"请输入:";
string a;
getline(cin,a);
for(int i=0;i<a.size();i++){
switch(a[i]){
case 'W':
y-=1;
break;
case 'S':
y+=1;
break;
case 'A':
x-=1;
break;
case 'D':
x+=1;
break;
case 'w':
y-=1;
break;
case 's':
y+=1;
break;
case 'a':
x-=1;
break;
case 'd':
x+=1;
break;
}
reset();
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
if(i==by&&j==bx&&i==y&&j==x){
cout<<"(¥)";
}else if(i==by&&j==bx){
cout<<"¥";
}else if(i==y&&j==x){
cout<<"()";
}else{
cout<<"_ ";
}
}
cout<<endl;
}
Sleep(500);
}
if(x==bx&&y==by){
reset();
cout<<"游戏成功,路程:"<<a.size()<<endl;
allscore+=1;
Sleep(2000);
cout<<"游戏结束";
Sleep(2000);
main();
}else{
cout<<"游戏失败"<<endl;
Sleep(2000);
cout<<"游戏结束";
Sleep(2000);
main();
}
}
void sl(){/*扫雷*/
reset();
int pl=0,lx,cx,cy,ly;
int sz[100][100]={0},seemap[100][100]={0},dx[8]={-1,1,0,0,-1,1,-1,1},dy[8]={0,0,-1,1,1,-1,-1,1},sum=0;
for(int i=1;i<=10;i++){
reset();
cout<<"加载中,已加载雷数量:"<<i<<endl;
lx=random(1,10);
ly=random(1,10);
while(sz[lx][ly]==9){
lx=random(1,10);
ly=random(1,10);
}
sz[lx][ly]=9;
for(int o=0;o<8;o++){
if(sz[lx+dx[o]][ly+dy[o]]!=9){
sz[lx+dx[o]][ly+dy[o]]+=1;
}
}
}
reset();
cout<<"加载完成";
while(1){
reset();
cout<<" ";
for(int i=1;i<=10;i++){
printf("%3.d ",i);
}
cout<<endl;
for(int i=0;i<=9;i++){
for(int j=-1;j<=9;j++){
if(j==-1){
printf("%2.d ",i+1);
continue;
}
if(seemap[i][j]==1){
cout<<" "<<sz[i][j]<<" ";
}else if(seemap[i][j]==0){
cout<<" __ ";
}
}
cout<<endl<<endl;
}
Sleep(1000);
if(sum>=90){
reset();
cout<<"游戏成功"<<endl;
allscore+=15;
Sleep(2000);
cout<<"游戏结束";
Sleep(2000);
main();
}
cout<<"请输入需要排查的地方在第几列:";
cin>>cx;
cout<<endl<<"请输入需要排查的地方在第几行:";
cin>>cy;
while(cx<1||cx>10){
cout<<endl<<"请重新输入需要排查的地方在第几列:";
cin>>cx;
}
while(cy<1||cy>10){
cout<<endl<<"请重新输入需要排查的地方在第几行:";
cin>>cy;
}
cy-=1;
cx-=1;
swap(cy,cx);
int ch=sz[cx][cy];
if(ch==9){
reset();
cout<<"游戏失败"<<endl;
Sleep(2000);
cout<<"游戏结束";
Sleep(2000);
main();
}
if(seemap[cx][cy]!=1){
sum+=1;
}
queue<int> x,y;
x.push(cx);
y.push(cy);
seemap[cx][cy]=1;
while(!(x.empty()&&y.empty())){
int nx=x.front();
int ny=y.front();
x.pop();
y.pop();
for(int i=0;i<4;i++){
int tx=nx+dx[i];
int ty=ny+dy[i];
if(0<=tx&&tx<10&&0<=ty&&ty<10&&((sz[tx][ty]==ch)||(sz[tx][ty]!=8&&sz[tx][ty]==char(ch+1)))&&seemap[tx][ty]==0){
x.push(tx);
y.push(ty);
seemap[tx][ty]=1;
sum+=1;
}
}
}
}
}
void tcs(){/*贪吃蛇*/
reset();
int nx=4,ny=4,score=0,abcd,sp=0,ax,ay,ox=3,oy=3,fa=3,ti=5;
char zf;
abcd%=4;
ax=random(1,9);
ay=random(1,9);
queue<int> x,y,x1,x2;
x.push(4);
y.push(4);
while(1){
reset();
cout<<"分数:"<<score<<","<<"冷却时间:"<<ti<<"/5"<<endl;
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
bool c=1;
for(int d=0;d<x.size()-1;d++){
if(j==x.front()&&i==y.front()){
zf='*';
c=0;
}
x.push(x.front());
y.push(y.front());
x.pop();
y.pop();
}
if(j==x.front()&&i==y.front()){
if(j==ax&&i==ay){
score+=1;
x.push(ox);
y.push(oy);
for(int d=0;d<x.size()-1;d++){
x.push(x.front());
y.push(y.front());
x.pop();
y.pop();
}
ax=random(1,9);
ay=random(1,9);
}
switch(abcd){
case 1:
zf='^';
break;
case 2:
zf='V';
break;
case 3:
zf='<';
break;
case 4:
zf='>';
break;
}
c=0;
}
if(j==ax&&i==ay){
zf='X';
c=0;
}
x.push(x.front());
y.push(y.front());
ox=x.front();
oy=y.front();
x.pop();
y.pop();
if(c){
cout<<"_ ";
}else{
cout<<zf<<" ";
}
}
cout<<endl;
}
cout<<"W上S下A左D右P暂停F加速 'O为蛇头' 'X为苹果'";
if(KEY_DOWN('W')){
abcd=1;
}
if(KEY_DOWN('S')){
abcd=2;
}
if(KEY_DOWN('A')){
abcd=3;
}
if(KEY_DOWN('D')){
abcd=4;
}
if(KEY_DOWN('P')){
reset();
rest();
}
if(KEY_DOWN('F')&&fa==3&&ti>=5){
fa=1;
ti=0;
}
if(fa<3){
fa+=1;
}
if(ti<5){
ti+=1;
}
if(nx>=10||ny>=10||nx<0||ny<0){
reset();
cout<<"游戏失败,分数:"<<score<<endl;
allscore+=score;
Sleep(2000);
cout<<"游戏结束";
Sleep(2000);
main();
}
if(sp%fa==0){
switch(abcd){
case 1:
ny-=1;
break;
case 2:
ny+=1;
break;
case 3:
nx-=1;
break;
case 4:
nx+=1;
break;
}
x.pop();
y.pop();
x.push(nx);
y.push(ny);
}
sp+=1;
Sleep(100);
}
}
int main(){
reset();
string yx;
start();
cout<<"请选择游戏,游戏编号:";
getline(cin,yx);
while(1){
switch(yx[yx.size()-1]){
case 'a':
exit(0);
break;
case 'b':
all();
break;
case 'c':
hide();
break;
case 'd':
see();
break;
case 'e':
write();
break;
case 'f':
read();
break;
case 'A':
exit(0);
break;
case 'B':
all();
break;
case 'C':
hide();
break;
case 'D':
see();
break;
case 'E':
write();
break;
case 'F':
read();
break;
case '1':
dbza();
break;
case '2':
sj();
break;
case '3':
kltyt();
break;
case '4':
ydxr();
break;
case '5':
sl();
break;
case '6':
tcs();
break;
default:
start();
cout<<"没有找到这个游戏,请重新选择游戏,游戏编号:";
getline(cin,yx);
}
}
}