Polar Bears: A n ice Game CMSC104 Spring 2010 Project 3

Slides:



Advertisements
Similar presentations
Guess Whats Behind the Box Next Slide Samy Hendawy.
Advertisements

It’s All in the Cards Adding and Subtracting Integers
Building Java Programs
Probability (Unit 5) Is the likelihood or chance of an even occurring.
Overview Reference parameters Documenting functions A game of craps. Design, code, test and document.
Binomial Distributions
For the ultimate in entertainment, play with 2 or more people, individually or as a team Players alternate turns Each player picks an “answer” and must.
Dice Task Task 1Task 2Task 3Task 4 Task 5Task 6Task 7Task 8 NC Level 3 to 6.
Excursions in Modern Mathematics, 7e: Copyright © 2010 Pearson Education, Inc. 15 Chances, Probabilities, and Odds 15.1Random Experiments and.
9.7 Probability Mutually exclusive events. Definition of Probability Probability is the Outcomes divided by Sample Space. Outcomes the results of some.
Matlab tutorial course Exercises 4:. Exercises – for loops Download the scripts loops_example.m and if_else_example.m, run the code Download the function,
NYOUT A game from South Korea. Set up 2 to 4 players The circle and the cross are composed of circles that act as playing spaces. The center circle and.
Critique, Summary, and Paraphrasing Video Game. By: BB30 Start.
MATH CLASH Integer Addition Game 1. Player Rules Players must be paired with another person Cards must be evenly divided at the start of the round Players.
James Tam Loops In Python In this section of notes you will learn how to rerun parts of your program without having to duplicate the code.
Introduction to Artificial Intelligence for Bradley University – CS 521 Anthony (Tony) J. Grichnik Visiting Scientist to Bradley University Caterpillar.
BACS 287 Programming Logic 3. BACS 287 Iteration Constructs Iteration constructs are used when you want to execute a segment of code several times. In.
Practice for Midterm 1. Practice problems These slides have six programming problems for in-class practice There are an additional seven programming problems.
INTEGERS.
Check it out! : Simple Random Sampling. Players of a dice game roll five dice and earn points according to the combinations of numbers they roll.
1 Quiz Template: Click on the match By Deborah Nelson Duke University Under the direction of Professor Susan Rodger July 2009.
Unit 1: Number Sense Minds On. Unit 1: Number Sense Review: Operations with Negative Numbers Learning Goals: I can add and subtract negative numbers I.
Lecture 15 Practice & exploration Subfunctions: Functions within functions “Guessing Game”: A hands-on exercise in evolutionary design © 2007 Daniel Valentine.
Geometry 8.3 Tests for Parallelograms. Is it a Parallelogram? Now they will give you a shape and you will have to tell us if it is a parallelogram or.
Water Matters! Jeopardy Game Review of the Water Matters! Curricula Grades 6-8.
Introduction to the WebBoard Terry Dennis. The WebBoard - Our Connection The WebBoard URL is
MOM! Phineas and Ferb are … Aims:
Sullivan – Fundamentals of Statistics – 2 nd Edition – Chapter 11 Section 1 – Slide 1 of 34 Chapter 11 Section 1 Random Variables.
You are going to work in pairs to produce a Maths board game.
©Robomatter – Distribution or copying without permission is prohibited. 3B STEM Computer Science 1 ©Robomatter – Distribution or copying without permission.
 Make sure you are subscribed to announcements on Moodle.  Activity 4 will be due 48hrs after your lab ends.
 From here to there and back again  Counts steps  Measures distance.
Developing Number Sense Cleveland Elementary March 19, 2013.
GUESS WHO AM I???  You have five lives to win START THE GAME.
Math Games Compiled By: Joan Bartlett and Heather Bartlett.
DiceRoller DiceRoller (object class) and DiceRollerViewer client class: Write a DiceRoller class (similar to Yahtzee) to: Allow the person to initially.
Integer Notes 1. positive numbers any whole number greater than zero 2. negative numbers any whole number less than zero 3. opposites numbers that are.
Chapter 9 Review. 1. Give the probability of each outcome.
Consider This… NAEP item: The two fair spinners shown below are part of a carnival game. A player wins a prize only when both arrows land on black after.
Click here to Play!. Is ICT the best subject ever?  A : No  B : Yes always!  C : Depends on the task  D : Maybe 10 £1 THOUSAND 9 £900 8 £800 7 £700.
Cookie Monster Game By Sailifale Tuiolosega and Johnny Mahu.
Petals Around the Rose. The Rules: The name of the game is petals around the rose. The name of the game is important. The answer is either zero or even.
Petals Around the Rose. The name of the game is Petals Around the Rose. The name of the game is important. The computer will roll five dice and ask you.
Designing While Loops CSIS 1595: Fundamentals of Programming and Problem Solving 1.
SCORING HIGH SCHOOL VOLLEYBALL, SCORING CLINIC PREFACE This is a PowerPoint designed to help high school scorers comply with NFHS scoring procedures.
Programming Fundamentals I Java Programming Spring 2009 Instructor: Xuan Tung Hoang TA: Tran Minh Trung Lab 03.
Iteration. Iteration: Review  If you wanted to display all the numbers from 1 to 1000, you wouldn’t want to do this, would you? Start display 1 display.
PIG GAME. MATERIALS  Dices  Scoring pad or sheets Player 1Player 2 Roll
Middle Focus Group 7 September 2011 Raewyn Carman Dianne Ogle.
Computer Science I: Understand how to evaluate expressions with DIV and MOD Random Numbers Reading random code Writing random code Odds/evens/…
Goals Your organization has three metrics to measure mission effectiveness Count your successes in each category for each roll 1.Total of exactly thirteen.
How do I write the formula for ionic bonds? Starter: We’re creating a floppy book 1. Pick up the anticipatory set as you work in the room and staple it.
13 Lesson 1 Let Me Count the Ways Fundamental Counting Principle, Permutations & Combinations CP Probability and Statistics FA 2014 S-ID.1S-CP.3S-CP.5.
5.3 The Central Limit Theorem
Number guessing game Pick a random number between 1 and 10
Object of the game Yahtzee Large straight Small straight Full house
5.3 The Central Limit Theorem
Dry run Fix Random Numbers
Type Title Here Directions: Use index cards or Avery Business Card templates to create game cards . Players roll the die, take a card, answer the question.
Games Workshop.
Object of the game Yahtzee Large straight Small straight Full house
It's time for The Feudal Game.
5.3 The Central Limit Theorem
Computer Science I: Get out your notes.
Object of the game Yahtzee Large straight Small straight Full house
Matlab tutorial course
Object of the game Yahtzee Large straight Small straight Full house
Rules of the game: Games 1.Throw three die then write 3 numbers.
Presentation transcript:

Polar Bears: A n ice Game CMSC104 Spring 2010 Project 3

Polar bears,

Polar bears, they come in pairs.

Polar bears, they come in pairs. They sit around the hole in the ice

Polar bears, they come in pairs Polar bears, they come in pairs. They sit around the hole in the ice like petals around a flower.

Polar bears, they come in pairs Polar bears, they come in pairs. They sit around the hole in the ice like petals around a flower. How many polar bears do you see?

Polar bears, they come in pairs Polar bears, they come in pairs. They sit around the hole in the ice like petals around a flower. How many polar bears do you see? How many fish in the sea?

Polar bears, they come in pairs Polar bears, they come in pairs. They sit around the hole in the ice like petals around a flower. How many polar bears do you see? How many fish in the sea? What about the plankton?

Sample Game 1 How many polar bears do you see? Polar bears, they come in pairs. They sit around the hole in the ice like petals around a flower How many polar bears do you see? How many fish in the sea? What about the plankton? Sample Game 1 How many polar bears do you see?

Sample Game 1 How many polar bears do you see? Polar bears, they come in pairs. They sit around the hole in the ice like petals around a flower How many polar bears do you see? How many fish in the sea? What about the plankton? Sample Game 1 How many polar bears do you see? Answer: There are 6 polar bears

Sample Game 1 How many fish in the sea? Polar bears, they come in pairs. They sit around the hole in the ice like petals around a flower How many polar bears do you see? How many fish in the sea? What about the plankton? Sample Game 1 How many fish in the sea?

Sample Game 1 How many fish in the sea? Polar bears, they come in pairs. They sit around the hole in the ice like petals around a flower How many polar bears do you see? How many fish in the sea? What about the plankton? Sample Game 1 How many fish in the sea? Answer: There are 7 fish in the sea

Sample Game 1 What about the plankton? Polar bears, they come in pairs. They sit around the hole in the ice like petals around a flower How many polar bears do you see? How many fish in the sea? What about the plankton? Sample Game 1 What about the plankton?

Sample Game 1 What about the plankton? Answer: There are 28 plankton Polar bears, they come in pairs. They sit around the hole in the ice like petals around a flower How many polar bears do you see? How many fish in the sea? What about the plankton? Sample Game 1 What about the plankton? Answer: There are 28 plankton

Sample Game 2 How many polar bears do you see? Polar bears, they come in pairs. They sit around the hole in the ice like petals around a flower How many polar bears do you see? How many fish in the sea? What about the plankton? Sample Game 2 How many polar bears do you see?

Sample Game 2 How many polar bears do you see? Polar bears, they come in pairs. They sit around the hole in the ice like petals around a flower How many polar bears do you see? How many fish in the sea? What about the plankton? Sample Game 2 How many polar bears do you see? Answer: There are 0 polar bears

Sample Game 2 How many fish in the sea? Polar bears, they come in pairs. They sit around the hole in the ice like petals around a flower How many polar bears do you see? How many fish in the sea? What about the plankton? Sample Game 2 How many fish in the sea?

Sample Game 2 How many fish in the sea? Polar bears, they come in pairs. They sit around the hole in the ice like petals around a flower How many polar bears do you see? How many fish in the sea? What about the plankton? Sample Game 2 How many fish in the sea? Answer: There are 21 fish in the sea

Sample Game 2 What about the plankton? Polar bears, they come in pairs. They sit around the hole in the ice like petals around a flower How many polar bears do you see? How many fish in the sea? What about the plankton? Sample Game 2 What about the plankton?

Sample Game 2 What about the plankton? Answer: There are 0 plankton Polar bears, they come in pairs. They sit around the hole in the ice like petals around a flower How many polar bears do you see? How many fish in the sea? What about the plankton? Sample Game 2 What about the plankton? Answer: There are 0 plankton

“Polar Bears” as a game Five dice are rolled and based on that role: You have to guess the number of polar bears If you get that correct, then you have to guess the number of fish in the sea. If you get that correct, then you have to state the number of plankton If you get that correct, then you win the game!

What’s going on? You get clues from the poem! Polar bears, they come in pairs. They sit around the hole in the ice like petals around a flower How many polar bears do you see? How many fish in the sea? What about the plankton? What’s going on? You get clues from the poem! Read the poem again, can you discern the clues?

Decoding the poem Polar bears, [polar opposite ends of an axis] they come in pairs. [even number of polar bears] They sit around the hole in the ice [hole in the dice] like petals around a flower [dice hole is in the center] How many polar bears do you see? [use the rules above] How many fish in the sea? What about the plankton? Decoding the poem Hole in dice, one pair sitting on axis = 2 polar bears No hole in dice, no pairs sitting on axis = 0 polar bears Hole in dice, two pairs sitting on axis = 4 polar bears Hole in dice, no pair sitting on axis = 0 polar bears No hole in dice, no pairs sitting on axis = 0 polar bears No hole in dice, no pairs sitting on axis = 0 polar bears

First rule: Polar bears, [polar opposite ends of an axis] they come in pairs. [even number of polar bears] They sit around the hole in the ice [hole in the dice] like petals around a flower [dice hole is in the center] How many polar bears do you see? [use the rules above] How many fish in the sea? What about the plankton? First rule: A die role of a 1: generates 0 polar bears A die role of a 2: generates 0 polar bears A die role of a 3: generates 2 polar bears A die role of a 4: generates 0 polar bears A die role of a 5: generates 4 polar bears A die role of a 6: generates 0 polar bears Then add up the number of polar bears on the five dice to get the total number of polar bears. Note than each die is rolled independently, so any one number may appear just once, several times, or not all. Once you know the rule, the game is simple. But if do not know the rule, the game can be frustrating and difficult!

Apply the rule: Polar bears, [polar opposite ends of an axis] they come in pairs. [even number of polar bears] They sit around the hole in the ice [hole in the dice] like petals around a flower [dice hole is in the center] How many polar bears do you see? [use the rules above] How many fish in the sea? What about the plankton? Apply the rule: So now that we know the rule, applying it becomes simple. Look at the dice rolls for sample games 1 and 2 and count the number of polar bears. 0 + 2 + 0 + 0 + 4 = 6 0 + 0 + 0 + 0 + 0 = 0

Something is fishy! Polar bears, [polar opposite ends of an axis] they come in pairs. [even number of polar bears] They sit around the hole in the ice [hole in the dice] like petals around a flower [dice hole is in the center] How many polar bears do you see? [use the rules above] How many fish in the sea? What about the plankton? Something is fishy! Hole in dice, one pair sitting on axis = 2 polar bears  0 fish No hole in dice, no pairs sitting on axis = 0 polar bears  3 fish Hole in dice, two pairs sitting on axis = 4 polar bears  0 fish Hole in dice, no pair sitting on axis = 0 polar bears  6 fish No hole in dice, no pairs sitting on axis = 0 polar bears  5 fish No hole in dice, no pairs sitting on axis = 0 polar bears  1 fish

Second rule: Polar bears, [polar opposite ends of an axis] they come in pairs. [even number of polar bears] They sit around the hole in the ice [hole in the dice] like petals around a flower [dice hole is in the center] How many polar bears do you see? [use the rules above] How many fish in the sea? What about the plankton? Second rule: Fish appear when there are 0 polar bears and the number of fish is the number opposite the number on top of the die. A die role of a 1: generates 0 polar bears and 6 fish A die role of a 2: generates 0 polar bears and 5 fish A die role of a 3: generates 2 polar bears and 0 fish A die role of a 4: generates 0 polar bears and 3 fish A die role of a 5: generates 4 polar bears A die role of a 6: generates 0 polar bears and 1 fish Polar bear eat the fish, so when they appear (numbers 3 and 5) there will be zero fish. When there are no polar bears, the fish live, and they are at the bottom of the sea (bottom side of the dice). Opposite sides of a die always add up to 7.

Apply the rule: Polar bears, [polar opposite ends of an axis] they come in pairs. [even number of polar bears] They sit around the hole in the ice [hole in the dice] like petals around a flower [dice hole is in the center] How many polar bears do you see? [use the rules above] How many fish in the sea? What about the plankton? Apply the rule: So now that we know the rule, applying it becomes simple. Look at the dice rolls for sample games 1 and 2 and count the number of fish. 1 + 0 + 3 + 3 + 0 = 7 5 + 1 + 3 + 6 + 6 = 21

Plankton? Polar bears, [polar opposite ends of an axis] they come in pairs. [even number of polar bears] They sit around the hole in the ice [hole in the dice] like petals around a flower [dice hole is in the center] How many polar bears do you see? [use the rules above] How many fish in the sea? What about the plankton? Plankton? Hole in dice, one pair sitting on axis = 2 polar bears  0 fish  14 plankton No hole in dice, no pairs sitting on axis = 0 polar bears  3 fish  0 plankton Hole in dice, two pairs sitting on axis = 4 polar bears  0 fish  14 plankton Hole in dice, no pair sitting on axis = 0 polar bears  6 fish  0 plankton No hole in dice, no pairs sitting on axis = 0 polar bears  5 fish  0 plankton No hole in dice, no pairs sitting on axis = 0 polar bears  1 fish  0 plankton

Third rule: Polar bears, [polar opposite ends of an axis] they come in pairs. [even number of polar bears] They sit around the hole in the ice [hole in the dice] like petals around a flower [dice hole is in the center] How many polar bears do you see? [use the rules above] How many fish in the sea? What about the plankton? Third rule: Fish appear when there are 0 polar bears and the number of fish is the number opposite the number on top of the die. A die role of a 1: generates 0 polar bears and 6 fish and 0 plankton A die role of a 2: generates 0 polar bears and 5 fish and 0 plankton A die role of a 3: generates 2 polar bears and 0 fish and 14 plankton A die role of a 4: generates 0 polar bears and 3 fish and 0 plankton A die role of a 5: generates 4 polar bears A die role of a 6: generates 0 polar bears and 1 fish and 0 plankton Fish eat plankton, so when they appear (numbers 1, 2, 4, and 6) there will be zero plankton. When there are no fish, the plankton live, and they hang around in the water (the four sides of the dice). The four sides of a die always add up to 14.

Apply the rule: Polar bears, [polar opposite ends of an axis] they come in pairs. [even number of polar bears] They sit around the hole in the ice [hole in the dice] like petals around a flower [dice hole is in the center] How many polar bears do you see? [use the rules above] How many fish in the sea? What about the plankton? Apply the rule: So now that we know the rule, applying it becomes simple. Look at the dice rolls for sample games 1 and 2 and count the number of plankton. 0 + 14 + 0 + 0 + 14 = 28 0 + 0 + 0 + 0 + 0 = 0

Summary of rules Die Number P. Bears Fish Plankton 1 6 2 5 3 14 4

Sample Game 1 How many polar bears do you see? Your game should roll the dice and then ask the first question. Sample Game 1 How many polar bears do you see?

Sample Game 1 How many polar bears do you see? 8 If the player gets the wrong answer, the game should NOT tell the player the correct answer, but simply ask if the player wants to play again. In this example, 6 is the correct answer. Sample Game 1 How many polar bears do you see? 8 Sorry that is not correct. Play again?

Sample Game 1 How many polar bears do you see? 6 That is correct. If the player gets the correct answer, the program should state that and then ask the next question. In this example, 6 is the correct answer. Sample Game 1 How many polar bears do you see? 6 In this case the program advances to the next question, which is shown on the next slide. That is correct.

Sample Game 1 How many fish in the sea? 8 Just like the first question, if the player gets the wrong answer, the game should NOT tell the player the correct answer, but simply ask if the player wants to play again. In this example, 7 is the correct answer. Sample Game 1 How many fish in the sea? 8 Sorry that is not correct. Play again?

Sample Game 1 How many fish in the sea? 7 That is correct. If the player gets the correct answer, the program should state that and then ask the next question. In this example, 7 is the correct answer. Sample Game 1 How many fish in the sea? 7 In this case the program advances to the next question, which is shown on the next slide. That is correct.

Sample Game 1 What about the plankton? 8 Just like the first question, if the player gets the wrong answer, the game should NOT tell the player the correct answer, but simply ask if the player wants to play again. In this example, 28 is the correct answer. Sample Game 1 What about the plankton? 8 Sorry that is not correct. Play again?

Sample Game 1 What about the plankton? 28 If the player gets the correct answer, the program should state that and then ask the next question. In this example, 28 is the correct answer. Sample Game 1 What about the plankton? 28 That is correct. You win! Play again?

Expectations Users (you, the grader, the instructor) will only enter non-negative numbers (0, 1, 2, 3, …) so you should have a loop to prevent the entry of a negative number. Do not worry about other types of input: strings, characters, etc. When asked to “Play again?” typing “yes” will continue the game, anything else will end the game You do not have to keep track of games played, wins, losses, etc., but you may if you want to.