#include #include enum GameResult { Win, Tie, Loss }; class Hand { public: // Converts a user-inputted character to the correct instance of Hand. static std::unique_ptr fromChar(char); // Randomly returns one of the variants of Hand. static std::unique_ptr generateRandom(); // Returns the lowercase name of this type of hand, for example "rock" or // "scissors". virtual std::string getHandName() const = 0; // Returns if this instance of Hand wins against another instance. The // returned value is from the perspective of this instance of hand. For // example, if GameResult::Win is returned, the instance of Hand wins // against the passed argument Hand. virtual GameResult compareAgainst(const Hand&) = 0; }; class Rock : public Hand { public: std::string getHandName() const override; GameResult compareAgainst(const Hand&) override; }; class Paper : public Hand { public: std::string getHandName() const override; GameResult compareAgainst(const Hand&) override; }; class Scissors : public Hand { public: std::string getHandName() const override; GameResult compareAgainst(const Hand&) override; };