#include <bits/stdc++.h>
#include<windows.h>
#include<stdio.h>
#include<conio.h>
#include<windows.h>
#include<time.h>
using namespace std;
char sd;long long int x[3],w;
string k,b="机器人",xm,d;
#define W 40
#define H 40
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
struct snake{
int x,y;
};
snake snakes[W*H];
int len = 0;
char dir = 'd';
int foodx = 0,foody = 0;
int FPS = 200;
int score = 0, speed = (220-FPS)/20;
void HideCursor(){
CONSOLE_CURSOR_INFO cursor_info = {1, 0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
}
void setPos(int x,int y) {
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
HANDLE hConsoleOut;
hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(hConsoleOut,&csbiInfo);
csbiInfo.dwCursorPosition.X = x;
csbiInfo.dwCursorPosition.Y = y;
SetConsoleCursorPosition(hConsoleOut,csbiInfo.dwCursorPosition);
}
void COLOR_PRINT(const char* s, int color){
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | color);
printf(s);
SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | 7);
}
bool GameOver(){
snake t = snakes[0];
if(t.x >= W-1 || t.x <= 0 || t.y >= H-1 || t.y <= 0){
return true;
}
for(int i=3;i<=len-1;i++){
if(t.x == snakes[i].x && t.y == snakes[i].y){
return true;
}
}
return false;
}
bool inSnake(int x, int y){
for(int i=0;i<len;i++){
if(snakes[i].x == x && snakes[i].y == y) return false;
}
return true;
}
void createFood(){
srand(time(NULL));
while(1){
foodx = rand()%(W-2)+1;
foody = rand()%(H-2)+1;
if(inSnake(foodx,foody)) return;
}
}
void init(){
len = 4;
snakes[0].x = 2;
snakes[0].y = 2;
for(int i=1;i<len;i++){
snakes[i].x = snakes[i-1].x + 1;
snakes[i].y = snakes[i-1].y;
}
createFood();
}
void tips(){
setPos(W*2+4, 3);
printf("游戏说明:\n");
setPos(W*2+4, 5);
printf("按W A S D 或者 ↑ ↓ ← → 操控游戏\n");
setPos(W*2+4, 7);
printf("按Q减速,按E加速\n");
setPos(W*2+4, 9);
printf("当前食物分数:%d\n", 100+10*speed);
setPos(W*2+4, 11);
printf("当前速度:%d\n", speed);
setPos(W*2+4, 13);
printf("总 分:%d\n", score);
}
void draw(){
for(int i=0;i<W;i++){
for(int j=0;j<H;j++){
if(i==0 || j==0 || i == W-1 || j == H-1) {
setPos(i*2,j);
printf("■");
}
}
}
for(int i=0;i<len;i++){
setPos(snakes[i].x*2,snakes[i].y);
if(i == 0) COLOR_PRINT("■", 4);
else COLOR_PRINT("■", 1);
}
setPos(foodx*2,foody);
COLOR_PRINT("■", 10);
FPS = min(FPS, 200);
FPS = max(FPS, 60);
speed = (220-FPS)/20;
tips();
}
void move(){
int dx = 0, dy = 0;
if(dir == 'u') dy = -1;
else if(dir == 'd') dy = 1;
else if(dir == 'l') dx = -1;
else if(dir == 'r') dx = 1;
setPos(snakes[len-1].x*2,snakes[len-1].y);
printf(" ");
for(int i=len-1;i>=1;i--){
snakes[i].x = snakes[i-1].x;
snakes[i].y = snakes[i-1].y;
}
snakes[0].x = snakes[0].x + dx;
snakes[0].y = snakes[0].y + dy;
}
void keyDown(){
char key;
while(kbhit()) key = _getch(); switch(key){
case 'W':
case 'w':
case 72:
if(dir != 'd') dir = 'u';
break;
case 'S':
case 's':
case 80:
if(dir != 'u') dir = 'd';
break;
case 'A':
case 'a':
case 75:
if(dir != 'r') dir = 'l';
break;
case 'D':
case 'd':
case 77:
if(dir != 'l') dir = 'r';
break;
case 'E':
case 'e':
FPS -= 20;
break;
case 'Q':
case 'q':
FPS += 20;
break;
}
}
void eatFood(){
if(snakes[0].x == foodx && snakes[0].y == foody){
len++;
for(int i=len-1;i>=1;i--){
snakes[i].x = snakes[i-1].x;
snakes[i].y = snakes[i-1].y;
}
snakes[0].x = foodx;
snakes[0].y = foody;
setPos(foodx*2,foody);
printf(" ");
score += 100+speed*10;
createFood();
}
}
int main(){
char cpp='2';
srand(time(0));
int s1 = rand ()% 3;
cout<<"欢迎使用poki盗版游戏库"<<endl<<"请输入你的名字:";
cin>>xm;
cout<<"好的,"<<xm;
while(cpp=='2'){
cout<<"请输入你想玩的游戏:"<<endl <<"A.石头剪刀布 B.盗版和平精英 C.贪吃蛇 D.我的世界" ;
cout<<endl<<"温馨提示:抵制不良游戏,拒绝盗版游戏。 注意自我保护,谨防受骗上当。 适度游戏益脑,沉迷游戏伤身。 合理安排时间,享受健康生活。";
cout<<endl<<endl<<endl<<endl;
cin>>sd;
if(sd=='A'){
cout<<endl<<endl<<"开始游戏"<<endl;
time_t t;
srand((unsigned)time(&t));
printf("游戏规则:每次输入一个字母:A.剪刀、B.石头、C、布(请用大写字母)\n由系统再出一个字母.本局游戏采用6胜制,胜者积一分,败者不加分,先到六分者胜。\n\n");
again:
printf("\n 石头剪刀布!!");
while(x[1]<6&&x[2]<6)
{
w=(rand()%33333)%3;
printf("\n\n请选择:");
cin>>k;
cout<<b;
if(w==0)
{
printf(":布");
d="布";
}
else if(w==1)
{
printf(":剪刀");
d="剪刀";
}
else
{
printf(":石头");
d="石头";
}
printf("\n");
cout<<xm;
if(k=="C")
{
printf(":布");
k="布";
}
else if(k=="A")
{
printf(":剪刀");
k="剪刀";
}
else if(k=="B")
{
printf(":石头");
k="石头";
}
printf("\n");
if(k==d)printf("平局");
else if(k=="石头"&&d=="剪刀"||k=="剪刀"&&d=="布"||k=="布"&&d=="石头")
{
cout<<xm;
printf("获胜!");
x[1]++;
}
else if(d=="石头"&&k=="剪刀"||d=="剪刀"&&k=="布"||d=="布"&&k=="石头")
{
cout<<b;
printf("获胜!");
x[2]++;
}
else
{
printf("在输神马??!!");
continue;
}
for(long long int i=1;i<=2;i++)
{
printf("\n");
if(i==1)cout<<xm;
else cout<<b;
if(x[i]==0)printf(":暂无赢的场次");
else if(x[i]==1)printf(":赢一局");
else if(x[i]==2)printf(":赢二局");
else if(x[i]==3)printf(":赢三局");
else if(x[i]==4)
{
printf(":赢四局");
if(i==2);
else ;
}
else if(x[i]==5)printf(":赢五局");
else if(x[i]==6)printf(":赢六局");
}
}
printf("\n\n\n");
if(x[1]==6)cout<<xm;
else cout<<b;
printf("获胜");
}
if(sd=='B') {
cout << "温馨提示:" << endl;
cout << "沉迷游戏伤眼" << endl;
cout << "适当游戏益脑" << endl;
cout << "每日签到:今天500枚金币。敲1签到,敲2退出每日签到。" << endl;
int a;
cin >> a;
if (a == 1) {
cout << "\033[30m";
cout << "正准备上飞机中---" ;
cout << "--------";
cout << "已上飞机。" << endl;
} else if (a == 2) {
cout << "正在准备上飞机中---" ;
cout << "--------";
cout << "已上飞机。" << endl;
} else {
cout << "\033[31m";
cout << "游戏自动判错," << endl;
cout << "请重做!" << endl;
return 0;
}
cout << "\033[37m";
cout << "默认你落学校。" << endl;
cout << "你已到学校门前。" << endl;
cout << "前面是学校,你进不进去。" << endl;
cout << "进去选1,不进去选2。" << endl;
cout << "答案:";
int b;
cin >> b;
if (b == 1) {
cout << "\033[32m";
cout << "你进去了,顺便也躲过了敌人的追击。" << endl;
} else if (b == 2) {
cout << "\033[31m";
cout << "你站在门前,被敌人用AK射死了。" << endl;
cout << "再接再厉,下次吃鸡。" << endl;
cout << "谢谢!" << endl;
return 0;
} else {
cout << "\033[31m";
cout << "游戏自动判错," << endl;
cout << "请重做!" << endl;
return 0;
}
cout << "\033[32m";
cout << "现在,你看到学校桌子底下有一把M24,可是他在一间教室里面,你怎么进去进去?" << endl;
cout << "直接从门口进选1,翻窗进选2。" << endl;
cout << "答案:";
int c;
cin >> c;
if (c == 1) {
cout << "\033[31m";
cout << "那是敌人的埋伏,你刚进去就被敌人用平底锅敲死了。" << endl;
cout << "再接再厉,下次吃鸡。" << endl;
cout << "谢谢!" << endl;
return 0;
} else if (c == 2) {
cout << "\033[34m";
cout << "那是敌人的埋伏,翻窗进是个明智的选择。" << endl;
} else {
cout << "\033[31m";
cout << "游戏自动判错," << endl;
cout << "请重做!" << endl;
return 0;
}
cout << "现在,你看见敌人,敌人却没发现你。" << endl;
cout << "你悄悄地走过去打他选1,先滚过去拿M24选2。" << endl;
cout << "答案:";
int d;
cin >> d;
if (d == 1) {
cout << "敌人没发现你,你大力一拳,把他干掉了。得到了他的平底锅和桌子底下的M24。" << endl;
} else if (d == 2) {
cout << "\033[31m";
cout << "你滚过去,敌人发现了你,而且枪也没子弹。你死了!" << endl;
cout << "再接再厉,下次吃鸡。" << endl;
cout << "谢谢!" << endl;
return 0;
} else {
cout << "\033[31m";
cout << "游戏自动判错," << endl;
cout << "请重做!" << endl;
return 0;
}
cout << "现在,你要出学校,突然,你听到学校大门有脚步声。" << endl;
cout << "翻窗逃跑选1,从正门逃跑选2。" << endl;
cout << "答案:";
int e;
cin >> e;
if (e == 1) {
cout << "\033[31m";
cout << "窗户外有埋伏,你死了。" << endl;
cout << "再接再厉,下次吃鸡。" << endl;
cout << "谢谢!" << endl;
return 0;
} else if (e == 2) {
cout << "正门前面是两个穷光蛋,身上什么也没有。被你用平底锅干掉了。" << endl;
} else {
cout << "\033[31m";
cout << "游戏自动判错," << endl;
cout << "请重做!" << endl;
return 0;
}
cout << "现在,你出不出去?" << endl;
cout << "出去选1,不出去选2。" << endl;
cout << "答案:";
int f;
cin >> f;
if (f == 1) {
cout << "有人往学校扔手雷,你躲过了手雷的轰炸。" << endl;
} else if (f == 2) {
cout << "\033[31m";
cout << "有人往学校扔手雷,你被炸死了。" << endl;
cout << "再接再厉,下次吃鸡。" << endl;
cout << "谢谢!" << endl;
return 0;
} else {
cout << "\033[31m";
cout << "游戏自动判错," << endl;
cout << "请重做!" << endl;
return 0;
}
cout << "现在,你要去P城,有一辆吉普车和一辆摩托车。" << endl;
cout << "坐吉普车去选1,坐摩托车选2。" << endl;
cout << "答案:";
int g;
cin >> g;
if (g == 1) {
cout << "\033[31m";
cout << "吉普车有故障,你刚踩油门车就爆炸了。你死了。" << endl;
cout << "再接再厉,下次吃鸡。" << endl;
cout << "谢谢!" << endl;
return 0;
} else if (g == 2) {
cout << "你开摩托车顺利地到达了P城。" << endl;
} else {
cout << "\033[31m";
cout << "游戏自动判错," << endl;
cout << "请重做!" << endl;
return 0;
}
cout << "现在,你在P城。" << endl;
cout << "消灭敌人选1,寻找物资选2。" << endl;
cout << "答案:";
int h;
cin >> h;
if (h == 1) {
cout << "\033[31m";
cout << "你现在紧缺补给品,没解决敌人,反而被敌人解决了你。" << endl;
cout << "再接再厉,下次吃鸡。" << endl;
cout << "谢谢!" << endl;
return 0;
} else if (h == 2) {
cout << "你现在紧缺物资,寻找物资是第一步。" << endl;
} else {
cout << "\033[31m";
cout << "游戏自动判错," << endl;
cout << "请重做!" << endl;
return 0;
}
cout << "现在,有一栋豪华的房子,你进不进去?" << endl;
cout << "进选1,不进选2。" << endl;
cout << "答案:";
int i;
cin >> i;
if (i == 1) {
cout << "外面是敌人,你真幸运。" << endl;
} else if (i == 2) {
cout << "\033[31m";
cout << "突然,一个人开着车,把你给##了。" << endl;
cout << "再接再厉,下次吃鸡。" << endl;
cout << "谢谢!" << endl;
return 0;
} else {
cout << "\033[31m";
cout << "游戏自动判错," << endl;
cout << "请重做!" << endl;
return 0;
}
cout << "现在,你在房子里找到了一把98K,子弹,5个绷带,3个医疗箱和1瓶能量饮料。突然,有一个全副武装的人进了来。" << endl;
cout << "你直接跟他硬对硬选1,翻窗逃跑选2。" << endl;
cout << "答案:";
int j;
cin >> j;
if (j == 1) {
cout << "那个人是个萌新,不知道怎么开枪,被你干掉了。你得到他的三级头,三级甲,三级包和AWM。" << endl;
} else if (j == 2) {
cout << "\033[31m";
cout << "你刚落地,就被人开车轧死了。" << endl;
cout << "再接再厉,下次吃鸡。" << endl;
cout << "谢谢!" << endl;
return 0;
} else {
cout << "\033[31m";
cout << "游戏自动判错," << endl;
cout << "请重做!" << endl;
return 0;
}
cout << "现在,你已经拥有足够的补给品和装备。" << endl;
cout << "去消灭敌人选1,不去选2。" << endl;
cout << "答案:";
int k;
cin >> k;
if (k == 1) {
cout << "你已经拥有足够的物品,消灭敌人才是胜利的关键。" << endl;
} else if (k == 2) {
cout << "\033[31m";
cout << "你没去消灭敌人,反而敌人去把你消灭了。" << endl;
cout << "再接再厉,下次吃鸡。" << endl;
cout << "谢谢!" << endl;
return 0;
} else {
cout << "\033[31m";
cout << "游戏自动判错," << endl;
cout << "请重做!" << endl;
return 0;
}
cout << "突然,你发现那边有一群人,你现在需要采用什么方法消灭他们?" << endl;
cout << "做伏地魔选1,直接冲上去选2。" << endl;
cout << "答案:";
int l;
cin >> l;
if (l == 1) {
cout << "\033[31m";
cout << "突然,一辆车冲过来,把你给压死了。" << endl;
cout << "再接再厉,下次吃鸡。" << endl;
cout << "谢谢!" << endl;
return 0;
} else if (l == 2) {
cout << "敌人们还没发现你,就被一辆车轧死了。" << endl;
} else {
cout << "\033[31m";
cout << "游戏自动判错," << endl;
cout << "请重做!" << endl;
return 0;
}
cout << "现在还剩18个人,突然一个空投往一个离你不远的地方去了。你追不追?" << endl;
cout << "追选1,不追选2。" << endl;
cout << "答案:";
int m;
cin >> m;
if (m == 1) {
cout << "\033[31m";
cout << "突然一个导弹,把你和空投那儿的人都炸死了。" << endl;
cout << "再接再厉,下次吃鸡。" << endl;
cout << "谢谢!" << endl;
return 0;
} else if (m == 2) {
cout << "突然一个导弹,把那儿的人给炸死了。你真幸运!" << endl;
} else {
cout << "\033[31m";
cout << "游戏自动判错," << endl;
cout << "请重做!" << endl;
return 0;
}
cout << "有9个玩家因为去追空投而死了,还剩9个人。现在,你去不去舔空投?" << endl;
cout << "舔选1,不舔选2。" << endl;
cout << "答案:";
int n;
cin >> n;
if (n == 1) {
cout << "你在舔空投的时候,你原来的地方炸了,你真好运,不仅得到了吉利服,而且还躲过了轰炸。" << endl;
} else if (n == 2) {
cout << "\033[31m";
cout << "突然,一个导弹把你给炸瓜了。" << endl;
cout << "再接再厉,下次吃鸡。" << endl;
cout << "谢谢!" << endl;
return 0;
} else {
cout << "\033[31m";
cout << "游戏自动判错," << endl;
cout << "请重做!" << endl;
return 0;
}
cout << "现在,你要不要去安全区?" << endl;
cout << "去选1,不去选2。" << endl;
cout << "答案:";
int o;
cin >> o;
if (o == 1) {
cout << "你成功逃到了安全区。" << endl;
} else if (o == 2) {
cout << "\033[31m";
cout << "哪有人不去安全区的?!你在毒圈里挂了!" << endl;
cout << "再接再厉,下次吃鸡。" << endl;
cout << "谢谢!" << endl;
return 0;
} else {
cout << "\033[31m";
cout << "游戏自动判错," << endl;
cout << "请重做!" << endl;
return 0;
}
cout << "现在,你看见一个玩家在一栋楼旁边,你怎么消灭他?" << endl;
cout << "直接选1,信仰之跃选2。" << endl;
cout << "答案:";
int p;
cin >> p;
if (p == 1) {
cout << "\033[31m";
cout << "你成为了敌人的猎物,敌人用手雷把你给炸飞了。" << endl;
cout << "再接再厉,下次吃鸡。" << endl;
cout << "谢谢!" << endl;
return 0;
} else if (p == 2) {
cout << "敌人没发现你,你把他击杀了。" << endl;
} else {
cout << "\033[31m";
cout << "游戏自动判错," << endl;
cout << "请重做!" << endl;
return 0;
}
cout << "现在,毒圈要来了,跑毒吗?" << endl;
cout << "跑选1,不跑选2。" << endl;
cout << "答案:";
int r;
cin >> r;
if (r == 1) {
cout << "\033[31m";
cout << "那儿是轰炸区,你被炸死了!" << endl;
cout << "再接再厉,下次吃鸡。" << endl;
cout << "谢谢!" << endl;
return 0;
} else if (r == 2) {
cout << "那儿是轰炸区,肯定不能去。" << endl;
cout << "因为所有人都去跑毒了,所以全死了,你吃了鸡。" << endl;
} else {
cout << "游戏自动判错," << endl;
cout << "请重做!" << endl;
return 0;
}
cout << "你第二次又吃鸡了,真##。" << endl;
cout << "再见!" << endl;
}
if(sd=='C'){
HideCursor(); init(); tips();
while(1){
if(GameOver()) break; keyDown(); move(); eatFood(); draw(); Sleep(FPS);
}
setPos((W+1)/2,(H-1)/2);
COLOR_PRINT("游戏结束!,您获得了", 4);
printf("%d分", score);
setPos(0,H+2);
system("pause");
}
if(sd=='D'){
printf("开始游戏……\n");
Sleep(500);
cout<<"请选择你用什么方式登录\n"<<"1.微信 2.QQ 3.微博 4.百度 5.手机号\n";
int b;
cin>>b;
cout<<"开始游戏!!\n"<<"请选择游玩什么\n"<<"1.服务器 2.单人模式 3.联机大厅 4.我的世界小故事\n";
int c;
cin>>c;
system("cls");
if (c==1){
Sleep(500);
printf("正");
Sleep(500);
printf("在");
Sleep(500);
printf("进");
Sleep(500);
printf("入");
Sleep(500);
printf("游");
Sleep(500);
printf("戏");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
system("cls");
system("title 租赁服小游戏");
system("color 6C");
cout<<"请选择你要进入的服务器\n";
int d;
cin>>d;
cout<<"你进来后发现服主正在服务器中\n"<<"你要做些什么?\n"<<"1.找服主要装备 2.好好生存 3.拉帮结派,收集萌新\n";
int e;
cin>>e;
if (e==1){
cout<<"服主见你猥琐至极,担心之后被打,把你两刀砍了!\n"<<"You died";
return 0;
}
else if (e==2){
cout<<"你准备将房子建在哪?\n"<<"1.离出生点近 2.海上 3.地底 4.离出生点有多远就多远\n";
int f;
cin>>f;
if (f==1){
cout<<"你房子被一些熊孩子拆了,流离失所,卒!\n"<<"You died";
return 0;
}
else if (f==2){
cout<<"海上不是个明智的选择,晚上,一堆溺尸把你脑子吃了\n"<<"You died";
return 0;
}
else if (f==3){
cout<<"你在地底猥琐发育,挖到钻石,现在你要出去吗?\n"<<"1.yes 2.no\n";
int g;
cin>>g;
if (g==1){
cout<<"没想到地上的人发展比你快,把凋零乱放,你被凋零炸死了\n"<<"You died";
return 0;
}
else if (g==2){
cout<<"地底资源缺乏,被别人欺负\n"<<"You died";
return 0;
}
else{
cout<<"see you!";
return 0;
}
}
else if (f==4){
cout<<"离出生点远的确好,但是死后不容易回家\n"<<"You died";
return 0;
}
else{
cout<<"see you";
return 0;
}
}
else if (e==3){
cout<<"服主怕你们造反,就把你们全部**\n"<<"You died";
return 0;
}
else{
cout<<"see you";
return 0;
}
}
else if (c==2){
cout<<"请输入种子号\n";
int d;
cin>>d;
Sleep(500);
printf("正");
Sleep(500);
printf("在");
Sleep(500);
printf("进");
Sleep(500);
printf("入");
Sleep(500);
printf("游");
Sleep(500);
printf("戏");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
system("cls");
if (d==666){
system("color 6B");
cout<<"你走了一段路程后,远远地看见了十字架,你觉得有点不对,于是去到村庄\n";
cout<<"你接下来要干嘛?\n"<<"1.挖矿 2.四处瞎逛 3.砍树\n";
int e;
cin>>e;
if (e==1){
cout<<"你在村庄附近看见一个不是自己挖的人工矿道,你要进去吗?\n";
cout<<"1.yes 2.no\n";
int f;
cin>>f;
if (f==1){
cout<<"你发现矿道下有一个告示牌写着 Look back 你回头就看见了him,他一拳把你杀了\n";
cout<<"You died\n";
cout<<"你按复活也不行,于是把电脑砸了,你被母亲First Blood";
return 0;
}
else if (f==2){
cout<<"你离开那,感觉越来越不对劲,于是回到村庄,在中途看见一路蔓延的火";
cout<<"你还要回村吗?\n"<<"1.no 2.yes\n";
int g;
cin>>g;
if (g==1){
cout<<"him带着暗黑四大护法和亡灵军队\n"<<"You died\n";
cout<<"你按复活也不行,于是把电脑砸了,你被母亲double kill";
return 0;
}
else if (g==2){
cout<<"你看见一个白衣少年在毁灭村庄,凑近一瞧,原来是 Entity 303 你要保护村庄吗?\n";
cout<<"1.yes 2.no\n";
int h;
cin>>h;
if (h==1){
cout<<"你被 Entity 303 吊打\n"<<"You died\n";
cout<<"你按复活也不行,于是把电脑砸了,你被母亲Three kills";
return 0;
}
else if (h==2){
cout<<"him带着暗黑四大护法和亡灵军队\n"<<"You died\n";
cout<<"你按复活也不行,于是把电脑砸了,你被母亲Four kills";
return 0;
}
else{
cout<<"see you";
return 0;
}
}
else{
cout<<"see you";
return 0;
}
}
else{
cout<<"see you";
return 0;
}
}
else if (e==2){
cout<<"him带着暗黑四大护法和亡灵军队\n"<<"You died\n";
cout<<"你按复活也不行,于是把电脑砸了,你被母亲double kill";
return 0;
}
else if (e==3){
cout<<"你在砍树时看见一个黑色的身影,你要去追他吗?\n"<<"1.yes 2.no\n";
int f;
cin>>f;
if (f==1){
cout<<"他一转身,黑色的躯体,白色的双眼,是 null 你的脑袋爆掉了\n"<<"You died\n";
cout<<"你按复活也不行,于是把电脑砸了,你被母亲 victory";
return 0;
}
else if (f==2){
cout<<"他扔了一把剑插入你的心脏\n"<<"You died\n";
cout<<"你按复活也不行,于是把电脑砸了,你被母亲 ACE";
return 0;
}
else{
cout<<"see you";
return 0;
}
}
else{
cout<<"see you";
return 0;
}
}
else{
system("color 5F");
cout<<"你出生在掠夺者哨塔旁,你先打还是发育,还是去村庄\n"<<"1.打击 2.发育 3.去村庄\n";
int e;
cin>>e;
if (e==1){
cout<<"开局打哨塔,为人民做贡献,但你还是\n"<<"You died";
return 0;
}
else if (e==2){
cout<<"你现在去干什么?\n"<<"1.开人工矿道 2.砍树 3.找矿洞\n";
int f;
cin>>f;
if (f==1){
cout<<"你准备怎么挖?\n"<<"1.垂直向下 2.阶梯状\n";
int g;
cin>>g;
if (g==1){
cout<<"你垂直向下挖到了岩浆\n"<<"You died";
return 0;
}
else if (g==2){
cout<<"真幸运,你躲过了岩浆,你看见岩浆旁有钻石,你去挖吗\n"<<"1.no 2.yes\n";
int h;
cin>>h;
if (h==1){
cout<<"刚好有个闪电苦力怕路过,你砍死了它,你挖到了钻石,你要做什么\n";
cout<<"1.回家 2.继续发育\n";
int i;
cin>>i;
if (i==1){
cout<<"刚好外面是血月,你一上去就被杀了\n"<<"You died";
return 0;
}
else if (i==2){
cout<<"你不仅躲过了血月,还挖了35颗钻石,你现在准备去哪发展\n";
cout<<"1.地狱 2.末地\n";
int j;
cin>>j;
if (j==1){
cout<<"你去挖黑曜石时,掉入岩浆\n"<<"You died";
return 0;
}
else if (j==2){
cout<<"你成功战胜末影龙\n"<<"You win";
int x;
cin>>x;
return 0;
}
else{
cout<<"see you";
return 0;
}
}
else{
cout<<"see you";
return 0;
}
}
else if (h==2){
cout<<"闪电苦力怕低调路过,砰~~\n"<<"You died";
return 0;
}
else{
cout<<"see you";
return 0;
}
}
else{
cout<<"see you";
return 0;
}
}
else if (f==2){
cout<<"你得到了大量木头,你现在干什么\n"<<"1.造房子 2.挖矿\n";
int g;
cin>>g;
if (g==1){
cout<<"你造完房子后已经是捣蛋夜\n"<<"You died";
return 0;
}
else if (g==2){
cout<<"现在挖矿太晚了,一堆creeper在你身边,砰~~\n"<<"You died";
return 0;
}
else{
cout<<"see you";
return 0;
}
}
else if (f==3){
cout<<"你找了一天也没找到,狂欢夜来临\n"<<"You died";
return 0;
}
else{
cout<<"see you";
return 0;
}
}
else if (e==3){
cout<<"结果村庄里全是奸商,你把电脑砸了\n"<<"你被母亲招待了一次竹笋炒肉丝";
return 0;
}
else{
cout<<"see you";
return 0;
}
}
}
else if (c==3){
system("color 1A");
cout<<"你要和谁玩\n"<<"1.作者林** 2.作者朋友陈**用电脑玩 3.作者朋友夏** 4.和自己朋友 5.乱进房间\n";
int d;
cin>>d;
Sleep(500);
printf("正");
Sleep(500);
printf("在");
Sleep(500);
printf("进");
Sleep(500);
printf("入");
Sleep(500);
printf("游");
Sleep(500);
printf("戏");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
system("cls");
if (d==1){
cout<<"你一进入游戏便看见林**再建东西,你要干什么\n"<<"1.阻止 2.慢慢发展\n";
int e;
cin>>e;
if (e==1){
cout<<"林**很是愤怒,把你无限传送至1000层\n";
for (int i=1;i<=5;i++){
cout<<"你从高处摔下来\n";
}
cout<<"You died";
return 0;
}
else if (e==2){
cout<<"结果林**造的是召唤 Entity 303 的祭台, Entity 303 一出现将你杀掉\n"<<"You died";
return 0;
}
else{
cout<<"see you";
return 0;
}
}
else if (d==2){
cout<<"陈**非常友好,一来就百亿tnt,你的显卡凉了";
return 0;
}
else if (d==3){
cout<<"你一进入游戏发现是夜晚,你要干什么?\n"<<"1.砍树 2.挖矿 3.退出\n";
int e;
cin>>e;
if (e==1){
cout<<"你砍树时周围一个怪也没有,夏**挖了个洞躲了进去\n";
cout<<"你一砍,砍到大天亮,这时太阳升了起来,它有着猥琐表情\n";
cout<<"你要作甚?\n"<<"1.逃跑 2.退出\n";
int f;
cin>>f;
if (f==1){
cout<<"你跑了许久周围全都是岩浆\n"<<"You died";
return 0;
}
else if (f==2){
cout<<"你发现退不了,一拳把手机打爆了";
return 0;
}
else{
cout<<"see you";
return 0;
}
}
else if (e==2){
cout<<"你在地底挖矿,突然Red Sun出现,周围变为岩浆\n"<<"You died";
return 0;
}
else if (e==3){
cout<<"你发现退不了,一拳把手机打爆了";
return 0;
}
else{
cout<<"see you";
return 0;
}
}
else if (d==4){
Sleep(500);
printf("正");
Sleep(500);
printf("在");
Sleep(500);
printf("进");
Sleep(500);
printf("入");
Sleep(500);
printf("游");
Sleep(500);
printf("戏");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
system("cls");
system("color 3D");
cout<<"你和自己朋友一起玩,你要作甚?\n"<<"1.砍树 2.挖矿 3.造房\n";
int e;
cin>>e;
if (e==1){
cout<<"现在你得到了10组木头,天也晚了,你准备干什么?\n"<<"1.挖个洞当家 2.造家\n";
int f;
cin>>f;
if (f==1){
cout<<"你在晚上时还顺便挖矿,现在你和朋友都有铁套、钻剑了\n";
cout<<"你又准备做啥?\n"<<"1.杀末影人 2.挖黑曜石、钻石\n";
int g;
cin>>g;
if (g==1){
cout<<"你和朋友不小心闯入末影人的洞穴\n"<<"You died";
return 0;
}
else if (g==2){
cout<<"后来你们附魔了钻剑、弓、套装,打败末影龙,拿到宝藏\n";
cout<<"You win";
int x;
cin>>x;
return 0;
}
else{
cout<<"see you";
return 0;
}
}
else if (f==2){
cout<<"你们造家时,一堆怪物围攻你\n"<<"You died";
return 0;
}
else{
cout<<"see you";
return 0;
}
}
else if (e==2){
cout<<"你们拥有足够多的矿物了,你要干什么?\n"<<"1.造家 2.杀怪 3.去地狱\n";
int f;
cin>>f;
if (f==1){
cout<<"你们造家时已经到了血月\n"<<"You died";
return 0;
}
else if (f==2){
cout<<"你们杀了许多怪,拥有很多经验,又要干嘛?\n"<<"1.附魔 2.去末地\n";
int g;
cin>>g;
if (g==1){
cout<<"你朋友为了秀附魔,把你砍死了\n"<<"You died";
return 0;
}
else if (g==2){
cout<<"你们去了末地,准备怎么打末影龙?\n"<<"1.两人一起打龙 2.一起打水晶 3.分开打\n";
int h;
cin>>h;
if (h==1){
cout<<"末影龙无限回血\n"<<"You died";
return 0;
}
else if (h==2){
cout<<"你们两人都打水晶,没人管末影龙\n"<<"You died";
return 0;
}
else if (h==3){
cout<<"你们靠着你们“优秀”的配合能力打败了末影龙\n"<<"You win";
return 0;
}
else{
cout<<"see you";
return 0;
}
}
else{
cout<<"see you";
return 0;
}
}
else if (f==3){
cout<<"你们去到了地狱拿到了许多宝贝,可是你脚滑掉入岩浆\n"<<"You died";
return 0;
}
else{
cout<<"see you";
return 0;
}
}
else if (e==3){
cout<<"你们一造造到大晚上,刚好lunner moon 来临控制了你们的发展\n"<<"You died";
return 0;
}
else{
cout<<"see you";
return 0;
}
}
else if (d==5){
Sleep(500);
printf("正");
Sleep(500);
printf("在");
Sleep(500);
printf("进");
Sleep(500);
printf("入");
Sleep(500);
printf("游");
Sleep(500);
printf("戏");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
printf(".");
Sleep(500);
system("cls");
system("color 4F");
cout<<"你乱进房间,里面房主让你们打开麦克风你开吗?\n"<<"1.no 2.yes\n";
int e;
cin>>e;
if (e==1){
cout<<"里面一直在骂脏话“***************”被你妈听见\n"<<"You died";
return 0;
}
else if (e==2){
cout<<"房主已将你踢出房间";
return 0;
}
else{
cout<<"see you";
return 0;
}
}
else{
cout<<"see you";
return 0;
}
}
else if (c==4){
system("color 6B");
cout<<"MC小故事即将开始,(按任意数字继续)\n";
int d;
cin>>d;
Sleep(500);
cout<<"在茫茫宇宙中有一个星球——方块星球\n";
int e;
cin>>e;
cout<<"在这星球上还有3位创世神,Noatch、Him和……\n";
int f;
cin>>f;
cout<<"Udebring,Udebring他收了个关门弟子——Entity 303,虽然Udebring是创世神,可是他\n";
cout<<"渴望力量,抢到了力量之匙,到了方块大陆上召唤了祭坛,准备获取力量时\n";
cout<<"Him突然出现阻止\n";
int g;
cin>>g;
cout<<"可是Him虽然是创世神,但是Him却还是敌不过已得到力量之匙Udebring\n";
int h;
cin>>h;
cout<<"Him被Udebring打残废了,只好念出咒语,叫出了Noatch\n";
cout<<"Noatch、Him两人合作将Udebring打死了,夺得了力量之匙\n";
cout<<"创造了MC大陆\n";
int i;
cin>>i;
cout<<"Him和Noatch二人合力创造了许多生物:史蒂夫、羊、猪……\n";
cout<<"可是过了许久也出现了许多怪物\n";
int j;
cin>>j;
cout<<"Him看见自己创造的MC大陆有了怪物,便准备控制MC大陆的发展\n";
cout<<"可是Noatch却决定放任MC大陆发展\n";
int k;
cin>>k;
cout<<"于是Him和Noatch便因为思想不同大打出手\n";
cout<<"结果Him被Noatch封印到下界\n";
int l;
cin>>l;
cout<<"Him的分身就准备联合末地救出Him\n";
}
else{
cout<<"see you";
}
}
cout<<"是否退出游戏?"<<endl<<"是:1 否:2"<<endl;
cpp='0';
cin>>cpp;
if(cpp=='2')
if(cpp=='1') return 0;
}
}
共 2 条回复
#include <bits/stdc++.h> #include<windows.h> #include<stdio.h> #include<conio.h> #include<windows.h> #include<time.h> using namespace std; char sd;long long int x[3],w; string k,b="机器人",xm,d; #define W 40 #define H 40 HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE); struct snake{ int x,y; }; // 蛇结构体数组 snake snakes[W*H]; // 蛇的长度, 移动方向 int len = 0; char dir = 'd'; // 食物坐标 int foodx = 0,foody = 0; int FPS = 200; // 分数 速度 int score = 0, speed = (220-FPS)/20;
// 隐藏光标 void HideCursor(){ CONSOLE_CURSOR_INFO cursor_info = {1, 0}; SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info); }
// 设置光标位置 void setPos(int x,int y) { CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
HANDLE hConsoleOut; hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE); GetConsoleScreenBufferInfo(hConsoleOut,&csbiInfo); csbiInfo.dwCursorPosition.X = x;
csbiInfo.dwCursorPosition.Y = y;
SetConsoleCursorPosition(hConsoleOut,csbiInfo.dwCursorPosition); }
// 带颜色的输出 void COLOR_PRINT(const char* s, int color){ HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | color); printf(s); SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | 7); }
// 游戏结束 bool GameOver(){ // 撞墙 snake t = snakes[0]; if(t.x >= W-1 || t.x <= 0 || t.y >= H-1 || t.y <= 0){ return true; } // 吃到自己 for(int i=3;i<=len-1;i++){ if(t.x == snakes[i].x && t.y == snakes[i].y){ return true; } } return false; }
// 判断食物和蛇身是否重合 bool inSnake(int x, int y){ for(int i=0;i<len;i++){ if(snakes[i].x == x && snakes[i].y == y) return false; } return true; }
// 随机生成食物 void createFood(){ srand(time(NULL)); while(1){ // 1~(W-1) foodx = rand()%(W-2)+1; foody = rand()%(H-2)+1; if(inSnake(foodx,foody)) return; } }
// 初始化 void init(){ // 初始化蛇 len = 4; snakes[0].x = 2; snakes[0].y = 2; for(int i=1;i<len;i++){ snakes[i].x = snakes[i-1].x + 1; snakes[i].y = snakes[i-1].y; } // 初始化食物 createFood(); }
// 游戏提示 void tips(){ setPos(W2+4, 3); printf("游戏说明:\n"); setPos(W2+4, 5); printf("按W A S D 或者 ↑ ↓ ← → 操控游戏\n"); setPos(W2+4, 7); printf("按Q减速,按E加速\n"); setPos(W2+4, 9); printf("当前食物分数:%d\n", 100+10speed); setPos(W2+4, 11); printf("当前速度:%d\n", speed); setPos(W*2+4, 13); printf("总 分:%d\n", score); }
// 画地图 void draw(){ for(int i=0;i<W;i++){ for(int j=0;j<H;j++){ if(i==0 || j==0 || i == W-1 || j == H-1) { setPos(i2,j); printf("■"); } } } // 画蛇 for(int i=0;i<len;i++){ setPos(snakes[i].x2,snakes[i].y); // printf("■"); if(i == 0) COLOR_PRINT("■", 4); else COLOR_PRINT("■", 1); } // 画食物 setPos(foodx*2,foody); // printf("■"); COLOR_PRINT("■", 10); // 更新数据信息 FPS = min(FPS, 200); FPS = max(FPS, 60); speed = (220-FPS)/20; tips(); }
// 控制移动 void move(){ int dx = 0, dy = 0; if(dir == 'u') dy = -1; else if(dir == 'd') dy = 1; else if(dir == 'l') dx = -1; else if(dir == 'r') dx = 1; setPos(snakes[len-1].x*2,snakes[len-1].y); printf(" "); for(int i=len-1;i>=1;i--){ snakes[i].x = snakes[i-1].x; snakes[i].y = snakes[i-1].y; } snakes[0].x = snakes[0].x + dx; snakes[0].y = snakes[0].y + dy; }
// 按键响应 void keyDown(){ char key; while(kbhit()) key = _getch(); // 看不见的输入获取 switch(key){ case 'W': case 'w': case 72: if(dir != 'd') dir = 'u'; break; case 'S': case 's': case 80: if(dir != 'u') dir = 'd'; break; case 'A': case 'a': case 75: if(dir != 'r') dir = 'l'; break; case 'D': case 'd': case 77: if(dir != 'l') dir = 'r'; break; case 'E': case 'e': FPS -= 20; break; case 'Q': case 'q': FPS += 20; break; } }
// 吃到食物 void eatFood(){ if(snakes[0].x == foodx && snakes[0].y == foody){ len++; for(int i=len-1;i>=1;i--){ snakes[i].x = snakes[i-1].x; snakes[i].y = snakes[i-1].y; } snakes[0].x = foodx; snakes[0].y = foody; setPos(foodx2,foody); printf(" "); score += 100+speed10; createFood(); } }
int main(){ char cpp='2'; srand(time(0)); int s1 = rand ()% 3;
}
}//把他改的跟好玩了一些