C++ Designing the HurdleState Class The HurdleState class is what we suggest you use to store all the information and data that represents the state of the game. You’ll have full control over how you want to represent the state of the game, and what information you want to store and allow to be modified. While you may implement the HurdleState class however you’d like, we suggest that you implement a non-default constructor that accepts a string, representing the secret Hurdle for the game. This will allow a HurdleState object to be instantiated with a new secret Hurdle when starting a new game. We suggest that the game state include, at the minimum: 1. The secret Hurdle 2. The words that have been guessed so far Refer to the Hurdle Backend API section below to see what must be returned by the Backend to the Frontend - this should help you decide what else is needed to be stored in the HurdleState class. hurdlestate.h file #pragma once #include #include #ifndef HURDLESTATE_H #define HURDLESTATE_H class HurdleState { public: //=================== YOUR CODE HERE =================== // TODO: Add the constructor(s), accessors, mutators, // and any other member function you may need here. //====================================================== HurdleState(const std::string& answer); private: //=================== YOUR CODE HERE =================== // TODO: Add any member variables you need here to store // the state of the game. What information needs to be // stored to fully represent the game state at a single // point in time? //====================================================== }; #endif // HURDLESTATE_H hurdlestate.cc file #include "hurdlestate.h" // ========================= YOUR CODE HERE ========================= // This implementation file is where you should implement the member // functions declared in the header, only if you didn't implement // them inline in the header. // // Remember to specify the name of the class with :: in this format: // MyClassName::MyFunction() { // ... // } // to tell the compiler that each function belongs to the HurdleState class. // ===================================================================
C++
Designing the HurdleState Class
The HurdleState class is what we suggest you use to store all the information and data that represents the state of the game. You’ll have full control over how you want to represent the state of the game, and what information you want to store and allow to be modified.
While you may implement the HurdleState class however you’d like, we suggest that you implement a non-default constructor that accepts a string, representing the secret Hurdle for the game. This will allow a HurdleState object to be instantiated with a new secret Hurdle when starting a new game.
We suggest that the game state include, at the minimum:
1. The secret Hurdle
2. The words that have been guessed so far
Refer to the Hurdle Backend API section below to see what must be returned by the Backend to the Frontend - this should help you decide what else is needed to be stored in the HurdleState class.
hurdlestate.h file
#pragma once
#include <string>
#include <vector>
#ifndef HURDLESTATE_H
#define HURDLESTATE_H
class HurdleState {
public:
//=================== YOUR CODE HERE ===================
// TODO: Add the constructor(s), accessors, mutators,
// and any other member function you may need here.
//======================================================
HurdleState(const std::string& answer);
private:
//=================== YOUR CODE HERE ===================
// TODO: Add any member variables you need here to store
// the state of the game. What information needs to be
// stored to fully represent the game state at a single
// point in time?
//======================================================
};
#endif // HURDLESTATE_H
hurdlestate.cc file
#include "hurdlestate.h"
// ========================= YOUR CODE HERE =========================
// This implementation file is where you should implement the member
// functions declared in the header, only if you didn't implement
// them inline in the header.
//
// Remember to specify the name of the class with :: in this format:
// <return type> MyClassName::MyFunction() {
// ...
// }
// to tell the compiler that each function belongs to the HurdleState class.
// ===================================================================
Trending now
This is a popular solution!
Step by step
Solved in 3 steps