CSC 581: Mobile App Development
Spring 2018

HW1: Flashlight & Slots

Part 1: Flashlight

Complete the guided project at the end of Unit 1, which develops a simple flashlight app. Your app should initally display a white screen (the flashlight turned on) and should toggle between white and black backgrounds at the touch of the screen.

Part 2: Slot Machine

Building upon what you learned in Unit 1, design and build an app that simulates a simple slot machine. The app should appear as in the screen shot below, with a title at the top, three colored buttons representing the slots in the middle, instructions and the number of credits (initially 20) at the bottom. When any one of the slot buttons is clicked, all three should each be assigned a random color, selected from four colors of your choice. If the slots are all assigned the same color, then the message "We have a winner!" should be displayed in place of the instructions and the number of credits should increase by 12. Otherwise, the message "Sorry, try again..." should be displayed and the number of credits decreased by 1. If the number of credits ever reaches 0, then spins should no longer take place and a warning message should be displayed if the user tries to play. There should be a button at the bottom right of the screen, however, that resets the game back to its original state (with the original instructions and 20 credits).

For full credit, your layout should look reasonable even if the phone model changes or the device rotates. That means you will need to use contraints to force the alignment of the UI elements. For extra credit, you can replace the colors with images (e.g., lemons, cherries, ...), upgrade the look of the app, and/or add extra features to the game.