<aside> ‼️ RC Cola is having a promotional contest in order to make a comeback in the soda industry!

</aside>

They label numbers on the bottom of each soda cap from 1-6. If you happen to get a bottle with the number ‘6’ on it, you win the prize.

This is a prize you NEED: Guaranteed admission to your dream college, a brand new green screen, a new shiny convertible..

You’ve completely lost your mind!! You keep buying sodas until you’ve bought a soda with a ‘6’ on the cap. You go up to an infinite RC Cola machine and do just that. Buy a soda, check the number.. 3? Buy a soda, check the cap to see if it’s a 6... 1? Buy a soda, check the cap to see if it’s a 6–—yes! Out of excitement, you scream out how many bottles you bought in total.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/84ddeb2f-519a-4f16-9516-1fecf512f172/Untitled.png

Now suppose 10,000 people line up behind you because they also want this prize. Every one is waiting in this line so that they can do the exact same thing.

Shirley really wants a brand new convertible, but she disgusted at the thought of having to buy any off brand of Coca Cola 🤮. To see how many sodas she'll likely end up buying, she wants to collect data to see which number was most likely to be shouted. She stands next to the RC Cola machine with a clipboard and makes a list of the numbers that people are shouting.

http://netlogoweb.org/web?url=https://raw.githubusercontent.com/mchen0037/models/master/models/apcsp/rc-cola-template.nlogo

What's new?

Data Types

One thing I see different is the value of winner?, which is set to false. Previously, we've worked primarily with variables that were numbers (num-people, forest-density, money, ...). We've also seen a data type called a string, which is mostly used for "text-based" data (ie set name "Shirley" or set shape "person").

true and false is another kind of data type, called a boolean. A number can take in any...number from -2 billion to 2 billion, a string can take any "string" of letters or characters, a boolean can take in true or false.

So things like is-raining?, color = green, money > 100, ... We've seen these all over the place! They're essential to our if and ifelse statements.

Moving along

Upon each iteration of go, ask turtles to...

  1. Check if they are NOT a winner (if they won, they don't need to move anymore).
  2. Take a step forward!
  3. Buy a RC Cola