Skip to content
Permalink
3f10e8f665
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
69 lines (54 sloc) 1.15 KB
#include <iostream>
#include <string>
#include <vector>
class Location
{
public:
std::vector<std::string> 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;
}
};