We've talked a bit about performance and scale in the past in terms of the number of turtles that are in our world and how increasing the amount of turtles might increase the number of computations that are required to run the program.
As a reminder: which do you think will take longer to do?
create-turtles 10 [ do-something ]
create-turtles 10 [ repeat 10 [ draw-square ] ]
create-turtles 10000 [ repeat 10 [ repeat 10 [ draw-square ] ] ]
create-turtles 10000 [ do-something ]
create-turtles 10 [ draw-square ]
create-turtles 10000 [ repeat 100 [ draw-square ] ]
I'm thinking of a mystery number between 1 and 10...
I'm thinking of a mystery number between 1 and 100...
Sometimes, we're given additional information that will help us achieve a solution. This can either be information that we're given about the problem or "feedback." This additional information is known as a heuristic.
Let's think of a mystery number together again, but this time I will give you a heuristic. I will tell you that my number is "bigger" or "smaller." My number is in between 1 and 10.
Let's try again: this time my number is between 1 and 100.
1 and 1000?
1 and 10000?
1 and 1,000,000?
Do you think that this strategy that you've came up with will work with anything? Below I have a list of foods: which one am I thinking of?