Question: make sure to use the SAME framework as in the base code PLS Using C + + create a replica of Wordle Word Selection: Each
make sure to use the SAME framework as in the base code PLS
Using Ccreate a replica of Wordle
Word Selection: Each time the user plays, a new word should be selected at random from a list of words stored in a file "words.txtThe words should be different each time the user plays, ensuring variety.
Game End: When the round ends, the user should be shown the outcome winlossand a performance summary.
Statistics Saving: When the round ends, some statistics such as word played, score, winlossetcshould be saved to a file for later retrieval.
After completing a round, the user should be automatically returned to the Main Menu Screen.
Implement a statistics screen:
Game Statistics: Display useful statistics such as the number of rounds played, score, winslossesor any other relevant information you choose.
Clear Statistics: Allow the user to clear their statistics if desired. This could be done by providing a "Clear Statistics" button.
The user should be able to return to the Main Menu Screen after viewing the statistics.
Word List
The list of words used in the game should be stored in a text file one word per lineA word from the file should be randomly selected for each round.
Persistence
The game should save statistics after each round. This means:
After every game round, the statistics word played, score, winlossetcshould be written into a CSV file.
When the user launches the Statistics Screen, the game should read from this file and display the saved statistics from previous rounds.
This ensures that users can track their performance over time and that their progress is preserved even after closing the game.
Bug Proof
The game must be stable and should not break or crash under any circumstances:
Proper error handling should be implemented to avoid crashes.
The game should function smoothly even if the user takes unexpected actions or provides incorrect input.
implement it into this code:
#ifndef APPLICATIONH
#define APPLICATIONH
#include
#include
#include
#include
#include
namespace bobcat
class Application : public Application
Window window;
Buttons for navigation
Button playButton;
Button instructionsButton;
Button statsButton;
Button quitButton;
Button backToMainButton;
Headings and content
TextBox heading;
TextBox instructionsText;
TextBox statsText;
std::string currentView;
void setup
Set up UI components
heading new TextBox "Heading";
headingalignFLALIGNCENTER;
headinglabelsize;
playButton new Button "Play Game";
instructionsButton new Button "View Instructions";
statsButton new Button "View Statistics";
quitButton new Button "Quit";
backToMainButton new Button "Back to Main Menu";
instructionsText new TextBox "Instructions will go here.";
statsText new TextBox "Statistics will go here.";
Attach button events
ONCLICKplayButton handleNavigationClick;
ONCLICKinstructionsButton handleNavigationClick;
ONCLICKstatsButton handleNavigationClick;
ONCLICKquitButton handleNavigationClick;
ONCLICKbackToMainButton handleNavigationClick;
currentView "menu"; Default view
void handleNavigationClickWidget sender
if sender playButton
setCurrentViewgame;
else if sender instructionsButton
setCurrentViewinstructions;
else if sender statsButton
setCurrentViewstats;
else if sender quitButton
windowhide;
else if sender backToMainButton
setCurrentViewmenu;
void hideAll
Hide all components
headinghide;
playButtonhide;
instructionsButtonhide;
statsButtonhide;
quitButtonhide;
backToMainButtonhide;
instructionsTexthide;
statsTexthide;
void setCurrentViewconst std::string& view
currentView view;
updateDisplay;
void updateDisplay
hideAll;
if currentView "menu"
showMenu;
else if currentView "instructions"
showInstructions;
else if currentView "stats"
showStats;
else if currentView "game"
showGame;
void showMenu
headinglabelMain Menu";
headingshow;
playButtonshow;
instructionsButtonshow;
statsButtonshow;
quitButtonshow;
void showInstructions
headinglabelInstructions;
headingshow;
instructionsTextshow;
backToMainButtonshow;
void showStats
headinglabelStatistics;
headingshow;
statsTextshow;
backToMainButtonshow;
void showGame
headinglabelGame Screen";
headingshow;
backToMainButtonshow;
public:
Application
theme;
window new Window "Word Game";
setup;
setCurrentViewcurrentView;
windowshow;
friend struct ::AppTest;
;
#endif
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
