Name: Checked: jack queen king ace

Similar documents
Name: Checked: Answer: jack queen king ace

CS Programming Project 1

Activity 6: Playing Elevens

CS Project 1 Fall 2017

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

Developed by Rashmi Kathuria. She can be reached at

Venn Diagram Problems

Presents: Basic Card Play in Bridge

Poker Hands. Christopher Hayes

Presentation Notes. Frozen suits

CSE 312: Foundations of Computing II Quiz Section #1: Counting

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

Lab Exercise #10. Assignment Overview

COMP 9 Lab 3: Blackjack revisited

Counting integral solutions

BRIDGE is a card game for four players, who sit down at a

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

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

LEARN HOW TO PLAY MINI-BRIDGE

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

27. Important Object- Oriented Programming Ideas

Section 5.4 Permutations and Combinations

Whatcom County Math Championship 2017 Probability + Statistics 4 th Grade

Section 5.4 Permutations and Combinations

AP Computer Science A Practice Test 6 - Picture and Elevens Labs

CS 152 Computer Programming Fundamentals Lab 8: Klondike Solitaire

Chapter 5: Probability: What are the Chances? Section 5.2 Probability Rules

Classical vs. Empirical Probability Activity

MC215: MATHEMATICAL REASONING AND DISCRETE STRUCTURES

CS 210 Fundamentals of Programming I Fall 2015 Programming Project 8

OALCF Task Cover Sheet. Apprenticeship Secondary School Post Secondary Independence

Chapter 2 Integers. Math 20 Activity Packet Page 1

LESSON 3. Third-Hand Play. General Concepts. General Introduction. Group Activities. Sample Deals

CSE 312: Foundations of Computing II Quiz Section #1: Counting (solutions)

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

Here are two situations involving chance:

AP Computer Science Project 22 - Cards Name: Dr. Paul L. Bailey Monday, November 2, 2017

Problem Set 4: Video Poker

CS 210 Fundamentals of Programming I Spring 2015 Programming Assignment 8

UNIT 9B Randomness in Computa5on: Games with Random Numbers Principles of Compu5ng, Carnegie Mellon University - CORTINA

Tribute to Martin Gardner: Combinatorial Card Problems

Diet customarily implies a deliberate selection of food and/or the sum of food, consumed to control body weight.

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

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.

Lab 1. CS 5233 Fall 2007 assigned August 22, 2007 Tom Bylander, Instructor due midnight, Sept. 26, 2007

2. A separate designated betting area at each betting position for the placement of the ante wager;

CATFISH BEND CASINOS, L.C. RULES OF THE GAME FORTUNE PAI GOW

Conditional Probability Worksheet

Law of Restricted Choice

CS 237 Fall 2018, Homework SOLUTION

Sorting Squares. (Martin Gardner)

HIGH CARD FLUSH 1. Definitions

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

4. Are events C and D independent? Verify your answer with a calculation.

Basic Concepts of Probability and Counting Section 3.1

Questions #21 - #30 From Facebook Page A Teacher First - Pg 1 -

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

FreeCell Puzzle Protocol Document

LESSON 6. The Subsequent Auction. General Concepts. General Introduction. Group Activities. Sample Deals

Poker: Probabilities of the Various Hands

Conditional Probability Worksheet

Corners! How To Play - a Comprehensive Guide. Written by Peter V. Costescu RPClasses.com

CATFISH BEND CASINOS RULES OF THE GAME THREE CARD POKER

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.

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

CMPSCI 240: Reasoning Under Uncertainty First Midterm Exam

Summer Camp Curriculum

Content Page. Odds about Card Distribution P Strategies in defending

The Exciting World of Bridge

Introduction to probability

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

Important Distributions 7/17/2006

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

CSCI 4150 Introduction to Artificial Intelligence, Fall 2004 Assignment 7 (135 points), out Monday November 22, due Thursday December 9

Finite Mathematical Structures A

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

Key Concepts. Theoretical Probability. Terminology. Lesson 11-1

OH! THE MATH THAT THEY'LL KNOW

LESSON 4. Second-Hand Play. General Concepts. General Introduction. Group Activities. Sample Deals

PROBABILITY Case of cards

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

13:69E-1.13Z Criss cross poker; physical characteristics

Texas Hold'em $2 - $4

6/24/14. The Poker Manipulation. The Counting Principle. MAFS.912.S-IC.1: Understand and evaluate random processes underlying statistical experiments

1. Theoretical probability is what should happen (based on math), while probability is what actually happens.

A Rule-Based Learning Poker Player

Modelling & Datatypes. John Hughes

A. Rules of blackjack, representations, and playing blackjack

LONG SUIT HONOR LEADS VS. NOTRUMP by Morris Clark

Bridge Players: 4 Type: Trick-Taking Card rank: A K Q J Suit rank: NT (No Trumps) > (Spades) > (Hearts) > (Diamonds) > (Clubs)

LESSON 2. Opening Leads Against Suit Contracts. General Concepts. General Introduction. Group Activities. Sample Deals

The Human Calculator: (Whole class activity)

3 The multiplication rule/miscellaneous counting problems

Module 2 Drawing Shapes and Repeating

Poker: Probabilities of the Various Hands

Making Predictions with Theoretical Probability. ESSENTIAL QUESTION How do you make predictions using theoretical probability?

MATH-1110 FINAL EXAM FALL 2010

Statistics and Probability

Inheritance Inheritance

Chapter-wise questions. Probability. 1. Two coins are tossed simultaneously. Find the probability of getting exactly one tail.

Transcription:

Lab 11 Name: Checked: Objectives: More practice using arrays: 1. Arrays of Strings and shuffling an array 2. Arrays as parameters 3. Collections Preparation 1) An array to store a deck of cards: DeckOfCards.java This program should have a structure similar to those for Lab 10, i.e., declare and instantiate an array and use two for-loops, one to initialize the array and one to print its contents. Through following steps you will be guided to initialize the array using the contents of two smaller arrays. a. Use initializer lists to create the following arrays: An array of 4 Strings to represent the suits: hearts, spades, diamonds, clubs An array of 13 Strings to represent the ranks: 2, 3,, 10, Jack, Queen, King, Ace b. Declare and instantiate a third array of 52 Strings to represent the deck of 52 playing cards. DO NOT use an initializer list to set its values (do not initialize at all yet). c. Print the contents of all three arrays. What happens if you do not initialize the array s values as is the case of the array deck? Answer: d. Use the arrays for suits and ranks, above, to initialize the deck, so that it consists of Strings like 4 of hearts or King of clubs, i.e., a rank, followed by the string of followed by a suit. Hints: See example of nested for-each loops we did in class. Use a nested for-each loop to combine each suit with each rank, for example hearts and 4, concatenating them to make Strings such as 4 of hearts As the strings are combined, they should be stored as one of the 52 array elements representing the deck. Thus, you will need a counter to index into the deck array. You need to start that at zero and increment it each time an entry is added (in the inner loop). suits 0 1 2 3 hearts spades diamonds clubs ranks 0 1 2 3 4 5 6 7 8 9 10 11 12 2 3 4 5 6 7 8 9 10 jack queen king ace deck 0 1 2 50 51 2 of hearts 3 of hearts 4 of hearts king of clubs ace of clubs

2) Arrays as parameters: Shapes.java a. Run the example Shapes.java. Note the use of arrays as parameters. b. Change the numbers so that you get a nice blue V on a white triangle. c. Write a method addx that adds x (a double) to the value of each element in an array of type double[]. (Note: this is one of the exercises we did in class) Use addx() in the Shapes class to shift the blue V to the right. d. Experiment: use the method addx to draw additional triangles. Note that with this method you have essentially created an alternative to the JavaFX Group translatex() or translatey() methods that we have been using. In what ways is this similar? In what ways is this different? e. Finish by creating a design of your choice using your method three or more times, with different parameters. ------------------------------------ Submit DeckOfCards.java and Shapes.java through Blackboard by 8:00am the morning of the Lab.

Part A. Shuffling in DeckOfCards.java 1. Compare your work with your partner s. Verify that arrays are declared, instantiated, and initialized correctly.. Lab partner s signature: 2. Add code to shuffle the deck as follows: Create a loop to repeat the following many, many times (how many do you think would be enough? ) Generate two random numbers a and b in the range 0..51 Exchange the values (Strings) in deck[a] and deck[b]. For example, if the numbers generated were 2 and 50, then the 4 of hearts and the king of clubs would switch places in the array. After the deck is shuffled, print it again and behold the cards in random order! Part B. Shuffling the DVDCollection 1. Review the code for DVD.java, DVDCollection.java, and Movies.java (client). Modify the client code to add a few more movies so that you have at least 10 to work with. 2. Add a shuffle() method to the DVDCollection class. Use it in the client to shuffle the DVDs and print them again, now in some random order. 3. [Optional challenge] Add another method the DVDCollection class, to sort the DVD s according to increasing price. Can you think of a way to do that? One well known sorting method proceeds as follows: - In a loop, go through the list examining adjacent elements and exchanging them if they are out of order. Obviously, going through the list once will NOT succeed in sorting the elements, but will at least get the largest one to move to the last position in the array. If you repeat this N times, where N is the length of the array, you are sure to get all of them sorted in order. This sorting algorithm is called bubble sort. It is not terribly efficient, but is interesting to implement and to analyze. Part C. Add some more polygons to Shapes.java 1. Compare your design with your partner s. Sign and optionally comment on their design take a selfie together with your V s Go Cats! Lab partner s comments: Lab partner s signature: 2. Add some more code to display a pentagon around the design (to make it look like it is inside a house maybe?). 3.Use the addx() method to display the pentagon in 3 or more positions, in different colors.

Lab 11 Comments Name: Comments on this lab, please: What was the most valuable thing you learned in this lab? What did you like best about this lab? Was there any particular problem? Do you have any suggestions for improving this lab as an effective learning experience?