Computer Science 313 – Advanced Programming Topics.

Slides:



Advertisements
Similar presentations
Card Counting Driller By Oscar Chen For CS491A. Practice your Card Counting Skills Application to allow Blackjack Enthusiasts to sharpen their skills.
Advertisements

Math and Card Games By: Candace DiBiano.
ECE 491 Final Project Multiplayer Card Game Author: Tian Ma Presentation 5/4/2004.
By: Jonathan Quenzer. To have a computer learn how to play Blackjack through reinforcement learning Computer starts off with no memory. After each hand.
Driving Rules: Signs and Symbols 1.Identify sign or symbol on the road 2.Explain what it means.
Catalyst: 9/13/10 List three possible reasons that the diet soda floats while the regular soda sinks. Objective: Formulate and test hypotheses using data.
© Glenn Rowe AC Lab 2 A simple card game (twenty- one)
It’s All in the Cards Adding and Subtracting Integers
S.T.A.I.R.. General problem solving strategy that can be applied to a range problems.
Lecture 10. Simplified roulette European roulette has numbers 0,1,…36. xD0s
Dealer Comm Hand Player makes Ante bet and optional Bonus bet. Five cards are dealt to each player from the shuffler. Five cards are dealt from the shuffler.
Card Counting What is it, how does it work, and can I use it to pay for college? (and if it does work, do I even have to go to college?) Jeff O’Connell.
BLACKJACK SHARKS: Aabida Mayet, Omar Bacerra, Eser Kaptan March 15, 2010.
Dice, Cards and Darts Probabilities in Games Finding the Right Representation.
An application of the Probability Theory
12 Pontoon1May Pontoon program CE : Fundamental Programming Techniques.
Rene Plowden Joseph Libby. Improving the profit margin by optimizing the win ratio through the use of various strategies and algorithmic computations.
Computer Science 313 – Advanced Programming Topics.
Design Example. Requirements Make a program that simulates the game of blackjack For now, we ignore money/betting…. just simulate game play But… this.
Chapter 5 Black Jack. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 5-2 Chapter Objectives Provide a case study example from problem statement.
A R R A Y ! for Multiplication!!
VOCABULARY  Deck or pack  Suit  Hearts  Clubs  Diamonds  Spades  Dealer  Shuffle  Pick up  Rank  Draw  Set  Joker  Jack 
Black Jack Dr. Bernard Chen University of Central Arkansas Spring 2012.
Test Preparation Strategies
Blackjack: Myths vs. Reality Group K Andrew KerrAndrew Phillips Sven SkoogWoj Wrona.
Blackjack: An Analysis of Probability By: John Theobald.
April 2009 BEATING BLACKJACK CARD COUNTING FEASIBILITY ANALYSIS THROUGH SIMULATION.
CPSC 171 Introduction to Computer Science 3 Levels of Understanding Algorithms More Algorithm Discovery and Design.
Casinos There’s a reason they are big and extravagant!
1 Introduction to Discrete Probability Rosen, Section 6.1 Based on slides by Aaron Bloomfield and …
Learning to Play Blackjack Thomas Boyett Presentation for CAP 4630 Teacher: Dr. Eggen.
Inner and Anonymous Classes Though you are captive in the OO paradigm, you can use inner classes and anonymous classes to get around this constraint and.
Key Instant Recall Facts By the end of this half term, children should know the following facts. The aim is for them to recall these facts instantly. Year.
Learning BlackJack with ANN (Aritificial Neural Network) Ip Kei Sam ID:
CSC 313 – Advanced Programming Topics. Design Pattern Intent  Each design pattern is a tool  Like all tools, have reason for being.
Blackjack: A Beatable Game Amber Guo Adapted from: David Parker Advisor: Dr. Wyels California Lutheran University ‘05.
Helping your child meet their maths target Lots of games and activities to choose from! Target focus: Recall of (remembering) addition and subtraction.
Exceptions: Checked versus Unchecked Exceptions.
Learning to Play KardKuro Goals: Have Fun while Practicing Addition and Subtraction. Improve Social Learning Opportunities with Classmates. Become familiar.
Math Games Compiled By: Joan Bartlett and Heather Bartlett.
More on Logic Today we look at the for loop and then put all of this together to look at some more complex forms of logic that a program will need The.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns VIII Chain of Responsibility, Strategy, State.
Gambling Because why not?. Blackjack and card counting Card counting is a casino card game strategy used primarily in the blackjack family of casino games.
Today’s Topics Playing Deterministic (no Dice, etc) Games –Mini-max –  -  pruning –ML and games? 1997: Computer Chess Player (IBM’s Deep Blue) Beat Human.
KEYS Scott Gajewski ART 389A Spring Contents Premise Getting Started -Players -Set-up -Materials Rules -Basics -Points System -Multiple Players.
CMSC 202 A Design Exercise. 2 OO design activities Finding the Objects Defining the responsibilities –Services –Attributes Discovering relationships.
All In To put all the rest of your money into the pot.
GamblingGambling What are the odds? Jessica Judd.
Week 8 : User-Defined Objects (Simple Blackjack Game)
More on Logic Today we look at the for loop and then put all of this together to look at some more complex forms of logic that a program will need The.
Computer Science 313 – Advanced Programming Topics.
Chance We will base on the frequency theory to study chances (or probability).
Gambling and probability 1. Odds and football.  Predict the Premier League results for this weekend.  Can you estimate the probability of a win/draw/loss.
Math in the gamble. Poker is Math Poker is a game that requires the ability to read situations and your opponents to gain an advantage in every hand you.
Discrete Optimization MA2827 Fondements de l’optimisation discrète Dynamic programming (Part 2) Material based on.
Memory and Card Playing: How to Remember Cards. We’ve all had dreams where we’d hit the jackpot while on vacation in Vegas. But you’re not just content.
Math Parent Involvement Workshop November 11, :45 a.m. – 8:30 a.m. Second Grade.
POKER-6S ooA, OOD, OOP.
Congratulations to our wonderful second graders for a fabulous year!!
Lecture 11.
Chapter 5 Black Jack.
CS Fall 2016 (Shavlik©), Lecture 11, Week 6
Lecture 10.
Probability of casino games
Lecture 12.
1st/2nd Grade Math Games Family Math Night.
Blackjack: Counting Hands and Counting Cards
3rd/4th grade Family Math Night Games
Task 2 Implementation help
Multiplication and Division Facts Rummy
Presentation transcript:

Computer Science 313 – Advanced Programming Topics

Rules of Blackjack  Give each 2 cards at the very start  When dealt cards match, make two hands (split)  Request extra cards during turn (take a hit)  Double bet & take one more card (double down)  Try to get close to 21, without going bust  Number cards (2, 3, 4, 5, …, 10) worth value  10 points for each face card (Jack, Queen, King)  Each player can use Ace as 1 or 11  Players win if they beat dealers hand

Dealer Follows Rules  Dealer automatically wins when starting at 21  Equal scores considered tie, otherwise  Very simple set of rules followed by dealer  Must take hit when hand is under 17  Stands in when hand is high enough (18+)  On “soft-17” casino rules vary  Players should be able to win regularly  Casinos not built on losing  Many “winning” systems exist, however

How To Not Lose Quickly  Track cards remaining in deck  Counting cards legal, but hard…  …counting relative values far easier  Remember how “rich” deck is  For each 10 or higher, subtract 1 point  Add 1 for 7s or lower seen so far  As deck score over many hands  Change strategies to reflect situation

Developing this Program  Simple, straightforward program to write  Make decisions using deck’s current value  Deck’s score stored in a field  Update value each time a card is seen  To beat the house, develop complex set of rules  Write needHit(), doubleDown() and others  Each method has HUGE if-else or switch  Hard to make minor changes to your strategy  Thinking about reusing code? Do not bother.

Was That a Hint?  I left a big clue to solution in last slide  Hopefully, you started thinking design pattern  We already discussed this design pattern  Should be obvious choice to encourage reuse  Algorithm family changed dynamically needed

Developing this Program

I’m Master of the Lost Art

Close but not Quite  Strategy pattern holds obvious allure  Several reasons NOT to use this pattern, however  Reasons why strategy pattern inappropriate  Strategy changes internal to context instance  Means of tracking current state is lacking  Unable to find current strategy being used  For this to work, need to update strategies

State Pattern Intent  Instances alter strategy when state changes  Includes Strategy pattern to define actions  Strategies responsible for changing themselves  Actions & state transitions delegated by instance  Perfect for use with finite state machines  Common tool from theory & software engineering  Can be found in many, many systems  Parsers  Systems performing real-time computing  User interface subsystems

For Next Class  Lab due 1 week from today  Please, please, please do not wait until last minute…  Design is hard, but code is very simple  Give yourself time to think and ask questions  Read up on how we implement State pattern  Prepare so we can have fun activity next week