Programming Assignment 4

Similar documents
CS Project 1 Fall 2017

CS Programming Project 1

Problem Set 4: Video Poker

PROBLEM SET 2 Due: Friday, September 28. Reading: CLRS Chapter 5 & Appendix C; CLR Sections 6.1, 6.2, 6.3, & 6.6;

CSE 231 Fall 2012 Programming Project 8

A Case Study. Overview. References. Video poker Poker.Card & Poker.Hand General.dll & game variants

A Rule-Based Learning Poker Player

CARIBBEAN. The Rules

Poker Hands. Christopher Hayes

COMP 9 Lab 3: Blackjack revisited

Activity 6: Playing Elevens

Fall 2017 March 13, Written Homework 4

Poker Rules Friday Night Poker Club

TABLE OF CONTENTS TEXAS HOLD EM... 1 OMAHA... 2 PINEAPPLE HOLD EM... 2 BETTING...2 SEVEN CARD STUD... 3

P a g e 1 HOW I LEARNED POKER HAND RANKINGS

To play the game player has to place a bet on the ANTE bet (initial bet). Optionally player can also place a BONUS bet.

Activity 3: Combinations

DELIVERABLES. This assignment is worth 50 points and is due on the crashwhite.polytechnic.org server at 23:59:59 on the date given in class.

Poker: Probabilities of the Various Hands

Presents: Basic Card Play in Bridge

CS 210 Fundamentals of Programming I Spring 2015 Programming Assignment 8

After receiving his initial two cards, the player has four standard options: he can "Hit," "Stand," "Double Down," or "Split a pair.

ECE2049: Foundations of Embedded Systems Lab Exercise #1 C Term 2018 Implementing a Black Jack game

Poker: Probabilities of the Various Hands

LESSON 6. Rebids by Responder. General Concepts. General Introduction. Group Activities. Sample Deals

CS 210 Fundamentals of Programming I Fall 2015 Programming Project 8

Computer Science 25: Introduction to C Programming

Problem A. Worst Locations

Welcome to the Best of Poker Help File.

Texas Hold'em $2 - $4

Assignment 1. Due: 2:00pm, Monday 14th November 2016 This assignment counts for 25% of your final grade.

10, J, Q, K, A all of the same suit. Any five card sequence in the same suit. (Ex: 5, 6, 7, 8, 9.) All four cards of the same index. (Ex: A, A, A, A.

2 Textual Input Language. 1.1 Notation. Project #2 2

Up & Down GOAL OF THE GAME UP&DOWN CARD A GAME BY JENS MERKL & JEAN-CLAUDE PELLIN ART BY CAMILLE CHAUSSY

BLACKJACK Perhaps the most popular casino table game is Blackjack.

Texas Hold em Poker Rules

Project 2 - Blackjack Due 7/1/12 by Midnight

Poker: Further Issues in Probability. Poker I 1/29

Electronic Wireless Texas Hold em. Owner s Manual and Game Instructions #64260

POKER (AN INTRODUCTION TO COUNTING)

1 Modified Othello. Assignment 2. Total marks: 100. Out: February 10 Due: March 5 at 14:30

{ a, b }, { a, c }, { b, c }

Shuffle Up and Deal: Should We Have Jokers Wild?

LESSON 4. Eliminating Losers Ruffing and Discarding. General Concepts. General Introduction. Group Activities. Sample Deals

Problem A. Alignment of Code

Activity 1: Play comparison games involving fractions, decimals and/or integers.

Live Casino game rules. 1. Live Baccarat. 2. Live Blackjack. 3. Casino Hold'em. 4. Generic Rulette. 5. Three card Poker

CATFISH BEND CASINOS, L.C. RULES OF THE GAME FOUR CARD POKER

LESSON 8. Putting It All Together. General Concepts. General Introduction. Group Activities. Sample Deals

GAMBLING ( ) Name: Partners: everyone else in the class

LESSON 3. Responses to 1NT Opening Bids. General Concepts. General Introduction. Group Activities. Sample Deals

CS 241 Data Organization using C. Project: Identifying the Rank of a Poker Hand and an Empirical Calculation of Probabilities

CMPSCI 240: Reasoning Under Uncertainty First Midterm Exam

CSE231 Spring Updated 04/09/2019 Project 10: Basra - A Fishing Card Game

More Probability: Poker Hands and some issues in Counting

LESSON 5. Watching Out for Entries. General Concepts. General Introduction. Group Activities. Sample Deals

Item Description - MC Phi - Please note: any activity that is not completed during class time may be set for homework or undertaken at a later date.

LESSON 2. Objectives. General Concepts. General Introduction. Group Activities. Sample Deals

2016 CCSC Eastern Conference Programming Competition

For this assignment, your job is to create a program that plays (a simplified version of) blackjack. Name your program blackjack.py.

LET S PLAY PONTOON. Pontoon also offers many unique payouts as well as a Super Bonus of up to $5000 on certain hands.

TABLE GAMES RULES OF THE GAME

SPLIT ODDS. No. But win the majority of the 1089 hands you play in this next year? Yes. That s why Split Odds are so basic, like Counting.

DECLARER PLAY TECHNIQUES - I

Lab Exercise #10. Assignment Overview

CSCE 2004 S19 Assignment 5. Halfway checkin: April 6, 2019, 11:59pm. Final version: Apr. 12, 2019, 11:59pm

LESSON 3. Developing Tricks the Finesse. General Concepts. General Information. Group Activities. Sample Deals

LESSON 2. Developing Tricks Promotion and Length. General Concepts. General Introduction. Group Activities. Sample Deals

CS151 - Assignment 2 Mancala Due: Tuesday March 5 at the beginning of class

LESSONPLAN TENTH GRADE

ProgrammingAssignment #7: Let s Play Blackjack!

ATeacherFirst.com. S has shown minimum 4 hearts but N needs 4 to support, so will now show his minimum-strength hand, relatively balanced S 2

Chapter 2 Integers. Math 20 Activity Packet Page 1

Leads and Signals. Why is it all so difficult?

ALL YOU SHOULD KNOW ABOUT REVOKES

POINTS TO REMEMBER Planning when to draw trumps

Content Page. Odds about Card Distribution P Strategies in defending

Counting integral solutions

Texas Hold em Poker Basic Rules & Strategy

HOW TO PLAY BLACKJACK

Project 1: A Game of Greed

Combine Like Terms

PLAYERS AGES MINS.

Assignment 6 Play A Game: Minesweeper or Battleship!!! Due: Sunday, December 3rd, :59pm

BEGINNING BRIDGE Lesson 1

Sheepshead, THE Game Set Up

OPENING IDEA 3: THE KNIGHT AND BISHOP ATTACK

FAST ACTION HOLD EM. Copy hand-- means a five-card hand of a player that is identical in rank to the five-card hand of the dealer.

LESSON 6. Finding Key Cards. General Concepts. General Introduction. Group Activities. Sample Deals

Date. Probability. Chapter

HOW to PLAY TABLE GAMES

CPSC 217 Assignment 3 Due Date: Friday March 30, 2018 at 11:59pm

Sheepshead, THE Game Release Notes

Venn Diagram Problems

Assignment 2 (Part 1 of 2), University of Toronto, CSC384 - Intro to AI, Winter

Math 166: Topics in Contemporary Mathematics II

CHAPTER 649a. THREE CARD POKER

End Plays. The Throw-in Play

BASIC SIGNALLING IN DEFENCE

FORTUNE PAI GOW POKER

Transcription:

Programming Assignment 4 Due: 11:59pm, Saturday, January 30 Overview The goals of this section are to: 1. Use methods 2. Break down a problem into small tasks to implement Setup This assignment requires one starter file. Set up your directory via: $ mkdir HW4 $ cd HW4 $ cp /home/linux/ieng6/cs11wb/public/hw4/*. Poker (40 pts) By the end of this assignment you will have created a program that can compare two poker hands and declare a winner. If you ve never played poker, review wikipedia for the list of winning hands (in order): straight flush four of a kind full house flush straight three of a kind two pair one pair high card We will be storing both the card values and suits in arrays. Values will range from: Number Card Representation Value 1 A (Ace) 2 2 3 3 4 4 5 5 6 6 7 7 8 8

9 9 10 10 11 J (Jack) 12 Q (Queen) 13 K (King) And suits will be stored with chars: Char Representation S D H C Suit Value Spades Diamonds Hearts Clubs Step 1 (5 pts): enter a hand of cards Allow the user to input the hand of a single player. You must store this into arrays. My solution used 2 arrays, one for the card value and one for the card suit. It should look exactly like this: This hand represents: Ace of spades, 2 of clubs, 10 of diamonds, Queen of hearts, and King of diamonds. Note: it is safe to assume that we will only enter numbers between 1 13 and we will only enter characters S, D, H, and C. When we test your code, we will follow the rules of input, so it is not necessary to check for bad input. Step 2 (5 pts): print player s cards Print out the cards of the player. This should happen in its own method. Your code should now result in exactly the following: Player 1 s hand: AS 2C 10D QH KD Step 3 (15 pts): Discover player s poker hand Print out the hand of the player, e.g. FULL HOUSE, FOUR OF A KIND, etc. You should select the best hand. That is, if a player has 3 queens and 2 jacks, you would say they have a FULL HOUSE, not three of a kind. You should create methods to test for each possible hand. This will result in 8 methods (high card does not require a method). Don t forget the Ace can be high or low in a run, e.g. A, 2, 3, 4, 5 is a straight, and 10, J, Q, K, A also counts as a straight. Critical at this point: cards will be entered in numerical order, e.g. 1, 2, 3, 11, 12, 13. This is HUGE and will be a key assumption that you can follow in your program, and will make this program much easier. This is my gift to you.

Here s some example runs. Make sure your code prints out these exact hands, this is how we ll be testing your code. Player 1 s hand: AS 2C 10D QH KD Best hand: HIGH CARD Enter Player 1's cards: 1 D 10 C 11 S 12 H 13 H Player 1 s hand: AD 10C JS QH KH Best hand: STRAIGHT Enter Player 1's cards: 10 D 10 H 10 C 13 H 13 D Player 1 s hand: 10D 10H 10C KH KD Best hand: FULL HOUSE Enter Player 1's cards: 2 C 2 H 5 D 11 D 11 C Player 1 s hand: 2C 2H 5D JD JC Step 4 (10 pts): Allow a 2 nd player to enter their cards, print cards and hand This will happen in the same fashion as player 1. You should not need to duplicate code to do this, make sure you re using methods. If we see duplicated code, we will deduct half points for this section. Your code should now look like this: Enter Player 2's cards: 2 C 2 H 5 D 11 D 11 C Player 2 s hand: 2C 2H 5D JD JC Step 5 (5 pts): Print the winner or tie Print the player that has the winning hand. If both players have the same hand, e.g. both players have a full house, print there s a tie. This isn t what happens in poker, but I m making the decision to make this part of the assignment easier, so just print Tie. Here s some example runs. Enter Player 2's cards: 2 C 2 H 5 D 11 D 11 C Player 2 s hand: 2C 2H 5D JD JC Player 1 wins!

Enter Player 2's cards: 1 D 10 D 11 D 12 D 13 D Player 2 s hand: AD 10D JD QD KD Tie! Programmer of the week (optional) If you d like to compete in the programmer of the week challenge, you must complete the above part of the assignment as described. Once you get that to work, create another class, POWeek.java, and start to extend the poker game. If you know how to use javafx or java.swing, you could include graphics. You could implement betting, support multiple players, allow for cards being dealt instead of being input by the user, handle ties, change to Texas hold em, etc. Your tutor will present your submission at our weekly meeting and we ll vote for the top 5 submissions from each class and show those to the students to vote for the programmer of the week. The winner will get an award, 1% extra credit added to their final grade, and be famous for a week. Note: we will only be looking at the running of the code, i.e. we will not count off for anything done in the POWeek.java submission. Style Requirements (10 pts) Different from other assignments You will be graded for the style of programming on this assignment. We are adding javadoc comments as a requirement to the assignment. Use reasonable comments to make your code clear and readable. (New) All methods must have javadoc comments. We will be testing this by running javadoc filename.java and ensuring that the resulting documentation pages appear. Use reasonable variable names that are meaningful. Use static final constants to make your code as general as possible. No hardcoding constant values inline (no magic numbers). o Note (new): There will be many cases in this homework where you want to compare card 1 to card 2, card 2 to card 3, etc. I m allowing you to hardcode numbers for this. Judicious use of blank spaces around logical chunks of code makes your code much easier to read and debug. Keep all lines less than 80 characters. Make sure each level of indentation lines up evenly. Every time you open a new block of code (use a '{'), indent farther by 2 spaces. Go back to the previous level of indenting when you close the block (use a '}'). Always recompile and run your program right before turning it in, just in case you commented out some code by mistake. Turnin Instructions Remember the deadline to turn in your assignment is Saturday, January 30 by 11:59pm.

When you are ready to turn in your program in, type in the following command and answer the prompted questions: $ cd ~/ $ bundlep4 Good; all required files are present: HW4 Do you want to go ahead and turnin these files? [y/n]y OK. Proceeding. Performing turnin of approx. 6144 bytes (+/- 10%) Copying to /home/linux/ieng6/cs11wb/turnin.dest/cs11wb.p4... Done. Total bytes written: 31744 Please check to be sure that's reasonable. Turnin successful.