Hunt The Wumpus/C++: Difference between revisions
Content added Content deleted
(Created page with "This version is based on the original game, so it diverges a little from the task! =={{header|C++}}== <lang cpp> #include <time.h> #include <iostream> #include <sstream> typ...") |
|||
Line 48: | Line 48: | ||
void msg( std::string s ) { std::cout << s; } |
void msg( std::string s ) { std::cout << s; } |
||
void msg( int i ) { std::cout << i; } |
void msg( int i ) { std::cout << i; } |
||
void wait() |
void wait() { std::cin.get(); } |
||
}; |
}; |
||
Line 54: | Line 54: | ||
{ |
{ |
||
public: |
public: |
||
int |
int getExit( int i ) { return exits[i]; } |
||
byte contains() |
byte contains() { return obj; } |
||
void clear( object o ) |
void clear( object o ) { obj ^= o; } |
||
void clearRoom() |
void clearRoom() { obj = NOTHING; } |
||
void setExit( int i, int e ) |
void setExit( int i, int e ) { exits[i] = e; } |
||
void populate( object o ) { obj |= o; } |
void populate( object o ) { obj |= o; } |
||
Line 98: | Line 98: | ||
{ |
{ |
||
private: |
private: |
||
inOut |
inOut inOut; |
||
cave theCave; |
cave theCave; |
||
unsigned |
unsigned playerPos, wumpusPos, pathLen, arrowsCnt, exits[MAX_EXITS], arrowPath[A_PATH_LEN], saved[SAVED]; |
||
bool gameOver, playerWins; |
bool gameOver, playerWins; |
||