Question: This is c++ OPTION A (Basic): 1D Cellular Automata Implement the full class Automaton from the lectures. Test the class in a main() that works


OPTION A (Basic): 1D Cellular Automata Implement the full class Automaton from the lectures. Test the class in a main() that works like the main() from the module. Show at least four different sample runs of width 79, giving 100 generations per run (to keep the output manageable). Show me the runs for rules 4, 126 and 131. Add at least one more rule of your choice. Here is a repeat of the specification of the class. Private static const int RULES SIZE bool rulesIRULES SIEE staring this Gen string extremeliti bit, implied everywhere outside an odd number so it can be pet ectly centered statie const int MAX DISPLAY WIDTH string tostringcurrentGen bool setRule int new ule): change rule set bool setDisplay idth int width ropagateNewGenerationI The meaning and behavior of members and methods is in the modules, but here is a summary Automaton (int rule) a constructor. Through the mutator below, we'll sanitize rule and then convert it to our internal representation. We also need to establish the seed: a single 1 in a sea of 0s (in this assignment a 1 means an asterisk, and a 0 means a blank, This is directly by setting thisGen Bit to string toStringcurrentGen() This returns string consisting of the thisGen, but does so by embedding it in a returnstring current generation, hose length is exactly display width long. If thisGen is smaller than display width, it is positioned in the center of the larger returnstring the excess padded by extreme Bit characters, thisGen is longer than display width, it has to be truncated (on both ends) so that it is perfectly centered in the returned returnstring, any excess trimmed off both ends, equally. Two Mutators bool setRule(int newRule) converts the int newRule, a number from 0-255, to an array of eight bools. For example, if the newRule 182, then this is the binary number 101 10 110, which means that the resultant array will be rule 71 true
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
