Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am creating Conway's Game of Life in C++. When I try to compile my code currently, I get this error: Breakpoint Instruction Executed A

I am creating Conway's Game of Life in C++. When I try to compile my code currently, I get this error: Breakpoint Instruction Executed

A breakpoint instruction (_debugbreak() statement or similar call) was executed in GameOfLife.exe

How would I fix this?

Here is the instructions for what I was working on:

image text in transcribed
Objective Create a struct in order to store settings for the application Instructions 1. In order to allow the Game of Life to be customized, it will be necessary to keep track of a few different settings. A couple of these settings already have values that are being tracked in the program. Creating an object for the settings will make it easier to pass around the program from object to object. 2. Create a struct that for the game settings in a new header file. No need for a .cpp file in this case. At a minimum, the struct will need to track the following pieces of data for now. a. The color of living cells, stored as unsigned ints representing the Red, Blue, Green, and Alpha values. Default the RGB values to 128 and the Alpha to 255. b. The color of dead cells, stored as unsigned ints representing the Red, Blue, Green, and Alpha values. Default the RGB values to 255 and the Alpha to 255. i. It is possible to run into Read Access errors if trying to read a wxColor that has been loaded from file. This is because one of the classes the wxColor inherits from does not like being written to directly. In order to get around this error, don't store wxColor directly. Instead store the Red, Green, Blue, and Alpha values as unsigned ints. wxColor has .GetRed[), GetGreen[), .GetBlue(), and .GetAlpha() methods that can be used. It may make sense to create a method in the Settings struct that returns a wxColor based on the specific RGBA values that are stored. c. The grid size (Default to 15) d. The interval (Default to 50) e. Eventually information about the window size and location may be added to this struct, as well as other any other options that can be tracked. 3. It may make sense to add methods for getting the living cell color and getting the dead cell color that returns a wxColor. Creating setters for living cell color and dead cell color would make sense too. Those could take in a wxColor and set the RGBA values from those colors. 4. Add a variable to the main window header for the settings object. This should not be a pointer. 5. Since the grid size will now be tracked in the settings object, it will be necessary to remove all existing references to that variable and replace them with the reference to the settings object. a. The easiest way to do this is to removethe size variable from the main window header file. b. The .cpp file will have many errors at this point. Each error can be fixed by referencing the appropriate variable in the settings file. 6. Now that there is a settings object, this can be used to pass data to the drawing panel. Create a settings pointer in the drawing panel header file. 7. The value of the settings object pointer can either be set in the drawing panel constructor or through a setter. The easiest way is likely to create a setter for the settings pointer. 8. It will again be necessary to remove all existing references to variables in the drawing panel and replace them with the reference to the settings object pointer. 9. To test, change the default values in the settings object file and open the program. The interval, grid size, and colors should change based on the default values

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions