CSE 231 Fall 2012 Programming Project 8

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

CS Programming Project 1

Activity 6: Playing Elevens

CS Project 1 Fall 2017

10 Game. Chapter. The PV Unit comes with two built-in games for your enjoyment. The games are named Game-1 and Game-2.

Programming Assignment 4

Lab Exercise #10. Assignment Overview

CSE 231 Spring 2013 Programming Project 03

CMSC 201 Fall 2018 Project 3 Sudoku

CS 152 Computer Programming Fundamentals Lab 8: Klondike Solitaire

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

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

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

The Exciting World of Bridge

Card Games Rules. for Kids

Problem Set 4: Video Poker

The Exciting World of Bridge

CMS.608 / CMS.864 Game Design Spring 2008

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

Here are two situations involving chance:

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.

For slightly more detailed instructions on how to play, visit:

FreeCell Puzzle Protocol Document

Venn Diagram Problems

Problem 4.R1: Best Range

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

Royal Battles. A Tactical Game using playing cards and chess pieces. by Jeff Moore

Roll & Make. Represent It a Different Way. Show Your Number as a Number Bond. Show Your Number on a Number Line. Show Your Number as a Strip Diagram

In this project you will learn how to write a Python program telling people all about you. Type the following into the window that appears:

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

User Guide / Rules (v1.6)

The Birds of a Feather Research Challenge. Todd W. Neller Gettysburg College November 9 th, 2017

Introduction to Artificial Intelligence CS 151 Programming Assignment 2 Mancala!! Due (in dropbox) Tuesday, September 23, 9:34am

COMP 9 Lab 3: Blackjack revisited

TABLE GAMES RULES OF THE GAME

An Amazing Mathematical Card Trick

2 The Universe Teachpack: Client/Server Interactions

LEARN HOW TO PLAY MINI-BRIDGE

Programming Exam. 10% of course grade

Battle. Table of Contents. James W. Gray Introduction

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

Comprehensive Rules Document v1.1

FOR THE CROWN Sample Play

GorbyX Rummy is a unique variation of Rummy card games using the invented five suited

CONTENTS. 1. Number of Players. 2. General. 3. Ending the Game. FF-TCG Comprehensive Rules ver.1.0 Last Update: 22/11/2017

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

Beeches Holiday Lets Games Manual

Chapter 2 Integers. Math 20 Activity Packet Page 1

OH! THE MATH THAT THEY'LL KNOW

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

FLOP POKER. Rank-- or ranking means the relative position of a card or hand as set forth in Section 5.

TEXAS HOLD EM BONUS POKER

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

Acing Math (One Deck At A Time!): A Collection of Math Games. Table of Contents

DIVISION III (Grades 4-5) Common Rules

FOUR CARD POKER. Hand-- means the best four card poker hand that can be formed by each player and the dealer from the cards they are dealt.

Programming Languages and Techniques Homework 3

HEADS UP HOLD EM. "Cover card" - means a yellow or green plastic card used during the cut process and then to conceal the bottom card of the deck.

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.

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

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

ULTIMATE TEXAS HOLD EM

PLAYERS AGES MINS.

A Rule-Based Learning Poker Player

Levels. Chapter Nine PLAY VIDEO INTRODUCTION LEVEL MANAGER AND LEVEL DISPLAY DIALOGS LEVEL MANAGER DIALOG

GeoPlunge Combo 1 Overview

ABOUT THE GAME COMPONENTS

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

A UNIQUE COMBINATION OF CHANCE & SKILL.

GOAL OF THE GAME CONTENT

Domino Games. Variation - This came can also be played by multiplying each side of a domino.

Solitaire Rules Deck construction Setup Terrain Enemy Forces Friendly Troops

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

NUMB3RS Activity: A Bit of Basic Blackjack. Episode: Double Down

Begin this assignment by first creating a new Java Project called Assignment 5.There is only one part to this assignment.

DIVISION III (Grades 4-5) Common Rules

Grades 7 & 8, Math Circles 27/28 February, 1 March, Mathematical Magic

Ante or ante wager means the initial wager required to be made prior to any cards being dealt in order to participate in the round of play.

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

The game consists of 3 rounds where you will build a castle in 30 seconds then place catapults and steal wall pieces from your neighbors.

3. If you can t make the sum with your cards, you must draw one card. 4. Players take turns rolling and discarding cards.

Inheritance Inheritance

Problem A. Worst Locations

Welcome to the Break Time Help File.

THE STORY GAME PLAY OVERVIEW

HIGH CARD FLUSH 1. Definitions

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

Only and are worth points. The point value of and is printed at the bottom of the card.

HAND & FOOT CARD GAME RULES

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

Part II: Number Guessing Game Part 2. Lab Guessing Game version 2.0

Activity 3: Combinations

Cards Against Inanity

Maryland State Lottery and Gaming Control Agency Standard Rules - Double Draw Poker

* Rules are not final and subject to change *

CPSC 217 Assignment 3

LET IT RIDE POKER. Stub-- means the remaining portion of the deck after all cards in the round of play have been dealt or delivered.

Contents 60 Bird cards Each habitat has: 1 ace 1 raptor 1 rare 2 of each uncommon. Setup. Game Overview

Homework #3: Trimodal Matching

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

Transcription:

CSE 231 Fall 2012 Programming Project 8 Assignment Overview This assignment will give you more experience on the use of classes. It is worth 50 points (5.0% of the course grade) and must be completed and turned in before 11:59 on November 12 (that is 2 weeks because of the exam). Background You will create a program that allows a user to play the card game 2-Suit Spider Solitaire. This is a popular version of the solitaire class of card games, and your job is to enforce the rules of the game. A playable example of this game and the rule can be found at http://www.worldofsolitaire.com (click Solitaire at the left-upper corner, click Select game, and choose Spider (2 Suits) ). If you are not familiar with the game, play it first to get a better understanding of the rules. (It is really hard to win this game!) Game setup: At the beginning of the game, two suits are selected (for example, hearts and spades). Four decks of cards are combined, but only using the cards from those two suits. This means that a total of 104 cards are used in this game (of the 52 heart cards, there will be 4 instances of each rank, and the same for the spades cards). The main playing area is called the tableau. This consists of 10 piles of cards. At the beginning of the game, 54 of the cards are dealt to these piles (4 piles get 6 cards, while the rest get 5 cards each). All cards except for the top card are hidden (look at the included cards.py and cardsdemo.py files for examples). There is a single pile for the foundation. This is where completed runs of cards will be placed (we ll talk more about this). The remaining cards are called the stock. On a deal command, each tableau row is dealt a single card from the stock. Goal: The goal is to sort all the cards into runs of cards. A completed run has cards from the same suit and are in descending order from King down to Ace. Once a run has been completed, it should automatically be placed in the foundation. Once the foundation contains all the cards, the game has been won. Rules: 1. A card moved in the tableau must be placed on a card that is ranked one higher than itself. For example, a 3 can be placed on a 4, but not the other way around. They do not have to be the same suit. 2. A sequence of cards with the same suit and descending rank (i.e. a run ) can be moved in the tableau according to the following restriction: the connecting card must follow the same rank rule, i.e. the highest card in the run must be ranked one lower than the card it is placed on, but need not be the same suit. For example, a sequence with a 4, 3, and 2 of hearts can be place on a 5 card of any suit 3. Cards can only be dealt from the stock if none of the tableau rows are empty. Requirements

You must use both of the provided Card and Deck classes, found in the cards.py file in the project directory. Do not modify the cards.py program as you will only turn in proj09.py. Just import cards.py into your proj08.py. You will not need to use every method in those classes, but look at the example code in cardsdemo.py to get an idea of what you might need. Also, in the project directory is proj08skel.py. This Python file has the skeleton code for one way to solve this project. The pass statement is simply a filler because a function requires something in its suite the pass statement does nothing except fill a void. It is highly suggested to use this format, as it will make your life easier. Regardless of whether you use that format, you must use at least two functions in your program. Perform error checking on all user input. This includes checking for typos as well as incorrect values (such as an invalid row number). If a command cannot be followed, print a specific error message to let the user know what went wrong. You must include the following commands: d - deals more cards (or prints error message if cannot be completed) q - quits the game h - prints help information m (# of cards) (source row #) (dest row #) - moves the number of cards from the source row to the destination row, if the move is allowed When a run of cards from King to Ace has been completed, your program must automatically put that run of cards into the foundation. Do not allow dealing if there are empty tableau rows. Print the game after every move. Look at the example interaction below and follow that general format. Do not simply print a list: make it readable and clean. You may use Hearts and Spades as the two suits for the game. Deliverables You must use handin to turn in the file proj08.py this is your source code solution; include your section, the date, the project number and comments describing your code. Be sure to use the specified file name, and save a copy of your proj08.py file to the CSE server (your H drive) as a backup. Notes and Hints 1. Play with the online game and get a feel for it. 2. Look carefully at the example cardsdemo.py program. It imports the cards module and uses the two classes. Understanding what it does will give you a better idea how you can use these classes. These classes provide more methods than you will probably use, but they should provide almost any method you need. 3. When using class methods remember the parenthesis no error is generated for missing parenthesis, but the results will not be what you expect. 4. There are multiple parts to the game (setup, printing, game play, starting). Address each one individually and then put them together. Try starting with the setup, and then work on printing the game.

5. For playing the game, begin by assuming perfect input. Get that working and add error checking later. 6. For the setup you will need to create the special deck required for this game. Start with an empty deck (create a regular deck and then discard all 52 cards) and the fill the deck with Hearts and Spades from four decks. 7. The move_in_tableau is the hardest function. A good way to simplify this function for starting is to have it move only one card at a time. Once you can do that, work on moving runs. If you can get the whole program working with this function only moving one card, you will get most of the points in the project. 8. The hardest part of the play function is checking for errors so begin by assuming no errors. Sample Interactions Rules of Spider Solitaire: The goal is to move all cards to the foundation. Cards can only be moved to the foundation if in a completed run of cards (King, Queen,..., Ace). A single card in the tableau can be moved to another row if the destination card is one rank higher than the moving card. Multiple cards can be moved at once, but all cards within the stack being moved must be in descending order, and they must all be the same suit. The destination card must also be one rank higher than the top card of the stack being moved. Acceptable commands: XX XX XX XX XX 10S XX XX XX XX XX 5S XX XX XX XX JS XX XX XX XX 4S What is your move? --> m 1 10 4 XX XX XX XX XX 10S XX XX XX XX XX 5S 4S XX XX XX XX JS

XX XX XX 6H What is your move? --> m 2 4 10 XX XX XX XX XX 10S XX XX XX XX QH XX XX XX XX JS XX XX XX 6H 5S 4S What is your move? --> m 1 1 6 XX XX XX XX 3S XX XX XX XX QH XX XX XX XX JS 10S XX XX XX 6H 5S 4S What is your move? --> m 1 1 2 The source card must be one rank lower than the destination card. XX XX XX XX 3S XX XX XX XX QH XX XX XX XX JS 10S XX XX XX 6H 5S 4S (skipping ahead) XX XX XX 5S

XX XX XX XX 9S 8H XX XX XX XX AS XX XX XX XX QH JS 10S AH XX XX 6S 5S 4S 3S XX XX XX AH AS XX XX XX 6H 5H What is your move? --> m 2 2 4 The cards which you are trying to move are not correctly ordered (skipping ahead) XX XX XX 5S XX XX XX XX 9S 8H XX XX XX XX AS XX XX XX XX QH JS 10S XX XX XX JS XX XX 6S 5S 4S 3S 2H AH AH XX XX KH AS XX XX XX 6H 5H What is your move? --> d AH 6S AS 5H What is your move? --> md 1 9 10 Incorrect command. Acceptable commands:

AH 6S AS 5H What is your move? --> m 1? 10 Incorrect command. Move command must be followed by three numbers. Acceptable commands: AH 6S AS 5H What is your move? --> h Rules of Spider Solitaire: The goal is to move all cards to the foundation. Cards can only be moved to the foundation if in a completed run of cards (King, Queen,..., Ace). A single card in the tableau can be moved to another row if the destination card is one rank higher than the moving card. Multiple cards can be moved at once, but all cards within the stack being moved must be in descending order, and they must all be the same suit. The destination card must also be one rank higher than the top card of the stack being moved. Acceptable commands: AH 6S AS 5H

What is your move? --> q Thank you for playing!