From 3f10e8f665b29b414e665696f687a9ba41009045 Mon Sep 17 00:00:00 2001 From: "Jamaine Fosu (fosuj)" Date: Thu, 15 Apr 2021 11:37:12 +0100 Subject: [PATCH] Create Location.h My work towards the project --- Jamaine.cpp/Location.h | 69 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 Jamaine.cpp/Location.h diff --git a/Jamaine.cpp/Location.h b/Jamaine.cpp/Location.h new file mode 100644 index 0000000..8a0c393 --- /dev/null +++ b/Jamaine.cpp/Location.h @@ -0,0 +1,69 @@ +#include +#include +#include + +class Location +{ + public: + std::vector locations; + std::string currentLocation; + int pointer; + + Location() + { + locations.push_back("start"); + locations.push_back("pond"); + locations.push_back("car"); + locations.push_back("lake"); + currentLocation = locations[0]; + } + + void go_north() + { + pointer+=1; + currentLocation = locations[pointer]; + } + + std::string get_location() + { + return currentLocation; + + } + + void go_south() + { + pointer+=1; + currentLocation = locations[pointer]; + } + + std::string get_location() + { + return currentLocation; + + } + + void go_west() + { + pointer+=1; + currentLocation = locations[pointer]; + } + + std::string get_location() + { + return currentLocation; + + } + + void go_east() + { + pointer+=1; + currentLocation = locations[pointer]; + } + + std::string get_location() + { + return currentLocation; + + } + +};