Poker Simulator. In this assignment, you will implement a simulation of a popular casino game usually called video poker. The card deck contains 52 cards, 13 of each suit. At the beginning of the game, the deck is shuffled. You need to devise a fair method for shuffling. (It does not have to be efficient.) Then the top five cards of the deck are presented to the player. The player can reject none, some, or all of the cards. The rejected cards are replaced from the top of the deck. Now the hand is scored. Your program should pronounce it to be one of the following:
· No pair—The lowest hand, containing five separate cards that do not match up to create any of the hands below.
· One pair—Two cards of the same value, for example two queens.
· Two pairs—Two pairs, for example two queens and two 5’s.
· Three of a kind—Three cards of the same value, for example three queens.
· Straight—Five cards with consecutive values, not necessarily of the same suit, such as 4, 5, 6, 7, and 8. The ace can either precede a 2 or follow a king.
· Flush—Five cards, not necessarily in order, of the same suit.
· Full House—Three of a kind and a pair, for example three queens and two 5's
· Four of a Kind—Four cards of the same value, such as four queens.
· Straight Flush—A straight and a flush: Five cards with consecutive values of the same suit.
· Royal Flush—The best possible hand in poker. A 10, jack, queen, king, and ace, all of the same suit.
Implement a payout system! +10
Extra credit if it is a GUI +10.
Due December 5th, 2008.
December 3rd, 2008 is your fourth exam. I will post a review sheet tonight! (as promised :)
Project 7.1 in the book.
Wednesday, November 26, 2008
11/26/08 In class exercise review
Assignment 1:
Suppose you have a Town class that describes the demographics of small towns. The vital statistics described by this class are numberOfAdults and numberOfChildren. These vital statistics are encapsulated and not directly accessible from outside the class.
Write an initialize method that establishes initial values of instance variables. Write a simulateBirth method which simulates the birth of one child. Write a printStatistics method that prints out the current vital statistics.
Write a main method that creates a town called newHome. Then call initialize to establish initial values for newHome. Simulate the birth of a pair of twins and print out newHome's statistics.
---
Assignment 2:
Suppose you are asked to model plants using an OOP program. For each of the following plant-related entities, specifiy the most appropriate item to use for its implementation. For each entity, select one of the following: instance variable, object, method, or class.
Suppose you have a Town class that describes the demographics of small towns. The vital statistics described by this class are numberOfAdults and numberOfChildren. These vital statistics are encapsulated and not directly accessible from outside the class.
Write an initialize method that establishes initial values of instance variables. Write a simulateBirth method which simulates the birth of one child. Write a printStatistics method that prints out the current vital statistics.
Write a main method that creates a town called newHome. Then call initialize to establish initial values for newHome. Simulate the birth of a pair of twins and print out newHome's statistics.
---
Assignment 2:
Suppose you are asked to model plants using an OOP program. For each of the following plant-related entities, specifiy the most appropriate item to use for its implementation. For each entity, select one of the following: instance variable, object, method, or class.
- plant height
- sequence of activities that occur when a seed germinates
- an indication of whether a plant contains a vascular system
- an individual plant
Please list on your blog 1-4 and whether you believe each would be handled best as a(n) instance variable, object, method, or class.
----
Assignment 3:
Think of a possible "final project" that you could possibly accomplish. Please write an idea or two on your blog!
----
Assignment 4:
See how well you do on this:
Monday, November 24, 2008
In case you are interested...
Alan Kay thought of many ideas behind OO programming:
http://blog.ted.com/2008/03/alan_kay_on_ted.php
http://blog.ted.com/2008/03/alan_kay_on_ted.php
Read the article: "What is an algorithm"
Read the following post:
The Importance of Algorithms.
from the following great page:
http://www.topcoder.com/tc?module=Static&d1=tutorials&d2=alg_index
I would like for you to answer the following questions on your blog:
The Importance of Algorithms.
from the following great page:
http://www.topcoder.com/tc?module=Static&d1=tutorials&d2=alg_index
I would like for you to answer the following questions on your blog:
- What are algorithms used for?
- What is a random algorithm?
- What is compression?
- What two 'real world' examples does the author give as useful algorithms? Describe them on your blog.
- Do you agree that studying algorithms is a useful tool for programmers and computer scientists?
Saturday, November 22, 2008
Monday, November 17, 2008
Wednesday, November 12, 2008
Great article about recursion
Here's a great post that references one of the most important programming books, "Godel, Escher, Bach".
Everyone should read it.
Everyone should read it.
Tower of Hanoi
Code from: http://weblogs.java.net/blog/mortazavi/archive/2005/08/recursive_progr.html
private void moveTower (int numDisks, int start, int end, int temp)
{
if (numDisks == 1)
moveOneDisk (start, end);
else
{
moveTower (numDisks-1, start, temp, end);
moveOneDisk (start, end);
moveTower (numDisks-1, temp, end, start);
}
}
Use Paint to explain the Tower of Hanoi
Pretend you have four disks. Show the steps to finish!
Also paste this code under the picture:
http://weblogs.java.net/blog/mortazavi/archive/2005/08/recursive_progr.html
Also paste this code under the picture:
http://weblogs.java.net/blog/mortazavi/archive/2005/08/recursive_progr.html
Monday, November 10, 2008
Math fun minor project!
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
Taken from this website:
http://projecteuler.net/index.php?section=problems&page=1
Find the sum of all the multiples of 3 or 5 below 1000.
Taken from this website:
http://projecteuler.net/index.php?section=problems&page=1
Coding horror
Write a response to the following blog post:
http://www.codinghorror.com/blog/archives/001184.html
Do you agree with his point? Please reply on your blog.
Make sure to have read through Chapter 12 in the book.
http://www.codinghorror.com/blog/archives/001184.html
Do you agree with his point? Please reply on your blog.
Make sure to have read through Chapter 12 in the book.
Wednesday, November 5, 2008
How is Blackjack going?
Write one sentence on your blog with something that is going well with your Java Blackjack program.
Write one sentence on your blog with something that is not working with your Java Blackjack program.
Don't forget about your major assignments:
http://mdcjava.blogspot.com/2008/10/major-assignments-fall-2008.html
Write one sentence on your blog with something that is not working with your Java Blackjack program.
Don't forget about your major assignments:
http://mdcjava.blogspot.com/2008/10/major-assignments-fall-2008.html
Subscribe to:
Posts (Atom)