Conditionals Coding with Playing Cards. Card game – Teacher v Students The rules of the game are: If I draw a black card, I get a point Else, you get.

Slides:



Advertisements
Similar presentations
Probability and Conditional Probability. Probability Four balls What is the probability of choosing the ball in the red box? Since there are four balls.
Advertisements

Modelling & Datatypes John Hughes. Software Software = Programs + Data.
© Glenn Rowe AC Lab 2 A simple card game (twenty- one)
It’s All in the Cards Adding and Subtracting Integers
Index Student Activity 1: Questions to familiarise students with the
What is Probability Learning Intention Success Criteria
Chapter 2 Probability. 2.1 Sample Spaces and Events.
WIN, LOSE OR DRAW. RULES Divide the class into teams. One member of the team will draw a card. They will then try to give clues by drawing on the whiteboard.
Adding Probabilities Advanced Math Topics. Vocabulary Simple Event: cannot be broken down into smaller events Rolling a 1 on a 6 sided die Rolling a 1.
4.2 Probability Models. We call a phenomenon random if individual outcomes are uncertain but there is nonetheless a regular distribution of outcomes in.
Chris Morgan, MATH G160 January 18, 2012 Lecture 4 Chapter 4.4: Independence 1.
Intro to Probability & Games
Mau Mau (mow- mow) A card game
A R R A Y ! for Multiplication!!
Laws of Probability What is the probability of throwing a pair of dice and obtaining a 5 or a 7? These are mutually exclusive events. You can’t throw.
VOCABULARY  Deck or pack  Suit  Hearts  Clubs  Diamonds  Spades  Dealer  Shuffle  Pick up  Rank  Draw  Set  Joker  Jack 
7.3 Probabilities when Outcomes are Equally Likely.
Academy Algebra II/Trig 14.3: Probability HW: worksheet Test: Thursday, 11/14.
3.3: The Addition Rule Objective: To use the addition rule to calculate probabilities CHS Statistics.
PING PONG (Table Tennis)
Copyright (c) 2004 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 2 Probability.
12-5 Adding Probabilities. Vocabulary  Simple Event: cannot be broken down into smaller events Rolling a 1 on a 6 sided die  Compound Event: can be.
Probability refers to uncertainty THE SUN COMING UP FROM THE WEST.
Combinations Problems Problem 1: Sometimes we can use several counting techniques in the same problem, such as combinations and the addition principle.
© 2003 Prentice-Hall, Inc.Chap 4-1 Business Statistics: A First Course (3 rd Edition) Chapter 4 Basic Probability.
Compound Probability Pre-AP Geometry. Compound Events are made up of two or more simple events. I. Compound Events may be: A) Independent events - when.
Algebra II 10.2: Use Combinations Quiz : Friday, 12/13.
Copyright © Cengage Learning. All rights reserved. 4 Probability.
Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 12.2 Theoretical Probability
16.6 Probability: Simple Event OBJ:  To determine the probability of a simple event.
BA 201 Lecture 6 Basic Probability Concepts. Topics Basic Probability Concepts Approaches to probability Sample spaces Events and special events Using.
Catch the Spirit of Mathematical Practices Mathematics Investigations Q-Cards: Rational Numbers The Q-Card game has 8 starter cards, 28 playing cards,
Poker. Basic card terminology Suits: Hearts, diamonds, clubs, spades Deuce, face cards.
Do Now: Review 10.4 Multiple Choice 1.) What does mean? a.) b.) c.) Short Answer 2.) Find the number of arrangements of 3 #’s for a locker with a total.
FG ABCDE (–) (x) (÷) Addition2.3 Subtraction2.4 Matrices 2.5 Multiplication2.6 Distributive.
Sec 4.4 The multiplication Rule and conditional probability.
Algebra II 10.3: Define and Use Probability Quiz : tomorrow.
Algebra II 10.4: Find Probabilities of Disjoint and Overlapping Events HW: HW: p.710 (8 – 38 even) Chapter 10 Test: Thursday.
Review Homework pages Example: Counting the number of heads in 10 coin tosses. 2.2/
Addition Rules for Probability CHAPTER 4.2.  A person is female  A person is Republican  A person is both female and a Republican  A person is a Democrat.
WOULD YOU PLAY THIS GAME? Roll a dice, and win $1000 dollars if you roll a 6.
Probability What’s the chance of that happening? MM1D2 a, b, c.
MATH 110 Sec 13.1 Intro to Probability Practice Exercises We are flipping 3 coins and the outcomes are represented by a string of H’s and T’s (HTH, etc.).
Draw 3 cards without replacement from a standard 52 card deck. What is the probability that: 1.They are all red ? 2.At least one is black ? 3.They are.
Do Now. Introduction to Probability Objective: find the probability of an event Homework: Probability Worksheet.
Taboo A thinking game. Step 1 You will be placed in a group of four people Each group is in competition with the other groups. Work together as a group.
Binomial Mean & St. Dev. Binomial Mean & Standard Deviation Expectation Yearbook Page - $14.
Week 8 : User-Defined Objects (Simple Blackjack Game)
Chapter 10 – Data Analysis and Probability 10.8 – Probability of Independent and Dependent Events.
INSERT A TITLE HERE RULES Divide the class into teams. Teams will take turns answering questions. Each class member will take his/her turn to answer.
Have you ever played a game where everyone should have an equal chance of winning, but one person seems to have all the luck? Did it make you wonder if.
Welcome to... A Game of X’s and O’s. Another Presentation © All rights Reserved
Chance We will base on the frequency theory to study chances (or probability).
The Counting Principle Permutation Or Combination.
Predicting Outcomes Using Probability Lines & Writing Probabilities
Fast Ball Curve Ball Change Up Knuckle Ball Strike Outs Single Single
10.7: Probability of Compound Events Test : Thursday, 1/16
Set-Up Fill in your questions and answers.
11/7/16 Entry 173 – Objective I will review and continue developing my understanding of uniform probability models, including the complement of an event.
The Addition Rule.
9.7 Probability of Compound Events
Multiplication Rule and Conditional Probability
A R R A Y ! for Multiplication!!
Main Game Set-Up Fill in your questions and answers.
A bucket contains 20 red checkers and 20 black ones
Experiments, Sample Spaces, and Events
The meaning of probability
©G Dear2009 – Not to be sold/Free to use
Jeopardy.
A R R A Y ! for Multiplication!!
Presentation transcript:

Conditionals Coding with Playing Cards

Card game – Teacher v Students The rules of the game are: If I draw a black card, I get a point Else, you get a point

Card game – Teacher v Students The rules of the game are: If I draw a black card, I get a point Else, you get a point if (card.colour) == black) { teacher.points +=1; } else { student.points +=1 }

What is this game? Work together to understand what the rules of this next game are. Then split into two teams and each team takes it in turns to draw a card from the pack, until each team has drawn 15 cards. The rules are: if (card.colour) == black) { team.points +=1; } if (card.suit) == clubs) { team.points +=2; } else { otherteam.points +=1 } Pseudo code: If a card is black the playing team gets 1 point If the card is a club they get 2 points Else the other team gets a point

Card properties Card PropertiesVariables card.colourblack, red card.suitdiamonds, hearts, clubs, spades card.valueA=1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 10, J=11, Q=12, K=13 Attributing points - some examples +=1 -=2 +=timesTwo (to double the current score)

Writing code for another game Write the code for the following game: 1.The team drawing the card gets a point for every red card, 2.except if drawing a red ace, when they will double their current points score, 3.else the other team gets a point.

Writing code for another game Write the code for a game where the team drawing the card gets a point for every red card, except if drawing a red ace, when they will double their current points score, else the other team gets a point. if (card.colour) == red) { team.points +=1; if (card.value) == ace) { team.points +=timesTwo; } else { otherteam.points +=1 }

Code your own card game Can you make up a game and write the code for the game rules where: odds and even numbered cards are treated differently? the points scored relate to the face value of the card? there are special events – eg wiping out all points, instant win, triple points