高级守护
c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!c++游戏!!!!!
中级天翼
扫雷(自己编的):
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int x1,x2,cnt=0,xx,c,d,cs_;
char a[10][10];
char w[10][10];
bool tw[10][10];
int dir[8][2]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
int nx,ny,t;
void out(string);
bool pd();
void xz(int,int);
bool k=1;
int main(){
system("color 2E");
out("您已进入扫雷游戏,是否继续?\n1.继续 2.不继续\n");
cin>>t;
if(t==2)
return 0;
int sl,tt;
system("cls");
out("请输入你要玩几次(不能超过100):");
cin>>cs_;
system("cls");
if(cs_>100||cs_<1)cs_=1;
while(cs_--){
memset(a,'?',sizeof(a));
memset(w,' ',sizeof(w));
out("请输入你需要地雷的数量(不能超过63个,不能低于5个):");
cin>>sl;
if(sl<5||sl>63){
system("cls");
out("您的地雷数量不符合要求,请重新输入(不能超过63个,不能低于5个):");
cin>>sl;
if(sl<5||sl>63){
out("看不懂中文的不要玩我的游戏!!!");
Sleep(2000);
return 0;
}
}
srand(time(0));
system("cls");
out("请稍后.");
Sleep(29);
while(sl){
sl--;
nx=rand()%8+1;
ny=rand()%8+1;
if(w[nx][ny]!='h')w[nx][ny]='h';
else sl++;
}
cout<<".";
Sleep(30);
cout<<'.';
system("cls");
k=1;
while(1){
if(pd())break;
for(int i=1;i<=8;i++){
cout<<"第"<<i<<"行 ";
for(int j=1;j<=8;j++)
cout<<' '<<a[i][j];
cout<<endl;
}
cout<<" ";
for(int i=1;i<=8;i++){
cout<<i;
cout<<' ';
}
cout<<endl;
out("请确定一个你选中的格子\n");
Sleep(1000);
out("请输入这个格子所在的行和列(格式:行 列):");
cin>>x1>>x2;
if(x1>8||x1<1||x2>8||x2<1){
cout<<"超出了地图范围!!!";
Sleep(1500);
system("cls");
continue;
}
if(w[x1][x2]=='h'){
system("cls");
for(int i=1;i<=8;i++){
for(int j=1;j<=8;j++){
if(w[i][j]=='h')
cout<<"雷";
else cout<<" ";
}
cout<<endl;
}
Sleep(3000);
break;
}
else{
memset(tw,0,sizeof(tw));
xz(x1,x2);
}
system("cls");
}
if(pd()){
out("成功啦!!!");
Sleep(3000);
}
system("cls");
}
out("你成功的完成了扫雷游戏,欢迎下次再来!!!");
return 0;
}//30
void out(string cut){
for(int i=0;i<cut.size();i++){
cout<<cut[i];
Sleep(30);
}
}
bool pd(){
for(int i=1;i<=8;i++)
for(int j=1;j<=8;j++)
if(a[i][j]=='?'&&w[i][j]==' ')return 0;
return 1;
}
void xz(int x,int y){
cnt=0;
for(int i=0;i<8;i++){
nx=x+dir[i][0];
ny=y+dir[i][1];
if(w[nx][ny]=='h')cnt++;
}
a[x][y]=cnt+'0';
if(cnt!=0)
return ;
tw[x][y]=1;
for(int i=0;i<8;i++){
nx=x+dir[i][0];
ny=y+dir[i][1];
if(nx>=1&&nx<=8&&ny>=1&&ny<=8&&!tw[nx][ny])
xz(nx,ny);
}
}
资深守护
下落的小鸟:
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<time.h>
#include<Windows.h>
/********函数变量声明********/
#define PR_Box printf("■")
#define PR_Gold printf("★")
#define PR_Ag printf("☆")
#define PR_FBird printf("○")
#define PR_DBird printf("Ф")
#define PR_Land printf("┳┳┯")
#define PR_Bg_TL printf("╔")
#define PR_Bg_TR printf("╗")
#define PR_Bg_DL printf("╚")
#define PR_Bg_DR printf("╝")
#define PR_Bg_X printf("═")
#define PR_Bg_Y printf("║")
#define PR_Blank printf(" ");
int Grade = 1, C_Gold = 0, C_Ag = 0, Score = 0, Delay_time = 1000, Max_blank = 9, Distance = 18;
struct Birds
{
int x, y;
int condition;
};
Birds *Bird = (Birds*)malloc(sizeof(Birds));
struct Bg
{
int x, y;
int l_blank;
int reward[9];
Bg *pri;
Bg *next;
};
Bg *Bg1 = new Bg[sizeof(Bg)];
void Position(int x, int y)
{
COORD pos = { x - 1, y - 1 };
HANDLE Out = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(Out, pos);
}
void CreatBird()
{
Bird->x = 41;
Bird->y = 10;
Bird->condition = 0;
}
void CreatBg()
{
Bg *Bg2 = (Bg*)malloc(sizeof(Bg));
Bg1->x = 90; Bg1->y = 8;
Bg2->x = Bg1->x + Distance; Bg2->y = 9;
Bg1->l_blank = Max_blank - Grade;
Bg2->l_blank = Max_blank - Grade;
Bg1->next = Bg2;
Bg1->pri = Bg2;
Bg2->next = Bg1;
Bg2->pri = Bg1;
}
void InsertBg(Bg *p)
{
int temp;
Bg *Bgs = (Bg*)malloc(sizeof(Bg));
Bgs->x = p->pri->x + Distance;
Bgs->l_blank = Max_blank - Grade;
srand((int)time(0));
temp = rand();
if (temp % 2 == 0)//++
{
if ((temp % 4 + p->pri->y + Max_blank - Grade)<21)
Bgs->y = p->pri->y + temp % 4;
else
Bgs->y = p->pri->y;
}
else
{
if ((p->pri->y - temp % 4)>2)
Bgs->y = p->pri->y - temp % 4;
else
Bgs->y = p->pri->y;
}
Bgs->pri = p->pri;
Bgs->next = p;
p->pri->next = Bgs;
p->pri = Bgs;
}
void Check_Bg(Bg *q)
{
Bg *p = q; int i = 0, temp;
while (++i <= 5)
{
if (p->x>-4)
p = p->next;
else
{
srand((int)time(0));
temp = rand();
if (temp % 2 == 0)//++
{
if ((temp % 4 + p->y + Max_blank - Grade)<21)
p->y = p->y + temp % 4;
else
p->y = p->y;
p->x = p->pri->x + Distance;
p->l_blank = Max_blank - Grade;
}
else
{
if ((p->y - temp % 4)>2)
p->y = p->y - temp % 4;
else
p->y = p->y;
p->x = p->pri->x + Distance;
p->l_blank = Max_blank - Grade;
}
}
}
}
void Loop_Bg(Bg *q)
{
Bg *p = q; int i = 0;
while (++i <= 5)
{
p->x = p->x - 1;
p = p->next;
if (Bird->x == p->x)
{
Score += 1;
if (Score % 4 == 0 && Grade<4)
Grade++;
}
}
}
void Prt_Bg(Bg *q)
{
Bg *p = q; int i = 0, k, j;
while (++i <= 5)
{
if (p->x>0 && p->x <= 78)
{
for (k = 2; k<p->y; k++)
{
Position(p->x + 1, k);
PR_Box; PR_Box; PR_Blank
}
Position(p->x, p->y);
PR_Box; PR_Box; PR_Box; PR_Blank;
Position(p->x, p->y + p->l_blank);
PR_Box; PR_Box; PR_Box; PR_Blank;
k = k + p->l_blank + 1;
for (k; k <= 22; k++)
{
Position(p->x + 1, k);
PR_Box; PR_Box; PR_Blank;
}
Position(p->x, 23);
for (k = 1; k<Distance / 3 - 2; k++)
PR_Land;
}
p = p->next;
if (p->x == 0)
{
for (j = 2; j<p->y; j++)
{
Position(p->x + 1, j);
PR_Blank; PR_Blank;
}
Position(p->x + 1, p->y);
PR_Blank; PR_Blank; PR_Blank;
Position(p->x + 1, p->y + Max_blank - Grade);
PR_Blank; PR_Blank; PR_Blank;
j = j + Max_blank - Grade + 1;
for (j; j <= 22; j++)
{
Position(p->x + 1, j);
PR_Blank; PR_Blank;
}
}
}
}
void PrtBg()
{
int i;
Position(1, 1); PR_Bg_TL;
Position(79, 1); PR_Bg_TR;
Position(1, 24); PR_Bg_DL;
Position(79, 24); PR_Bg_DR;
for (i = 3; i <= 78; i += 2)
{
Position(i, 1); PR_Bg_X;
Position(i, 24); PR_Bg_X;
}
/*for(i=2;i<=23;i++)
{ Position(1,i);PR_Bg_Y;printf("%d",i-1);
Position(79,i);PR_Bg_Y;
}*/
}
void PrtBird()
{
Position(Bird->x, Bird->y - 1);
PR_Blank;
Position(Bird->x, Bird->y);
PR_FBird;
Position(38, 2);
printf("分数:%d", Score);
}
int CheckYN(Bg *q)
{
Bg *p = q; int i = 0;
while (++i <= 5)
{
if (Bird->y>23)
return 0;
if (Bird->x == p->x&&Bird->y <= p->y)
return 0;
if ((Bird->x == p->x || Bird->x == p->x + 1 || Bird->x == p->x + 2) && Bird->y == p->y)
return 0;
if (Bird->x == p->x&&Bird->y>p->y + p->l_blank)
return 0;
if ((Bird->x == p->x || Bird->x == p->x + 1 || Bird->x == p->x + 2) && Bird->y == p->y + p->l_blank)
return 0;
p = p->next;
}
return 1;
}
void Prtfirst()
{
printf("══════════════════════════════════════\n");
printf(" ■■ ■■\n");
printf(" ■■ ■■\n");
printf(" ■■ ■■ C++语言版 Flappy Bird\n");
printf(" ■■ ■■ 瞎搞人:欧阳语聪\n");
printf(" ■■ ■■ 瞎搞日期:2014.2\n");
printf(" ■■ ■■ 耗时:4小时\n");
printf(" ■■■ ■■ 游戏说明:\n");
printf(" ■■ 1-按上箭头使鸟起飞\n");
printf(" ■■ 2-等级越高,难度越大!\n");
printf(" Ю123 ■■■\n");
printf("\n");
printf(" ■■■ 欢迎各路大佬与我探讨哦!\nC++、VB、PHP、C#\n");
printf(" ■■\n");
printf(" ■■\n");
printf(" ■■ ■■■ \n");
printf(" ■■ ■■\n");
printf(" ■■ Ф ■■\n");
printf(" ■■ ■■\n");
printf(" ■■ ■■\n");
printf(" ■■ ■■\n");
printf(" ■■ ■■\n");
printf(" ┳┳┯┳┳┯┳┳┯┳┳┯┳┳┯┳┳┯┳┳┯┳┳┯┳┳┯┳┳┯┳┳┯┳┳┯┳\n");
system("pause");
Position(1, 1);
int i = 0;
while (i++<40 * 25)
PR_Blank;
}
int main()
{
int i = 0; char ch;
Prtfirst();
PrtBg();
CreatBg();
InsertBg(Bg1);
InsertBg(Bg1);
InsertBg(Bg1);
CreatBird();
while (1)
{
if (!CheckYN(Bg1))
break;
Check_Bg(Bg1);
Prt_Bg(Bg1);
PrtBird();
Loop_Bg(Bg1);
Bird->y = Bird->y + 1;
if (GetAsyncKeyState(VK_UP))
{
Position(Bird->x, Bird->y - 1);
PR_Blank;
Bird->y = Bird->y - 4;
}
while (i++<500);
{
Sleep(100);
}
i = 0;
}
Position(38, 10);
printf("You Lost!");
Position(1, 25);
system("pause");
return 0;
}
贪吃蛇:
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<conio.h>
typedef struct snake
{
int a;
int b;
struct snake *u;
struct snake *n;
}snake,*snake1;
typedef struct food
{
int a;
int b;
}food;
int main()
{
char c,c0 = 'd';
int i,j,k,n=1,t,at;
snake p,q;
snake *dd,*dd0,*dd1,*dd2;
food f;
srand(time(NULL));
p.u = NULL;
p.n = &q;
p.a = 5;p.b = 6;q.a = 5;q.b = 5;
q.u = &p;q.n = NULL;
dd=dd2= &q;
f.a=(rand()%15+1);
f.b=(rand()%15+1);
while(1)
{
srand(time(NULL));
system("cls");
for(i = 0;i < 17;i ++)
{
for(j = 0; j < 17;j++)
{
if(i == 0 )
printf("▁");
else if(i == 16)
printf("▔");
else if(j == 0)
printf("▕");
else if(j == 16)
printf("▏");
else if(i == p.a && j == p.b)
printf("■");
else if(i == f.a && j == f.b)
printf("★");
else
{
t = 0;
dd = dd2;
for(k = 0; k < n ;k++)
{
if(i == dd->a && j == dd->b)
{
printf("□");
t = 1;
break;
}
dd = dd->u;
}
if(t == 0)
printf(" ");
}
}printf("\n");
}
at = 0;
dd =dd2;
for(i=0;i<n;i++)
{
if(p.a == dd->a && p.b == dd->b)
{
printf("game over!!\n");
exit(0);
}
dd = dd->u;
}
if(p.a == f.a && p.b == f.b)
{
dd = dd2;
at =1;
f.a = (rand()%15+1);
f.b = (rand()%15+1);
for(i=0;i<n;i++)
{
if(f.a == dd->a && f.b == dd->b)
{
f.a = dd2->a;
f.b = dd2->b;
break;
}
}
n++;
}
if(kbhit())
{
c = getch();
dd = dd2;
if(c == 'w' && c0 != 's')
{
if(at == 1)
{
dd0 =(snake1)malloc(sizeof(snake));
dd0->a = dd2->a;dd0->b = dd2->b;
dd0->n = NULL;dd0->u = dd2;
dd2=dd0;
}
dd = dd2;
for(i = 0; i<n ; i++)
{
dd1 = dd->u;
dd->b = dd1->b;
dd->a = dd1->a;
dd = dd->u;
}
if(p.a == 1)
p.a = 15;
else
p.a = (p.a-1)%15;
}
else if(c == 's' && c0 != 'w')
{
if(at == 1)
{
dd0 =(snake1)malloc(sizeof(snake));
dd0->a = dd2->a;dd0->b = dd2->b;
dd0->n = NULL;dd0->u = dd2;
dd2=dd0;
}
dd = dd2;
for(i = 0; i<n ; i++)
{
dd1 = dd->u;
dd->b = dd1->b;
dd->a = dd1->a;
dd = dd->u;
}
p.a = (p.a%15)+1;
}
else if(c == 'a' && c0 != 'd')
{
if(at == 1)
{
dd0 =(snake1)malloc(sizeof(snake));
dd0->a = dd2->a;dd0->b = dd2->b;
dd0->n = NULL;dd0->u = dd2;
dd2=dd0;
}
dd = dd2;
for(i = 0; i<n ; i++)
{
dd1 = dd->u;
dd->b = dd1->b;
dd->a = dd1->a;
dd = dd->u;
}
if(p.b == 1)
p.b = 15;
else
p.b = (p.b-1)%15;
}
else if(c == 'd' && c0 != 'a')
{
if(at == 1)
{
dd0 =(snake1)malloc(sizeof(snake));
dd0->a = dd2->a;dd0->b = dd2->b;
dd0->n = NULL;dd0->u = dd2;
dd2=dd0;
}
dd = dd2;
for(i = 0; i<n ; i++)
{
dd1 = dd->u;
dd->b = dd1->b;
dd->a = dd1->a;
dd = dd->u;
}
p.b = (p.b%15)+1;
}
else
{
goto qq;
}
c0 = c;
}
else
{
qq: if(c0 == 'w')
{
if(at == 1)
{
dd0 =(snake1)malloc(sizeof(snake));
dd0->a = dd2->a;dd0->b = dd2->b;
dd0->n = NULL;dd0->u = dd2;
dd2=dd0;
}
dd = dd2;
for(i = 0; i<n ; i++)
{
dd1 = dd->u;
dd->b = dd1->b;
dd->a = dd1->a;
dd = dd->u;
}
if(p.a == 1)
p.a = 15;
else
p.a=(p.a-1)%15;
}
else if(c0 == 's')
{
if(at == 1)
{
dd0 =(snake1)malloc(sizeof(snake));
dd0->a = dd2->a;dd0->b = dd2->b;
dd0->n = NULL;dd0->u = dd2;
dd2=dd0;
}
dd = dd2;
for(i = 0; i<n ; i++)
{
dd1 = dd->u;
dd->b = dd1->b;
dd->a = dd1->a;
dd = dd->u;
}
p.a=(p.a%15)+1;
}
else if(c0 == 'a')
{
if(at == 1)
{
dd0 =(snake1)malloc(sizeof(snake));
dd0->a = dd2->a;dd0->b = dd2->b;
dd0->n = NULL;dd0->u = dd2;
dd2=dd0;
}
dd = dd2;
for(i = 0; i<n ; i++)
{
dd1 = dd->u;
dd->b = dd1->b;
dd->a = dd1->a;
dd = dd->u;
}
if(p.b == 1)
p.b = 15;
else
p.b=(p.b-1)%15;
}
else if(c0 == 'd')
{
if(at == 1)
{
dd0 =(snake1)malloc(sizeof(snake));
dd0->a = dd2->a;dd0->b = dd2->b;
dd0->n = NULL;dd0->u = dd2;
dd2=dd0;
}
dd = dd2;
for(i = 0; i<n ; i++)
{
dd1 = dd->u;
dd->b = dd1->b;
dd->a = dd1->a;
dd = dd->u;
}
p.b=(p.b%15)+1;
}
}
fflush(stdin);
dd = &q;
_sleep(200);
}
}
有两个哦