Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Recommended Textbook for

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions