Presentation is loading. Please wait.

Presentation is loading. Please wait.

Week 10 DO NOW QUESTIONS. A programmer has created 100 turtles of random colors and randomly distributes green patches. Every time the turtles land on.

Similar presentations


Presentation on theme: "Week 10 DO NOW QUESTIONS. A programmer has created 100 turtles of random colors and randomly distributes green patches. Every time the turtles land on."— Presentation transcript:

1 Week 10 DO NOW QUESTIONS

2 A programmer has created 100 turtles of random colors and randomly distributes green patches. Every time the turtles land on a green patch, the color of the turtle is turned green too! The programmer is trying to have the turtles stop moving around once there are no more red turtles. What’s wrong with the following code? a)The reporter, count turtles with [color = red] > 0, does not count the number of red turtles. b)The while command is the wrong command to use, you should use the repeat comment. c)The ask turtles command is incorrect because you want the observer to perform the commands d)You are missing a pair of square brackets, starting before the ask command and ending after the last square bracket because it is necessary to contain the commands to be performed by while the reporter is true in square brackets.

3 You are trying to understand a NetLogo program written by another programmer. You come across across the following line of code What does it do? a)It sets the variable mylist to the number of turtles one green patches b)It assigns the turtles in the upper right quadrant on green patches to the agentset thoseones c)It creates an agentset, thoseones, of green turtles in the upper right quandrant. d)It puts all the turtles on green patches

4 You have a model with dogs and cats. The dogs chase the cats but do not like to share space with another dog. You want to prevent the dogs from moving onto patches that contain other dogs. Here is the code that you wrote What is wrong with it? a)There is no patch-ahead command b)The word not should be in front of the word if c)cats-on should be changes to dogs-on d)any? is not a NetLogo command

5 You have a list, mylist, that contains 9 numbers (even number from 1 – 20). You want to prepend 0 to the list. What is the command and the resulting list a)prepend mylist 0 mylist ;; [ 0 2 4 6 8 10 12 14 16 18 20] b)fput mylist 0 mylist ;; [ 0 2 4 6 8 10 12 14 16 18 20] c)lput mylist 0 mylist ;; [ 2 4 6 8 10 12 14 16 18 20 0] d)prepend mylist 0 mylist ;; [ 2 4 6 8 10 12 14 16 18 20 0]

6 You have created a list containing the numbers 10, 25, 1002 and 4. The following command is given in your code after the list is created a)the numbers [10 25 1002 4] are printed in the command center b)the number 4 is printed in the command center c)one of the 4 numbers is printed in the command center d)nothing is printed in the command center


Download ppt "Week 10 DO NOW QUESTIONS. A programmer has created 100 turtles of random colors and randomly distributes green patches. Every time the turtles land on."

Similar presentations


Ads by Google