Back to Parent

Pseudocode Algorithm:

setupexperiment()
//position people at the outskirts of the desired area

hoptimer = 5 
//everyone starts off  hopping

movingforward = true
//everyone starts moving forward

Timer on

while timer > 0 and timer  < 120:

    if hoptimer > 0           //hop for 5 seconds max, and once those 5 
                              //seconds have passed start walking
        hopping = true
        walking = false
    else 
        hopping = false
        walking = true

    if touchedBoundary = true //if you reach the boundary, 
                              //reverse direction, but not body position
        movingforward = !(movingforward)


    if touchedOther = true    //if you collide with someone, 
                              //turn 90 degrees to the left
       rotate90left(individual)
       hoptimer = 5           //if you touch, reset the hopping timer
Click to Expand

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0