Wuhu! I’m back! Homework is all done! The code I brought today is what I want + write = 1 week, please collect it, praise it, let’s work hard together!
OK! Old rules, introduce the code
#include <bits/stdc++.h> #include <windows.h> #include <unistd.h> #include <conio.h> #define LIFE 15 #define HUNGRY 100 #define SPEED 1000 using namespace std; //hamburger is a hamburger, for the wheat buns in the mini world, hungryl remaining hunger, speed player movement speed, not used for now //wood wood material, stone stone material, metal metal material, diamond diamond material //und is the height of the current player, which is convenient for judging the appearance point of some rare ores //stoneAX, metalAX, diamondAX and goldAX all kinds of axes and pickaxes need to be synthesized //undergroundMAP is the visible area of the current underground mine. Once moved, if it is not in the map, it will be random again unsigned long long hamburger=10000, hungry=100, speed=100; unsigned long long wood=1000, stone=1000, metal=1000, diamond=1000; long long und=-6; bool stoneAX=true, metalAX=false, diamondAX=false, goldAX=false; int undergroundMAP[10][10]= {0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0 }; int nowp;//judging the current position, which is more conducive to exploring the mine below unsigned long long x, y;//Position judgment, easy to output void HIDE() { CONSOLE_CURSOR_INFO cursor_info= {1,0}; SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info); } void SetPos(int x,int y) { COORD pos; pos.X=y*2-1, pos.Y=x + 1; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos); } void stoDIG() { if(stoneAX==true & amp; & amp; metalAX==false) Sleep(50); else; } void metDIG() { if(stoneAX==true & amp; & amp; metalAX==false) Sleep(111); else if(metalAX=true & amp; & amp;diamondAX==false) Sleep(65); else; } void diaDIG() { if(metalAX==true & amp; & amp;diamondAX==false) Sleep(210); else if(diamondAX==true & amp; & amp; goldAX==false) Sleep(80); else; }
The above paragraphs are some functions and variables that need to be mined, and everyone should understand them.
void golAX() { for(int i=0; i<10; i ++ ) { for(int j=0; j<10; j ++ ) { switch(undergroundMAP[i][j]) { case 1: wood ++ ; break; case 2: stone ++ ; break; case 3: metal ++ ; break; case 4: diamond ++ ; break; } undergroundMAP[i][j]=0; } } } void diaAX() { for(int i=x-2; i<=x + 2; i + + ) { for(int j=y-2; j<=y + 2; j + + ) { switch(undergroundMAP[i][j]) { case 1: wood ++ ; break; case 2: stone ++ ; stoDIG(); break; case 3: metal ++ ; metDIG(); break; case 4: diamond ++ ; diaDIG(); break; } undergroundMAP[i][j]=0; } } } void metAX() { for(int i=x-1; i<=x + 1; i + + ) { for(int j=y; j<=y + 1; j + + ) { switch(undergroundMAP[i][j]) { case 1: wood ++ ; break; case 2: stone ++ ; stoDIG(); break; case 3: metal ++ ; metDIG(); break; case 4: diamond ++ ; diaDIG(); break; } undergroundMAP[i][j]=0; } } } bool canGO(bool a1, bool a2, bool a3, bool a4, int pla) { if(pla<=3) { return 1; } else if(pla==4 & amp; & amp; a2==true) { return 1; } else { return 0; } } void make() { system("cls"); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_BLUE); cout<<"__________________________________________________________________"<<endl; cout<<"| Synthesis |"<<endl; cout<<"| |"<<endl; cout<<"| 1. Iron Ax |"<<endl; cout<<"| 2. Diamond Ax |"<<endl; cout<<"| 3. Desolate God Ax |"<<endl; cout<<"| Iron ax: 99.8% probability to mine 3 × 3 square |"<<endl; cout<<"| Diamond Axe: There is a 99.9% probability of mining 5 × 5 squares |"<<endl; cout<<"| Desolation Axe: 100% chance to mine full-screen square |"<<endl; cout<<"| ______________________________________________________________|"<<endl; cout<<"| |Remarks: Please make sure that the backpack has all the required items and the ax synthesis does not need to use the ax that has been synthesized|"<<endl; cout<<"|_|______________________________________________________________|"<<endl; cout<<"Please input:"; char input = getch(); switch(input) { case '1': if(metal>=4 & amp; & amp; stoneAX!=false & amp; & amp; metalAX==false) { cout<<endl<<"Synthesized"<<endl; metalAX=true; } else if(metalAX==true) { cout<<endl<<"I'm sorry! Your iron ax has been synthesized, and you can't continue to synthesize it!"<<endl; } break; case '2': if(diamond>=2 & amp; & amp; metalAX!=false & amp; & amp; diamondAX==false) { cout<<endl<<"Synthesized"<<endl; diamondAX=true; } else if(diamondAX==true) { cout<<endl<<"I'm sorry! Your diamond ax has been synthesized, and you can't continue to synthesize it!"<<endl; } break; case '3': if(wood>=30 & amp; & amp;metal>=20 & amp; & amp;diamond>=12 & amp; & amp;diamondAX!=false & amp; & amp;goldAX==false) { cout<<endl<<"Synthesized"<<endl; goldAX=true; } else if(goldAX==true) { cout<<endl<<"I'm sorry! Your barren god ax has been synthesized, and you can't continue to synthesize it!"<<endl; } break; } } void getk() { switch(getch()) { case 'w': if(x!=0 & amp; & amp; goldAX==true) { golAX(); } else if(x!=0 & amp; & amp;diamondAX==true) { diaAX(); } else if(x!=0 & amp; & amp; metalAX==true) { metAX(); } if( x!=0 & amp; & amp; canGO( stoneAX, metalAX, diamondAX, goldAX, undergroundMAP[x-1][y] ) ) { x-=1; switch(undergroundMAP[x][y]) { case 1: wood ++ ; break; case 2: stone ++ ; stoDIG(); break; case 3: metal ++ ; metDIG(); break; case 4: diamond ++ ; diaDIG(); break; } undergroundMAP[x][y]=0; } break; case 's': if(x!=9 & amp; & amp; goldAX==true) { golAX(); } else if(x!=9 & amp; & amp;diamondAX==true) { diaAX(); } else if(x!=9 & amp; & amp; metalAX==true) { metAX(); } if( x!=9 & amp; & amp; canGO( stoneAX, metalAX, diamondAX, goldAX, undergroundMAP[x + 1][y] ) ) { x + =1; switch(undergroundMAP[x][y]) { case 1: wood ++ ; break; case 2: stone ++ ; stoDIG(); break; case 3: metal ++ ; metDIG(); break; case 4: diamond ++ ; diaDIG(); break; } undergroundMAP[x][y]=0; } break; case 'a': if(y!=0 & amp; & amp; goldAX==true) { golAX(); } else if(y!=0 & amp; & amp;diamondAX==true) { diaAX(); } else if(y!=0 & amp; & amp; metalAX==true) { metAX(); } if( y!=0 & amp; & amp; canGO( stoneAX, metalAX, diamondAX, goldAX, undergroundMAP[x][y-1] ) ) { y-=1; switch(undergroundMAP[x][y]) { case 1: wood ++ ; break; case 2: stone ++ ; stoDIG(); break; case 3: metal ++ ; metDIG(); break; case 4: diamond ++ ; diaDIG(); break; } undergroundMAP[x][y]=0; } break; case 'd': if(y!=9 & amp; & amp; goldAX==true) { golAX(); } else if(y!=9 & amp; & amp;diamondAX==true) { diaAX(); } else if(y!=9 & amp; & amp; metalAX==true) { metAX(); } if( y!=9 & amp; & amp; canGO( stoneAX, metalAX, diamondAX, goldAX, undergroundMAP[x][y + 1] ) ) { y + =1; switch(undergroundMAP[x][y]) { case 1: wood ++ ; break; case 2: stone ++ ; stoDIG(); break; case 3: metal ++ ; metDIG(); break; case 4: diamond ++ ; diaDIG(); break; } undergroundMAP[x][y]=0; } break; case 'm': make(); break; } } bool emp() { for(int i=1; i<9; i ++ ) { for(int j=1; j<9; j ++ ) { if(undergroundMAP[i][j]!=0 & amp; & amp;undergroundMAP[i][j]!=4) { return false; } } } return true; } void pm() { system("cls"); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED); cout<<"________________________________________________________________________________________"<<endl; cout<<"| ____________________________________________________________________________________|"<<endl; cout<<"| | Mini World | Backpack | Synthesis Table | |"<<endl; cout<<"|__________________________________________ normal mode| 1. wood: | 2. tool synthesis | |"<<endl; cout<<"| |Life: 100 | Hunger value: 100 | Status: Normal | Network delay: 0ms| | (1). Mining tools | |"<<endl; cout<<"| |__________________________________________________| 2. Stone: | 1. Stone ax | |"<<endl; cout<<"| | | | send directly | |"<<endl; cout<<"| | | 3. Iron ore: | | |"<<endl; cout<<"| | | | 2. Iron Ax | |"<<endl; cout<<"| | | 4. Diamond: | needs a stone ax and | |"<<endl; cout<<"| |_______________|4 pieces of iron ore synthesis | |"<<endl; cout<<"| | | tools | | |"<<endl; cout<<"| | |1. Stone ax: | 3. Diamond ax | |"<<endl; cout<<"| | | | requires an iron ax and | |"<<endl; cout<<"| | |2. Iron Ax: |Synthesis of two pieces of diamond ore | |"<<endl; cout<<"| |________________________________________________| | | |"<<endl; cout<<"| |Target Completion Status: |Target: Synthetic Diamond Ax |Packet Loss Rate: %0|3. Diamond Ax: | 4. Desolate God Ax | |"<<endl; cout<<"| |____________________|_________________|___________| | need thirty pieces of wood | |"<<endl; cout<<"| | m key to open the tool manufacturing area |4. Desolate Axe: | add 20 pieces of iron ore, add 10 | |"<<endl; cout<<"| |Tips: An iron pickaxe is needed to mine diamonds! An iron pickaxe needs a stone pickaxe and four pieces of iron to synthesize |_______________|Two diamonds to synthesize | |"<<endl; cout<<"| | The diamond needs to be excavated to about -7 floors underground |Current height: | | |"<<endl; cout<<"||________________________________________________|_______________|__________________||"<<endl; cout<<"| |______ Note: Due to some kind of bug, please try not to dig the first line of ore, thank you for your cooperation, we will fix it as soon as possible!______| |"<<endl; cout<<"| |version number| |"<<endl; cout<<"|___________________________________|V1.7.3|____________________________________________|"<<endl; if(emp()) { und--; srand(time(0)); for(int k=4; k<=13; k ++ ) { SetPos(k + 1,2); for(int i=0; i<9; i ++ ) { if(k-4==x & amp; & amp;i==y) { cout<<"*you*"; undergroundMAP[k-4][i]=0; continue; } int a; do { a=rand()%4 + 1; } while(a==4 & &und>-7); if(a==1) { cout<<setw(5)<<"wood"; undergroundMAP[k-4][i]=1; } else if(a==2) { cout<<setw(5)<<"stone"; undergroundMAP[k-4][i]=2; } else if(a==3) { cout<<setw(5)<<"iron"; undergroundMAP[k-4][i]=3; } else if(a==4 & &und<=-7) { cout<<setw(5)<<"drill"; undergroundMAP[k-4][i]=4; } } } } else { for(int i=0; i<9; i ++ ) { SetPos(i + 5,2); for(int j=0; j<9; j ++ ) { if(i==x & amp; & amp; j==y) { cout<<"*you*"; undergroundMAP[i-4][j]=0; continue; } switch(undergroundMAP[i][j]) { case 0: cout<<setw(5)<<" "; break; case 1: cout<<setw(5)<<"wood"; break; case 2: cout<<setw(5)<<"stone"; break; case 3: cout<<setw(5)<<"iron"; break; case 4: cout<<setw(5)<<"drill"; break; } } } } SetPos(2,32); cout<<wood; SetPos(4,32); cout<<stone; SetPos(6,32); cout<<metal; SetPos(8,32); cout<<diamond; SetPos(11,31); cout<<(stoneAX==false? "No": "Yes"); SetPos(13,31); cout<<(metalAX==false? "No": "Yes"); SetPos(15,32); cout<<(diamondAX==false? "No": "Yes"); SetPos(17,33); cout<<(goldAX==false? "No": "Yes"); SetPos(19,32); cout<<und; SetPos(15,9); cout<<"unfinished"<<endl; }
Here are all interface functions, not much introduction.
int main() { cout. tie(); HIDE(); while(wood<10000) { system("cls"); pm(); getk(); } getch(); system("cls"); return 0; }
Finally, the main function, let’s talk about cout.tie() a little bit.
The main function of this function is to make the output faster and more standard, and it is generally used in animation production.
And finally the full code.
#include <bits/stdc++.h> #include <windows.h> #include <unistd.h> #include <conio.h> #define LIFE 15 #define HUNGRY 100 #define SPEED 1000 using namespace std; //hamburger is a hamburger, for the wheat buns in the mini world, hungryl remaining hunger, speed player movement speed, not used for now //wood wood material, stone stone material, metal metal material, diamond diamond material //und is the height of the current player, which is convenient for judging the appearance point of some rare ores //stoneAX, metalAX, diamondAX and goldAX all kinds of axes and pickaxes need to be synthesized //undergroundMAP is the visible area of the current underground mine. Once moved, if it is not in the map, it will be random again unsigned long long hamburger=10000, hungry=100, speed=100; unsigned long long wood=1000, stone=1000, metal=1000, diamond=1000; long long und=-6; bool stoneAX=true, metalAX=false, diamondAX=false, goldAX=false; int undergroundMAP[10][10]= {0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0 }; int nowp;//judging the current position, which is more conducive to exploring the mine below unsigned long long x, y;//Position judgment, easy to output void HIDE() { CONSOLE_CURSOR_INFO cursor_info= {1,0}; SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info); } void SetPos(int x,int y) { COORD pos; pos.X=y*2-1, pos.Y=x + 1; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos); } void stoDIG() { if(stoneAX==true & amp; & amp; metalAX==false) Sleep(50); else; } void metDIG() { if(stoneAX==true & amp; & amp; metalAX==false) Sleep(111); else if(metalAX=true & amp; & amp;diamondAX==false) Sleep(65); else; } void diaDIG() { if(metalAX==true & amp; & amp;diamondAX==false) Sleep(210); else if(diamondAX==true & amp; & amp; goldAX==false) Sleep(80); else; } void golAX() { for(int i=0; i<10; i ++ ) { for(int j=0; j<10; j ++ ) { switch(undergroundMAP[i][j]) { case 1: wood ++ ; break; case 2: stone ++ ; break; case 3: metal ++ ; break; case 4: diamond ++ ; break; } undergroundMAP[i][j]=0; } } } void diaAX() { for(int i=x-2; i<=x + 2; i + + ) { for(int j=y-2; j<=y + 2; j + + ) { switch(undergroundMAP[i][j]) { case 1: wood ++ ; break; case 2: stone ++ ; stoDIG(); break; case 3: metal ++ ; metDIG(); break; case 4: diamond ++ ; diaDIG(); break; } undergroundMAP[i][j]=0; } } } void metAX() { for(int i=x-1; i<=x + 1; i + + ) { for(int j=y; j<=y + 1; j + + ) { switch(undergroundMAP[i][j]) { case 1: wood ++ ; break; case 2: stone ++ ; stoDIG(); break; case 3: metal ++ ; metDIG(); break; case 4: diamond ++ ; diaDIG(); break; } undergroundMAP[i][j]=0; } } } bool canGO(bool a1, bool a2, bool a3, bool a4, int pla) { if(pla<=3) { return 1; } else if(pla==4 & amp; & amp; a2==true) { return 1; } else { return 0; } } void make() { system("cls"); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_BLUE); cout<<"__________________________________________________________________"<<endl; cout<<"| Synthesis |"<<endl; cout<<"| |"<<endl; cout<<"| 1. Iron Ax |"<<endl; cout<<"| 2. Diamond Ax |"<<endl; cout<<"| 3. Desolate God Ax |"<<endl; cout<<"| Iron ax: 99.8% probability to mine 3 × 3 square |"<<endl; cout<<"| Diamond Axe: There is a 99.9% probability of mining 5 × 5 squares |"<<endl; cout<<"| Desolation Axe: 100% chance to mine full-screen square |"<<endl; cout<<"| ______________________________________________________________|"<<endl; cout<<"| |Remarks: Please make sure that the backpack has all the required items and the ax synthesis does not need to use the ax that has been synthesized|"<<endl; cout<<"|_|______________________________________________________________|"<<endl; cout<<"Please input:"; char input = getch(); switch(input) { case '1': if(metal>=4 & amp; & amp; stoneAX!=false & amp; & amp; metalAX==false) { cout<<endl<<"Synthesized"<<endl; metalAX=true; } else if(metalAX==true) { cout<<endl<<"I'm sorry! Your iron ax has been synthesized, and you can't continue to synthesize it!"<<endl; } break; case '2': if(diamond>=2 & amp; & amp; metalAX!=false & amp; & amp; diamondAX==false) { cout<<endl<<"Synthesized"<<endl; diamondAX=true; } else if(diamondAX==true) { cout<<endl<<"I'm sorry! Your diamond ax has been synthesized, and you can't continue to synthesize it!"<<endl; } break; case '3': if(wood>=30 & amp; & amp;metal>=20 & amp; & amp;diamond>=12 & amp; & amp;diamondAX!=false & amp; & amp;goldAX==false) { cout<<endl<<"Synthesized"<<endl; goldAX=true; } else if(goldAX==true) { cout<<endl<<"I'm sorry! Your barren god ax has been synthesized, and you can't continue to synthesize it!"<<endl; } break; } } void getk() { switch(getch()) { case 'w': if(x!=0 & amp; & amp; goldAX==true) { golAX(); } else if(x!=0 & amp; & amp;diamondAX==true) { diaAX(); } else if(x!=0 & amp; & amp; metalAX==true) { metAX(); } if( x!=0 & amp; & amp; canGO( stoneAX, metalAX, diamondAX, goldAX, undergroundMAP[x-1][y] ) ) { x-=1; switch(undergroundMAP[x][y]) { case 1: wood ++ ; break; case 2: stone ++ ; stoDIG(); break; case 3: metal ++ ; metDIG(); break; case 4: diamond ++ ; diaDIG(); break; } undergroundMAP[x][y]=0; } break; case 's': if(x!=9 & amp; & amp; goldAX==true) { golAX(); } else if(x!=9 & amp; & amp;diamondAX==true) { diaAX(); } else if(x!=9 & amp; & amp; metalAX==true) { metAX(); } if( x!=9 & amp; & amp; canGO( stoneAX, metalAX, diamondAX, goldAX, undergroundMAP[x + 1][y] ) ) { x + =1; switch(undergroundMAP[x][y]) { case 1: wood ++ ; break; case 2: stone ++ ; stoDIG(); break; case 3: metal ++ ; metDIG(); break; case 4: diamond ++ ; diaDIG(); break; } undergroundMAP[x][y]=0; } break; case 'a': if(y!=0 & amp; & amp; goldAX==true) { golAX(); } else if(y!=0 & amp; & amp;diamondAX==true) { diaAX(); } else if(y!=0 & amp; & amp; metalAX==true) { metAX(); } if( y!=0 & amp; & amp; canGO( stoneAX, metalAX, diamondAX, goldAX, undergroundMAP[x][y-1] ) ) { y-=1; switch(undergroundMAP[x][y]) { case 1: wood ++ ; break; case 2: stone ++ ; stoDIG(); break; case 3: metal ++ ; metDIG(); break; case 4: diamond ++ ; diaDIG(); break; } undergroundMAP[x][y]=0; } break; case 'd': if(y!=9 & amp; & amp; goldAX==true) { golAX(); } else if(y!=9 & amp; & amp;diamondAX==true) { diaAX(); } else if(y!=9 & amp; & amp; metalAX==true) { metAX(); } if( y!=9 & amp; & amp; canGO( stoneAX, metalAX, diamondAX, goldAX, undergroundMAP[x][y + 1] ) ) { y + =1; switch(undergroundMAP[x][y]) { case 1: wood ++ ; break; case 2: stone ++ ; stoDIG(); break; case 3: metal ++ ; metDIG(); break; case 4: diamond ++ ; diaDIG(); break; } undergroundMAP[x][y]=0; } break; case 'm': make(); break; } } bool emp() { for(int i=1; i<9; i ++ ) { for(int j=1; j<9; j ++ ) { if(undergroundMAP[i][j]!=0 & amp; & amp;undergroundMAP[i][j]!=4) { return false; } } } return true; } void pm() { system("cls"); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED); cout<<"________________________________________________________________________________________"<<endl; cout<<"| ____________________________________________________________________________________|"<<endl; cout<<"| | Mini World | Backpack | Synthesis Table | |"<<endl; cout<<"|__________________________________________ normal mode| 1. wood: | 2. tool synthesis | |"<<endl; cout<<"| |Life: 100 | Hunger value: 100 | Status: Normal | Network delay: 0ms| | (1). Mining tools | |"<<endl; cout<<"| |__________________________________________________| 2. Stone: | 1. Stone ax | |"<<endl; cout<<"| | | | send directly | |"<<endl; cout<<"| | | 3. Iron ore: | | |"<<endl; cout<<"| | | | 2. Iron Ax | |"<<endl; cout<<"| | | 4. Diamond: | needs a stone ax and | |"<<endl; cout<<"| |_______________|4 pieces of iron ore synthesis | |"<<endl; cout<<"| | | tools | | |"<<endl; cout<<"| | |1. Stone ax: | 3. Diamond ax | |"<<endl; cout<<"| | | | requires an iron ax and | |"<<endl; cout<<"| | |2. Iron Ax: |Synthesis of two pieces of diamond ore | |"<<endl; cout<<"| |________________________________________________| | | |"<<endl; cout<<"| |Target Completion Status: |Target: Synthetic Diamond Ax |Packet Loss Rate: %0|3. Diamond Ax: | 4. Desolate God Ax | |"<<endl; cout<<"| |____________________|_________________|___________| | need thirty pieces of wood | |"<<endl; cout<<"| | m key to open the tool manufacturing area |4. Desolate Axe: | add 20 pieces of iron ore, add 10 | |"<<endl; cout<<"| |Tips: An iron pickaxe is needed to mine diamonds! An iron pickaxe needs a stone pickaxe and four pieces of iron to synthesize |_______________|Two diamonds to synthesize | |"<<endl; cout<<"| | The diamond needs to be excavated to about -7 floors underground |Current height: | | |"<<endl; cout<<"||________________________________________________|_______________|__________________||"<<endl; cout<<"| |______ Note: Due to some kind of bug, please try not to dig the first line of ore, thank you for your cooperation, we will fix it as soon as possible!______| |"<<endl; cout<<"| |version number| |"<<endl; cout<<"|___________________________________|V1.7.3|____________________________________________|"<<endl; if(emp()) { und--; srand(time(0)); for(int k=4; k<=13; k ++ ) { SetPos(k + 1,2); for(int i=0; i<9; i ++ ) { if(k-4==x & amp; & amp;i==y) { cout<<"*you*"; undergroundMAP[k-4][i]=0; continue; } int a; do { a=rand()%4 + 1; } while(a==4 & &und>-7); if(a==1) { cout<<setw(5)<<"wood"; undergroundMAP[k-4][i]=1; } else if(a==2) { cout<<setw(5)<<"stone"; undergroundMAP[k-4][i]=2; } else if(a==3) { cout<<setw(5)<<"iron"; undergroundMAP[k-4][i]=3; } else if(a==4 & &und<=-7) { cout<<setw(5)<<"drill"; undergroundMAP[k-4][i]=4; } } } } else { for(int i=0; i<9; i ++ ) { SetPos(i + 5,2); for(int j=0; j<9; j ++ ) { if(i==x & amp; & amp; j==y) { cout<<"*you*"; undergroundMAP[i-4][j]=0; continue; } switch(undergroundMAP[i][j]) { case 0: cout<<setw(5)<<" "; break; case 1: cout<<setw(5)<<"wood"; break; case 2: cout<<setw(5)<<"stone"; break; case 3: cout<<setw(5)<<"iron"; break; case 4: cout<<setw(5)<<"drill"; break; } } } } SetPos(2,32); cout<<wood; SetPos(4,32); cout<<stone; SetPos(6,32); cout<<metal; SetPos(8,32); cout<<diamond; SetPos(11,31); cout<<(stoneAX==false? "No": "Yes"); SetPos(13,31); cout<<(metalAX==false? "No": "Yes"); SetPos(15,32); cout<<(diamondAX==false? "No": "Yes"); SetPos(17,33); cout<<(goldAX==false? "No": "Yes"); SetPos(19,32); cout<<und; SetPos(15,9); cout<<"unfinished"<<endl; } int main() { cout. tie(); HIDE(); while(wood<10000) { system("cls"); pm(); getk(); } getch(); system("cls"); return 0; }
OK! That’s it for today, bye!