Project: Random Simulation

17

This performance task requires you to develop a Random Simulation App similar to the Coin Flip A project, indeed, you should make a copy of that project as a starting off point. You may work individually or make a similar app as a partner (you must each do your own app). For this project you may seek guidance from TClark or other students.

Project Directions

  • You are to create a Random Simulation app more complex than Coin Flip

    • You may change it to a dice roll, magic 8-ball, Monty Hall problem, card draw, multiple coins at once, or other random type app

    • You might need to use the random fraction block

  • Action: When user presses, clicks, or shakes the phone it must roll, flip, etc.

  • Procedure: Instead of copying and pasting the coin-flip algorithm, you need to create a procedure that is called called whenever the flip is needed: i.e. called in the button click or phone shook event handlers

  • Sounds: App must also speak the result or make a unique noise for each result.

  • Record: App must tally or record the results in some way at the bottom.

  • 1 extra creative enhancement

    • hints: random locations, randomly pick from a list of pictures or results to display, have two or more "players"

    • You can create your own pictures in Google Drawing

App Requirements

  • Custom icon for app

  • App Title (screen1 title property)

  • All components & media named clearly

  • Code must be organized neatly

  • The app must not be larger than 5MB, so any media you get needs to be resized to be smaller images, etc.

Tally List

In order to tally and keep a count of the number of results it might be easiest to create a tallyList with the number of elements matching the number of options (i.e. 6 items in the list if you are modelling a die), and all the values starting at 0.

Then whenever you get a result you will need to replace the specific item at the resultant random number with what it was plus one.

In addition you will need to output the result and the following code is a nice way to do so. You may use and modify the updateTally procedure for your project.

WARNING! When using TClark's code, you must make sure the variables in this code match the variable you are using in your code, so BE CAREFUL!

Optional (Difficult) enhancement

Simulate a Dice Rolling or Coin Flipping

To simulate rolling a dice or flipping a coin, you will need to change the picture, then wait a bit, then change to the next picture, then wait, etc. App Inventor does not have a wait feature, but it does have a clock feature we can use.

First set up one list and an index that will hold all the file names of the pictures you want to have. In TClark's example, he is simulating two different situations, so he has a couple extra lists.

Next we must make sure the clock is not running/enabled when the app start, Screen1.initialize.

Then to set up the rolling, start the index at 0, set the countDown variable to how many times the picture should change before final result. And Enable/start the clock with a start speed: 200 ms interval.

To prevent users from pressing the button multiple times are once, disable the buttons.

Each time the clock ticks, the countDown should subtract one and see if it is done or not. If it is done, then final result is calculated and displayed.

If the animation is not over, increment the index by 1 and make sure to loop it back to the first index if it is greater than the length (out of bounds). Then set the image to that picture at that index.

Finally, add a number to the interval to slow down the animation to simulate dice actually slowing down.

Finally, when it is over, turn off/disable the clock. Select a random result, based on the number of items in the list, and set the picture and result label to that result.

Also, turn back on the button for users to roll again.

Note: you will have to store the result into the global randomNumber.

What is Due

  1. Video: One video that demonstrates the running of your app and highlights the features of your app. Your video must not exceed 1 minute in length and must not exceed 30 MB in size.

  2. Written Response: One PDF that responds to the prompts listed below. Template

  3. Program Code: One PDF that has screenshots of all your blocks. Template 3

  4. AIA File


Upload all files into a new Google Drive folder for this project, then select from My Drive in the Google Form.


Upload all files into a new Google Drive folder for this project, then select from My Drive in the Google Form.

Written Response Directions - Template

A - Provide a written response or audio narration in your video that:

    1. Identifies the programming language (MIT App Inventor)

    2. Identifies the purpose of your program and your enhancements

    3. Explains what the video illustrates

(Must not exceed 150 words)

Create Performance Task 2020

B1. Describe the incremental and iterative development process of your program code. What is the overall core functionality of your program? What features/enhancements did you add in what order. How did you go about troubleshooting problems that arose?

(Must not exceed 100 words)

B2 - Describe two distinct points in the development process: any combination of difficulties and/or opportunities you encountered and how you resolved them with code. In your description clearly indicate that your code development is for code you developed independently.

(Must not exceed 100 words)

Create Performance Task 2020

C - Select and write about an algorithm you developed individually that integrates (calls) at least two other supporting algorithms, and integrates mathematical (+, -, *, /) and logical (Boolean true/false) concepts. Describe how each of the supporting algorithms functions independently, as well as in how they function within the selected algorithm to achieve the intended purpose of the program.

Mark these algorithm blocks with ovals in Program Code pdf.

(Must not exceed 200 words)

Create Performance Task 2020

D - Select and write about an abstraction (procedure) you developed individually that helped manage the complexity of your program (simplified it). This abstraction must integrate mathematical (+, -, *, /) and logical (Boolean true/false) concepts. Explain how your abstraction helped manage the complexity of your program.

Mark the abstraction and calls with rectangles in Program Code pdf.

(Must not exceed 200 words)

Create Performance Task 2020

Grading Points

  1. Response A

    • Identifies the purpose of the program (i.e. what the program is attempting to do, and your enhancements).

  2. Response B

    • Describes or outlines steps used in the incremental and iterative development process to create the entire program.

  3. Response B

    • Specifically identifies at least two program development difficulties or opportunities.

          • AND

    • Describes how the two identified difficulties or opportunities are resolved or incorporated.

  4. Response C

    • Selected code segment implements an algorithm(using sequencing, selection or iteration).

  5. Response C

    • Selected code segment implements an algorithm that uses mathematical (+, -, *, /) and logical (Boolean true/false) concepts.

          • AND

    • Response explains explains how the selected algorithm functions.

          • AND

    • Describes what the selected algorithm does in relation to the overall purpose of the program.

  6. Response C

    • Selected algorithm includes at least two or more supporting algorithms (calls).

          • AND

    • At least one of the supporting algorithms also uses mathematical (+, -, *, /) and logical (Boolean true/false) concepts.

          • AND

    • Explains how the two supporting algorithms function independently.

  7. Response D

    • Selected code segment is a student-developed abstraction (procedure)

          • AND

    • The selected abstraction uses mathematical (+, -, *, /) and logical (Boolean true/false) concepts.

  8. Response D

    • Explains how the selected abstraction manages the complexity of the program.

  9. Video showing your app running.

  10. Program Code

    • The code blocks are nicely formatted and legible with the code blocks used for Response C marked with an oval, and blocks used for Response D marked with a rectangle.

  11. AIA and APK files submitted and working.