/*---- header file for function: GameDie A GameDie object represents a single game die. It has a set number of sides, each numbered from 1 to the number of sides, and it can be rolled, which results in a number between 1 and the number of sides. adapted from Astrachan's "A Computer Science Tapestry" 2nd edition, pp. 214, 217 by: Owen Astrachan adapted by: Sharon Tuttle last modified: 2021-06-23 ----*/ #ifndef GAMEDIE_H #define GAMEDIE_H class GameDie { public: // constructors GameDie(); GameDie(int desired_num_sides); // accessors int get_num_sides() const; int get_curr_top() const; // other methods /*--- signature: roll: void -> int purpose: expects nothing, computes a pseudo-random int in [1, num_sides], changes curr_top of the calling GameDie to that computed value, and also returns that computed value as the result of this call to roll ---*/ int roll(); private: int num_sides; int curr_top; static const int DEFAULT_NUM_SIDES = 6; }; #endif