Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <thread>
- #include <string>
- #include <conio.h>
- #include "maze.h"
- using namespace std;
- int PosX=1,PosY=1,valX=3,valY=5;
- int Coffies_left=0;
- int Lfset=5,Tofset=3,Coockies_needed;
- void wipe()
- {
- for(int i=0;i<40;i++)
- cout<<" \n";
- }
- void Print(){
- cls();
- wipe(); cls();
- for(int i=valX-Tofset;i<valX+Tofset;i++)
- {
- for(int j=valY-Lfset ;j<valY+Lfset;j++)
- cout<<maze[i][j];
- cout<<endl;
- }
- cout<<"Coffie : "<<Coffies_left<<"/25"<<endl;
- }
- void UwU()
- {
- while(1)
- {
- int a=getch();
- tolower(a);
- if(Coffies_left>=Coockies_needed)maze[13][maze[13].size()-2]=' ';
- if(a=='-') break;
- maze[PosX][PosY]=' ';
- if(a=='w'&&maze[PosX-1][PosY]!='#'&&maze[PosX-1][PosY]!='|')PosX--;
- if(a=='s'&&maze[PosX+1][PosY]!='#'&&maze[PosX+1][PosY]!='|')PosX++;
- if(a=='a'&&maze[PosX][PosY-1]!='#'&&maze[PosX][PosY-1]!='|')PosY--;
- if(a=='d'&&maze[PosX][PosY+1]!='#'&&maze[PosX][PosY+1]!='|')PosY++;
- if((PosX==M-1||PosY==60)&&Coffies_left>=Coockies_needed){cout<< "You Win UwU\n"; return;}
- if(maze[PosX][PosY]=='C')Coffies_left++;
- if(PosX-Tofset-1>0&&PosX+Tofset-1<M)valX=PosX;
- if(PosY-Lfset-1>0&&PosY+Lfset-2<N1)valY=PosY;
- maze[PosX][PosY]='U';
- Print();
- }
- }
- int main()
- {
- while(1)
- {
- cout<<"How many cookies needed to win (there are 25 total) 15-Easy 20- Medium 25-Hard\n";
- int p=0;string s;cin>>s;bool bad=false;
- for(char c:s)
- {
- if(c<'0'||c>'9'){bad = true; break;}
- else p*=10; p+=c-'0';
- }
- if(p>25||p<0||bad) cout<<"INVALID INPUT try again\n";
- else {
- Coockies_needed=p;
- cls();
- wipe();
- cls();
- break;}
- }
- while(1)
- {
- cout<<"Enter radius of vision [3,8] default is 5\n";
- int p=0;string s;cin>>s;bool bad=false;
- for(char c:s)
- {
- if(c<'0'||c>'9'){bad = true; break;}
- else p*=10; p+=c-'0';
- }
- if(p>8||p<3||bad) cout<<"INVALID INPUT try again\n";
- else {
- Tofset=p-2;
- Lfset=p;
- valX=Tofset;
- valY=Lfset;
- cls();
- wipe();
- cls();
- break;}
- }
- Print();
- UwU();
- cout<<"\n\nPRESS ENTER \n\n";
- cin.ignore();
- cin.ignore();
- return 0;
- }
Add Comment
Please, Sign In to add comment