Question
Phase 1: Seeding a colony Start by finding out how large your squares array will need to be. If we decide we want to have
Phase 1: Seeding a colony Start by finding out how large your squares array will need to be. If we decide we want to have SIDE_LENGTH=10, so 10 squares per side. This means the canvas will be divided into 10x10 number of squares, so 100 for this example. 1. Make it so that your program automatically creates an array the correct size no matter the SIDE_LENGTH. 2. All the values of the array will start at 0 so we will use that as the state of an uninfected cell. 3. Create a constant for the state of an infected cell and give it some value that is not 0. 4. Make an array of colours for the different states, use hex colours like #ff0000, #00ff00, #0000ff. Or use grayscale. 5. Create a function that will choose a random cell to become infected and give it a corresponding value, call it infectRandom(). 6. Create a drawBoard() function to print out the current state of the board. It will be called at every draw() 7. Remember there are SIDE_LENGTH number of cells per side, which means per row and per column so take the appropriate steps so that all the cells are properly printed. You will either need one loop and the divide and modulo operators or two loops. 8. Set framerate(2) or another similarly small value in setup so that the program doesnt go too fast!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started