Decoding Challenge #2

Posted January 11, 2019 by ilee

Here is the code for Challenge #2:

image

 

The Challenge

In the comment section below, tell us what you think this code is doing.

Comments

Submitted by Lytle on Sat, 01/19/2019 - 13:21 · Permalink

This is having the plankton swim (wiggle walk) and also reproduce with a 3% rate

Answer

Submitted by mehagaman on Sat, 01/19/2019 - 13:21 · Permalink

Swimming. Plankton close? Chance to reproduce.

Answer

Submitted by jlcordova6 on Sat, 01/19/2019 - 13:22 · Permalink

1. Loop running procedures swim and reproduce

2. very small chance to reproduce, must be less than 500 plankton in the world, then create 1 additional plankton that is randomly placed on the world

Answer

Submitted by Bob Coulter on Sat, 01/19/2019 - 13:22 · Permalink

Plankton follow a swim procedure, which doesn't seem to be shown, along with a reproduce procedure, which happens very occasionally. Basically if there are fewer than 500 plankton on screen, create one and give it a little movement and a random heading. Presumably at that point it swims away using the swim procedure.  

Answer

Submitted by sgibbs on Sat, 01/19/2019 - 13:22 · Permalink

On the plankton tab, so this is controlling the behavior of that agent.  When forever is toggled, the plankton follow the procedures swim and reproduce.  We can't see the swim code in this picture.  In the reproduce code, they have a nested conditional - first they check to see if they have the right (small) percent chance.  Then, if yes, they check to see how many plankton there already are.  If the answers to both conditionals are right, they create a new plankton.

Answer

Submitted by Kaestner on Sat, 01/19/2019 - 13:23 · Permalink

There is a plankton swim procedure that is called - but we don't know what it does yet. The reproduce procedure is also called. If there is less than 500 plankton within 200 steps, then plankton is reproduced and moves forward 1 2 or 3 with a random heading. This all only happens .3% of the time.

Answer

Submitted by msag on Sat, 01/19/2019 - 13:23 · Permalink

This is Mary Sagartz. I do not have camera or microphone. 

Forever calls to procedures - plankton swim and plankton reproduce

Plankton reproduce - with a 30% chance and there are less then 500 plankton, a plankton will be created.

Answer

Submitted by heaster on Sat, 01/19/2019 - 13:23 · Permalink

THe plankton are required to swim and reproduce at .3%. 

Answer

Submitted by mehagaman on Sat, 01/19/2019 - 13:24 · Permalink

Hi, Mary! thanks for tuning in :)

Answer

Submitted by melodeehaskins on Sat, 01/19/2019 - 13:24 · Permalink

reproduction of plankton and swimming

Answer