cover picture cover picture


Midterm Exam

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


Start of Midterm Exam
End of Midterm Exam
3:30 PM on Monday November 1, 2021
11:59 PM on Sunday November 7, 2021
There will be no extensions
and
No late submissions will be accepted

Objective

In this exam, you will create a slot machine game. Your slot machine will have three views each representing an emoji. Each emoji has three attributes: shape, color and shading.

Required Tasks (100 points)

  1. Emojis

    Your emojis will have the following 3 attributes:

    • Shapes:

      • ▲ and △
      • ▶ and ▷
      • ▼ and ▽
      • ◀ and ◁
      • ◼ and ◻
      • ● and ○
      • ◆ and ◇
    • Colors:

      • Red
      • Blue
      • Green
      • Purple
    • Shading:

      • Filled: ▲, ▶, ▼, ◀
      • Outlined: △, ▷, ▽, ◁
      • Shaded: ▲, ▶, ▼, ◀
  2. Model

    • A new game begins with the palyer having a balance of $100.

    • A "Spin" will cost the player $5 and will change the 3 emojis to random shapes, colors and shades.

    • After a spin, a player's balance is increased as follows after the emojis are randomly chosen:

      • Add $1,000 if all three attributes are the same or all different. (i.e. All the colors are the same or all are different and all the shapes are all the same or all are different and all the shades are the same or all are different). This is similar to a set in the Set game you did for Homework 3.

      • Add $500 if only two attributes of the emojis are all the same or all different. (i.e. All are the same color or all are different colors and all are the same shape or all are different shapes).

      • Please note that if a player is awarded the $500 for two attributes being all the same or all different, you will need to check the other attribute for a possible $10 reward. See Below for the $10 reward. Example: The user had all three shapes identical and all three shades are different. This qualifies the user for the $500 reward. In addition, you must check the colors for a possible $10 reward.

      • Add $100 if only one attribute of the emojis are all the same or all different. (i.e. All are the same color or all are different colors, or all are the same shape or all are different shapes, or all the same shade or all are different shades).

      • Please note that if a player is awarded the $100 for one attribute being all the same or all different, you will need to check the other two attribute for possible $10 rewards. See Below for the $10 reward. Example: The user had all three shapes all different. This qualifies the user for the $100 reward. In addition, you must check the shades and colors for possible $10 rewards.

      • Add $10 for each two cards that have one attribute in common. (i.e. both are the same shape, or same color or same shade). Please note that there can be multiple of these credits at the same time. (i.e. one pair of cards have the same shape, another pair have the same color and another pair have the same shading).

      • Important note: For the purpose if matching shapes, please note that ▲ and △ are considered the same shape. The same applies for the other shapes.

    • The current state of the three emojis and the player's balance must be maintained in your model.

    • Your Model must have, at least, one computed var with both a get and a set.

    • Your Model must have, at least, one closure.

    • Your Model must have, at least, one extension.

    • Your Model must have, at least, one Optional var. Please note that this var can either be Computed or Stored.
  3. View

    Your view will have the following components:

    • Three Views to show the chosen emojis with their coloring and shading. The emojis should be properly sized to fit into their respective Views. These Views should be arranged horizontally together at the top of the safe area.

    • A "$" field to indicate the amount of money the player currently has.

    • A "Spin" button to change the emojis. Please note that this button must be disabled if the player's balance goes below $5.

    • A "New Game" button to restart the game.

    • Your View must have, at least, one @ViewModifier.

    • Your View must have, at least, one @ViewBuilder.

    • Your View should work well in both portrait and landscape mode.
  4. ViewModel

    Your ViewModel will have the following components:

    • The View must access the Model's vars through the ViewModel.

    • The View must use Intent functions in the ViewModel to access functions in the Model.
  5. Xcode

    You must use Xcode 12.4 and your project must build without errors or warnings.

Extra Credit (10 points)

Animation

Animate the spinning and changing of the emojis when the user presses the "Spin" button.

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