Sei sulla pagina 1di 4

UNIVERSITY OF ROCHESTER

INTRO TO COMPUTER PROGRAMMING (CSC 171)

PROJECT #1 : Due November 8th


Purpose
Our overall goal in CSC171 is to equip you with the ability to bring computational tools to bear on questions of interest. The specific purpose of projects is to have you practice the design and problem solving skills necessary to write entire application together. Much of our educational experience is built on the paradigm of linear thinking (there is one answer, it is in the back of the book). The process of design can present a significant cognitive shift for students who are traditionally used to doing exactly what they are told. However, it is an important and valuable skill to be able to creatively draw on your existing knowledge to envision and construct a something new. Projects require a sound existing knowledge base, the ability to independently and collaboratively research new tools and unknown areas, and the ability to elegantly assemble knowledge components into a cohesive whole. You are encouraged to collaborate with your fellow students, but everything you hand in must be your work and your work only. For the first project, you were given step by step instructions detailing a sequence of modules to build in order to accomplish the ultimate goal of a single program. For this project you will be given a view of the overall end product. It will be up to you to plan out the steps necessary to implement this system. However, it is important to pay attention to good design and implementation style, as these will count for the grade.

Problem Domain : The National Pastime.


Poker is card game which is thought to have originated in North America and has achieved global popularity. The game has a fascinating history which demonstrates it's profound impact on modern American culture. Some professors of computer science agree that the popularity of this national pastime is due to the interesting computational aspects related to the game. In this project we will use computer programs to examine some of the more interesting computational aspects of the game. For this project, you will write a program that plays poker against

a human opponent. All that is required is a text based game. You can get up to 10% extra credit for adding graphics. Your program should run from the command line if the string -o or -open is found among the command line arguments then your program should play an open game (where the human can see the cards that your program has) we need this for grading purposes.

Problem 1 : A deck of cards (15%)


Generate an array or arraylist that represents a standard deck of 52 playing cards. You should be able to generate a deck print out the deck in order, and shuffle the deck using a randomization technique. If the string -t1 or -test1 is found among the command line arguments then your program should generate a deck, print out the deck (showing it in order), shuffle the deck, and print it out again demonstrating that it has been randomly shuffled.

Problem 2 : Deal some hands (15%)


Using a shuffled deck. You should be able to generated two (5 card) hands for the two players by drawing from a deck. If the string -t2 or -test2 is found among the command line arguments then your program should simply generate a deck, print out the deck (in order), shuffle the deck, and print it out again demonstrating that it has been shuffled. It should then generate two 5 card hands by dealing (alternately sampling from the start of the deck). It should print out the two hands and the remaining 42 cards in the deck.

Problem 3 : Classify some hands (25%)


In the game of poker 5 card hands are ranked in order to determine who wins. Your program must be able to identify the quality or category of the hand. Traditionally, there are thought to be 10 categories, but there are really 9 (a royal flush is merely a special case of a straight flush).

For this project, you should do some research into the game of poker to learn the rules and the hand rankings (you might even want to try playing a few games with your classmates). You need to identify the category of a hand - if a hand contains a only a high card, a pair, two pairs, three of a kind, a straight, a flush, a full house, four of a kind, or a straight flush. If the string -t3 or -test3 is found among the command line arguments then your program should start reading from strings from the console until end of input. The user will supply 10 character long strings. Each string will be of the form RSRSRSRSRS where R can be any one of the set (2,3,4,5,6,7,8,9,T,t,J,j,Q,q,K,k,A,a) and S can be any one of the set (C,c,H,h,S,s,D,d). For each string your program must classify the category of the hand (HighCard, Pair, TwoPair, Trip, Straight, Flush, FullHouse, Quads, StraightFlush).

Problem 4 : Compare some hands (25%)


Your program also must be able to identify which hand wins given two hands. If the string -t4 or -test4 is found among the command line arguments then your program should start reading from strings from the console until end of input. The user will supply two 10 character long strings. Each string will be of the form RSRSRSRSRS where R can be any one of the set (2,3,4,5,6,7,8,9,T,t,J,j,Q,q,K,k,A,a) and S can be any one of the set (C,c,H,h,S,s,D,d). Your program must identify which hand wins.

Code Style (10%) -modularity of design -comments -variable names -indentation and white space Documentation (10%)
In addition to submitting Java programs, you are required to submit one text document (possibly named README) which specifies for each problem:

1. A one paragraph description of how you solved the problem 2. Detailed instructions on how to run the problem (What command arguments/input you give to it, what output the program prints out, what the outputs mean, etc.) 3. User created test cases, if any

Project Submission
The project is due November 8th. Submissions will be received via blackboard. You are expected to submit: Java source files and compiled Java class files. You may also submit any additional files needed for running the programs. Documentation, described in the section above. If you submitted any additional files, explain what they are and where they are used.

Grading
Evaluation for each problem will be divided into test cases, code review and documentation. The TA will compile and test your program with a few test cases, and also with any test cases you provide. If your program only produces partial results, providing your own test cases will give you partial credit for the parts that operate correctly. The code review will be based on evaluating the correctness of your code.

Potrebbero piacerti anche