Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Load, process, and save changes to player statistics for a Spider Solitaire game

ID: 3834548 • Letter: L

Question

Load, process, and save changes to player statistics for a Spider Solitaire game using JSON format.

You will need to implement a JSON parser in C++ to read JSON from a file. Please see PlayerStatistics.json for an example of the expected format. Simulate a player winning 5 out of 5 One Suit games, 2 out of 5 Two Suits games, and 0 out of 5 Four Suits games. Don't forget to handle updating the statistics for Fastest Win and Fewest Moves. When done, your program should save the updated information to the PlayerStatistics.json file.

Provide the full code to this question. The libraries used must be included and written, and provide a screenshot that it compiles so I know for sure it compiles. No incomplete code.

PlayerStatistics.json file:

[
{
"Player Name": "Me",
"Overview": {
"Games Won": 0,
"Win Rate": 0,
"Games Played": 0,
"Fastest Win": 0,
"Fewest Moves": 0,
"Top Score": 0
},
"Suits":
[
{
"Type": "One Suit",
"Games Won": 0,
"Win Rate": 0,
"Games Played": 0,
"Fastest Win": 0,
"Fewest Moves": 0,
"Top Score": 0
},
{
"Type": "Two Suits",
"Games Won": 0,
"Win Rate": 0,
"Games Played": 0,
"Fastest Win": 0,
"Fewest Moves": 0,
"Top Score": 0
},
{
"Type": "Four Suits",
"Games Won": 0,
"Win Rate": 0,
"Games Played": 0,
"Fastest Win": 0,
"Fewest Moves": 0,
"Top Score": 0
}
]
},
{
   "Player Name": "You",
"Overview":
{
"Games Won": 0,
"Win Rate": 0,
"Games Played": 0,
"Fastest Win": 0,
"Fewest Moves": 0,
"Top Score": 0
},
"Suits":
[
{
"Type": "One Suit",
"Games Won": 0,
"Win Rate": 0,
"Games Played": 0,
"Fastest Win": 0,
"Fewest Moves": 0,
"Top Score": 0
},
{
"Type": "Two Suits",
"Games Won": 0,
"Win Rate": 0,
"Games Played": 0,
"Fastest Win": 0,
"Fewest Moves": 0,
"Top Score": 0
},
{
"Type": "Four Suits",
"Games Won": 0,
"Win Rate": 0,
"Games Played": 0,
"Fastest Win": 0,
"Fewest Moves": 0,
"Top Score": 0
}
]
}]

Explanation / Answer

enum Value_type{ obj_type, array_type, str_type, bool_type, int_type, real_type, null_type }; class Value { public: Value(); // creates null value Value( const char* value ); Value( const std::string& value ); Value( const Object& value ); Value( const Array& value ); Value( bool value ); Value( int value ); Value_impl( boost::int64_t value ); Value_impl( boost::uint64_t value ); Value( double value ); bool operator==( const Value& lhs ) const; Value_type type() const; const std::string& get_str() const; const Object& get_obj() const; const Array& get_array() const; bool get_bool() const; int get_int() const; boost::int64_t get_int64() const; boost::uint64_t get_uint64() const; double get_real() const; Object& get_obj(); Array& get_array(); template T get_value() const; bool is_uint64() const; bool is_null() const; static const Value null; private: ... };
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote