#include <stdio.h> #include <stdlib.h> #include #include <windows.h> #include <conio.h> #include <time.h> using namespace std; inline void movexy(int x,int y) { COORD position={x,y}; HANDLE hOut=GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleCursorPosition(hOut,position); } int chess[50];//上边:21-30,右边:31-40,下边:10-1,左边:11-20 char picture[12]={'.','#','”,电脑的地产;“m”,玩家;"); movexy(8,9); printf("“c”,电脑玩家;“?”命运;“&”,付税点;“@”,起点;“+”随机得钱或付税"); movexy(10,10); printf("您先移动,移动时请按空格键(速度切忌太慢),屏幕顶端会打印游戏消息"); movexy(15,11); printf("您移动后,电脑将会在2秒后自动移动,请不要多按键!"); movexy(15,12); printf("特殊地产:电灯公司,自来水厂,各种铁路不能升级房子!"); movexy(25,13); printf("特殊地点:“<”表示监狱,经过此处没反应"); movexy(18,14); printf("“>”表示进入监狱,经过此处移动到监狱并暂停一轮游戏"); movexy(29,15); printf("“/”表示空地,经过此处无响应"); movexy(15,16); printf("经过起点,消费指数为1领取薪水200,为2领取100,大于等于4无薪水"); movexy(20,17); printf("消费指数每15回合翻倍,实际租金将会是基本租金消费指数"); movexy(30,18); printf("按任意键开始游戏!"); getch(); Sleep(800); } while(true) { draw(); if(me.stop) { me.stop=false; movexy(27,10); printf("你被关进监狱,暂停一轮!"); goto computer; } getch(); Sleep(800); x=me.way; m=rand()%6+rand()%6; if(m==0) m=12; else if(m<2) m=7; me.mov(m); if(x>=24&&me.way<=13) { if(xf==1) me.money+=200; else if(xf==2) me.money+=100; } move: draw(); movexy(10,12); if(me.way==com.way) m2=c2,c2=3; if(citys[me.way].ts) { m=rand()%8; if(m<4) { if(citys[1].a[m]>me.money) { system("cls"); system("color 1A"); movexy(18,0); printf("你付税%d元",citys[me.way].a[m]); movexy(18,1); printf("你破产了!"); Sleep(2000); return 0; } movexy(18,0); printf("你付税%d元",citys[me.way].a[m]); me.money-=citys[me.way].a[m]; Sleep(2000); } else { movexy(18,0); me.money+=citys[me.way].a[m]; printf("银行给你%d元",citys[me.way].a[m]); Sleep(2000); } } else if(citys[me.way].fate) { m=rand()%14; if(m<8){ m=rand()%8; if(m<4) { if(citys[1].a[m]>me.money) { system("cls"); system("color 1A"); movexy(18,0); printf("你付税%d元",citys[me.way].a[m]); movexy(18,1); printf("你破产了!"); Sleep(2000); return 0; } movexy(18,0); printf("你付税%d元",citys[me.way].a[m]); me.money-=citys[me.way].a[m]; Sleep(2000); } else { movexy(18,0); me.money+=citys[me.way].a[m]; printf("银行给你%d元",citys[me.way].a[m]); Sleep(2000); } } else if(m<14) { m=rand()%5; me.go(citys[me.way].t[m]); movexy(18,0); printf("命运卡:坐飞机到%s",citys[me.way].name); Sleep(2000); goto move; } else { me.mov(-3); movexy(18,0); printf("命运卡:后退3格"); Sleep(2000); goto move; } } else if(citys[me.way].jy||me.way==1); else if(citys[me.way].gojy) { me.go(); if(com.way==11) m2=c2,c2=3; movexy(18,0); printf("你走到警察局被关进了监狱!"); Sleep(2000); } else if(citys[me.way].shui) { if(me.money<citys[me.way].a[m]) { system("cls"); system("color 1A"); movexy(18,0); printf("你付税%d元",citys[me.way].a[m]); movexy(18,1); printf("你破产了!"); Sleep(2000); return 0; } me.money-=citys[me.way].smoney; movexy(18,0); printf("你付税%d元",citys[me.way].smoney); Sleep(2000); } else if(m2==2||(com.way==me.way&&c2==2)) { me.money-=citys[me.way].moneyxf; com.money+=citys[me.way].moneyxf; movexy(18,0); if(me.money<0) { system("color 1A"); system("cls"); printf("你移动到%s,缴纳租金%d元!",citys[me.way].name,citys[me.way].moneyxf); movexy(18,11); printf("你破产了!"); Sleep(2000); return 0; } printf("你移动到%s,缴纳租金%d元!",citys[me.way].name,citys[me.way].moneyxf); Sleep(2000); } else if(me.money>=citys[me.way].price/2) { if(citys[me.way].house==0&&me.money>=citys[me.way].price) { movexy(18,0); printf("为购买%s支付%d元?",citys[me.way].name,citys[me.way].price); movexy(18,1); printf("租金:%d元",citys[me.way].money); movexy(18,2); printf("买按下空格键,否则按下任意键"); if(getch()==' ') { m2=1; me.money-=citys[me.way].price; citys[me.way].house++; movexy(18,3); printf("你花费%d元购买了%s!",citys[me.way].price,citys[me.way].name); Sleep(2000); draw(); } } else if(citys[me.way].house<5&&(!citys[me.way].tsdc)) { movexy(18,0); printf("是否花费%d元在%s升级一座房子?",citys[me.way].price/2,citys[me.way].name); movexy(18,1); printf("升级按下空格键,否则按下任意键"); if(getch()==' ') { citys[me.way].money=2; citys[me.way].house++; me.money-=citys[me.way].price/2; movexy(18,2); printf("你花费%d元在%s升级了一栋房子!",citys[me.way].price/2,citys[me.way].name); Sleep(2000); } } } draw(); computer: Sleep(2000); if(com.stop) { com.stop=false; movexy(27,10); printf("电脑被关进监狱,暂停一轮!"); Sleep(2000); continue; } m=rand()%6+rand()%6; if(m==0) m=12; else if(m<2) m=7; x=com.way; com.mov(m); if(24<=x&&com.way<=13) { if(xf==1) com.money+=200; else if(xf==2) com.money+=100; } move2: draw(); if(me.way==com.way) c2=m2,m2=4; if(citys[com.way].ts) { m=rand()%8; if(m<4) { if(citys[1].a[m]>com.money) { system("cls"); system("color 1A"); movexy(18,0); printf("电脑付税%d元",citys[com.way].a[m]); movexy(18,1); printf("电脑破产了!"); Sleep(2000); return 0; } movexy(18,0); printf("电脑付税%d元",citys[com.way].a[m]); com.money-=citys[com.way].a[m]; Sleep(2000); } else { movexy(18,0); printf("银行给电脑%d元",citys[com.way].a[m]); com.money+=citys[com.way].a[m]; Sleep(2000); } } else if(citys[com.way].fate) { m=rand()%13; if(m<8) { m=rand()%8; if(m<4) { if(citys[1].a[m]>com.money) { system("cls"); system("color 1A"); movexy(18,0); printf("电脑付税%d元",citys[com.way].a[m]); movexy(18,1); printf("电脑破产了!"); Sleep(2000); return 0; } movexy(18,0); printf("电脑付税%d元",citys[com.way].a[m]); com.money-=citys[com.way].a[m]; Sleep(2000); } else { movexy(18,0); printf("银行给电脑%d元",citys[com.way].a[m]); com.money+=citys[com.way].a[m]; Sleep(2000); } } else if(m<14) { m=rand()%5; com.go(citys[com.way].t[m]); movexy(18,0); printf("电脑命运卡:坐飞机到%s",citys[com.way].name); Sleep(2000); goto move2; } else { com.mov(-3); movexy(18,0); printf("电脑命运卡:后退3格"); Sleep(2000); goto move2; } } else if(com.way==1||citys[com.way].jy); else if(citys[com.way].gojy) { movexy(18,0); printf("电脑走到警察局被关进监狱"); com.go(); if(me.way==11) c2=m2,m2=4; } else if(citys[com.way].shui) { if(com.money<citys[com.way].smoney) { system("cls"); system("color 1A"); movexy(18,0); printf("电脑付税%d元",citys[com.way].smoney); movexy(18,1); printf("电脑破产了!"); Sleep(2000); return 0; } movexy(18,2); printf("电脑付税%d元",citys[com.way].smoney); com.money-=citys[com.way].smoney; Sleep(2000); } else if(c2==1||(me.way==com.way&&m2==1)) { com.money-=citys[com.way].moneyxf; me.money+=citys[com.way].moneyxf; movexy(18,0); if(com.money<0) { printf("电脑移动到%s,缴纳租金%d元!",citys[com.way].name,citys[com.way].moneyxf); movexy(18,11); printf("电脑破产了!"); Sleep(2000); return 0; } printf("电脑移动到%s,缴纳租金%d元!",citys[com.way].name,citys[com.way].moneyxf); Sleep(2000); } else if(com.money-300>=citys[com.way].price) { if(citys[com.way].house==0) { movexy(18,0); printf("电脑花费%d元购买了%s",citys[com.way].price,citys[com.way].name); com.money-=citys[com.way].price; citys[com.way].house++; c2=2; Sleep(2000); } else if(citys[com.way].house<5&&(!citys[com.way].tsdc)) { movexy(18,0); citys[com.way].money*=2; citys[com.way].house++; printf("电脑花费%d元在%s升级了一栋房子!",citys[com.way].price/2,citys[com.way].name); Sleep(2000); } } cs++; } }
共 1 条回复
...........