CMP 464: iOS Programming
Lehman College, City University of New York
Fall 2017
This Final Is Due By 11:59 PM on Tuesday December 19, 2015
Objective
In this exam, you will create a card game where a user plays against the computer.
Required Tasks (100 points)
You will have a Card class that represents a playing card. Cards have three attributes:
Value: 2-10, J, Q, K and A
Suit: ♠, ♥, ♦, and ♣
Score: This is a computed attribute. A card has a score which is a combination of it's value and
suit. For this J, Q, K and A
can be considered 11, 12, 13 and 14 respectively. and ♠, ♥,
♦, and ♣ can be 4, 3, 2 and 1 respectively. You need to combine
the two to obtain a score. As an example, please note that 10 ♦ should
have a higher score than 10 ♣.
Cards will be displayed with their value and suit. Ex. 10 ♠, 5 ♥,
A ♦, K ♣. The colors are important.
You will have a Deck class that represents a full deck of playing cards, 52 cards.
Your Deck class will allow you to draw a card at random from the deck. Once a card has been drawn,
it will no longer be part of the deck.
You will have a CardGame class that contains the logic of your game (See below). The combination of
your Card, Deck and CardGame classes will be your model.
The game will work as follows:
The user will start with $100 dollars available for betting.
When the user presses the 'Deal' button, 5 cards are presented
to the user.
The user must place a minimum bet of $1. The user should be able
to place a higher bet if they wish.
After placing the bet, the user has the option of trading up to
three cards in order to improve their hand. The user does not have
to trade in any cards if they do not wish. The user should only
be allowed to trade in their original cards, but no more that 3 can
be traded in.
After trading (or not), the user has the option of increasing their
bet, up to their current available money.
When the user places their final bet, the computer deals out 5 cards
for itself.
The total score for the user is compared to that of the computer, if
the user's score is higher, they win an amount equal to their bet.
If the user's score is more than twice that of the computer, the user
wins double their bet. If the user's score is lower than the computer's
they lose the money that they bet.
The game ends when the user runs out of money. When the game ends, the
'Deal' button must be disabled.
Whenever the deck runs out of cards, it should get refilled with 52 new
cards.
The game can be reset if the user presses the 'Reset' button.
The amount of money that the user has should be always displayed on the
screen.
The amount of money the user is currently betting should also be displayed
on the screen.
The total score for the user's cards and the computer's cards should be
displayed on the screen.
The game must work properly in both landscape and portrait mode.
Extra Credit
(5 Points)
After the computer deals out it's own cards, after a short delay, allow to computer
to trade in, up to 3 cards in order to better their score.
(5 Points)
Animate the dealing out for the cards.
(15 Points)
Add a TabViewController to create another card game. The new game should be a poker
game with all the rules of poker. The only difference is that the computer does not
bet.
Please submit the completed final exam on Blackboard as a zip file of your entire
project. No other forms of submission will be accepted.