Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- void draw(int room)
- {
- if (room == 1){
- cout <<"---------" << endl;
- cout <<"| x | |" << endl;
- cout <<"---------" << endl;
- cout <<"| | |" << endl;
- cout <<"---------" << endl;
- }
- else if (room == 2){
- cout <<"---------" << endl;
- cout <<"| | x |" << endl;
- cout <<"---------" << endl;
- cout <<"| | |" << endl;
- cout <<"---------" << endl;
- }
- else if (room == 3){
- cout <<"---------" << endl;
- cout <<"| | |" << endl;
- cout <<"---------" << endl;
- cout <<"| x | |" << endl;
- cout <<"---------" << endl;
- }
- else if (room == 4){
- cout <<"---------" << endl;
- cout <<"| | |" << endl;
- cout <<"---------" << endl;
- cout <<"| | x |" << endl;
- cout <<"---------" << endl;
- }
- }
- bool move(int &room)
- {
- // Do not delete this var when function ends, static lets it live
- static int bad_moves;
- bool keep_going = true;
- string input;
- cout << "Which direction do you want to move: North, South, East, West" << endl;
- cin >> input;
- if (room == 1 && input == "East")
- room = 2;
- else if (room == 1 && input == "South")
- room = 3;
- else if (room == 2 && input == "West" || room == 3 && input == "North")
- room = 1;
- else if (room == 2 && input == "South" || room == 3 && input == "East"){
- room =4;
- keep_going = false;
- }
- else{
- cout << "Invalid Movement! You will never escape the game world!!!" << endl;
- bad_moves++;
- if(bad_moves == 3){
- cout << "Bitch you have been banned!!!" << endl;
- exit(0); // Stops the application from anywhere
- }
- return keep_going;
- }
- }
- int main()
- {
- int room = 1;
- do{
- draw(room);
- }while(move(room));
- cout << "You found the Treasure!!! Buy our DLC!!!" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement