cover picture cover picture


Final Exam

CMP 430: iOS Mobile Programming
Lehman College, City University of New York
Fall 2018


This Final Is Due By 11:59 PM on Thursday December 20, 2018

Objective

In this exam, you will create a card game where a user plays against the computer.

Required Tasks (100 points)

  1. You will use the following classes from the class demo PlayingCard:
    • PlayingCard.swift
    • PlayingCardDeck.swift
    • PlayingCardView.swift
    You can download the files for the final exam by selecting the link.

  2. Enhance the PlayingCard class to have a computed score attribute. A card's score is a combination of it's Suit and Rank. 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 ♣.

  3. Cards will be displayed using PlayingCardView and should display with images and pips, just like we did in class.

  4. You will have a CardGame class that contains the logic of your game (See below). The combination of PlayingCard, PlayingCardDeck, and CardGame classes will be your model. The game will work as follows:
    • The user will start a new game with $100 dollars available for betting.

    • When the user presses the Deal button, the correct number of cards are presented to the user. The cards should be dealt face down with animation and then flipped over with animation.

    • The user has the option of trading up to 1 card to improve their score. The user does not have to trade in any cards if they do not wish. The cards are traded using a Swipe Right gesture on the card to be traded in. The card being traded in, should be animated off the screen and the replacement card should be dealt out face down with animation and then flipped over with animation.

    • The user must place a minimum bet of $1. The user should be able to place a higher bet if they wish. This can be done by the user repeatedly pressing the Bet button.

    • When the user places their final bet, they will press the Deal button and now the computer will deal itself an equal number of cards with the same animations.

    • 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. An equal score will result in the user getting back their bet.

    • After each bet is won or lost, there should be a short delay for the user to see the results. After the delay all cards should be animated off the screen.

    • The game ends when the user runs out of money or when the deck is empty. When the game ends, the Deal button must be disabled.

    • The Bet button should be disabled when betting is not taking place. (i.e. User should not be able to increase their bet after seeing the computer's cards).

    • The game can be reset if the user presses the 'Reset' button.

  5. You will use a TabViewController to have 2 versions of the game:
    • In this tab, the game will use 3 cards.

    • In this tab, the game will use 5 cards.

  6. Your view will have the following:
    • Space for the appropriate number of cards (3 or 5) for both the user and the computer.

    • A label for displaying the amount of money the user has available.

    • A label for displaying the score of the user's cards.

    • A label for displaying the score of the computer's cards.

    • A label for displaying the current bet amount.

    • A Deal button for dealing a cards. Please note that this button is used for dealing out the user's cards and the computer's cards.

    • A Bet button that increases the bet by $1 every time it is pressed.

    • A Reset button to start a new game.

  7. The amount of money that the user has should be always displayed on the screen.

  8. The amount of money the user is currently betting should also be displayed on the screen.

  9. The total score for the user's cards and the computer's cards should be displayed on the screen.

  10. The game must work properly in both landscape and portrait mode.

Extra Credit

  1. (5 Points) After the computer deals out it's own cards, after a short delay, allow to computer to trade in, 1 card in order to better their score.

Please submit the completed final exam on Blackboard as a zip file of your entire project. No other forms of submission will be accepted.