程序代写代做 game go html Java android javascript IOS Assignment 1 – Memory Training Game MCD4290, Trimester 1, 2020

Assignment 1 – Memory Training Game MCD4290, Trimester 1, 2020
Due: Week 5, 23:55 Worth: 12% of final mark
Aim
For this assignment your team will develop a memory skill game based on the electronic game Simon, produced by Hasbro. You will create a web app that displays random sequences of colours which the user must repeat from memory. As the user continually enters correct sequences the game progressively selects longer sequences.
Background
Simon is a 40-year-old electronic game, currently produced by Hasbro (https://en.wikipedia.org/wiki/Simon_(game)). The game has four coloured buttons that light up and play a sound in sequence. The user then has to replicate the sequence by pressing those buttons in the same order. The sequences become progressively longer and more difficult until the user is unable to repeat the sequence and the game ends.
While such games are entertaining, the complexity and randomness of the sequences also allows the game to be used as a means of practicing memory storage techniques. There is some evidence that individuals with mild cognitive impairment can benefit from memory enhancement training1 from games such as Simon.
Your team has been hired by Thoughtress, a small firm that develops memory skill games for researchers and individuals to evaluate improvement in memory ability. Normally they develop these games as physical electronic devices, however they wish to make their services more accessible to those in rural areas. To this end your team has decided to develop the game as a mobile web app.
1 http://dx.doi.org/10.1080/13607860120101077
1

Background: Example sequences
Below are some example sequences that might be shown when playing the game:
Background: Game progression
The difficulty level (sequence length) increases after the user gets a certain number of sequences of that length correct. The number of correct sequences needed to advance is shown in the table below. (The number is always two less than the sequence length.)
For example, at the start of the game, the player is given sequences of length 4. The player receives RRGB followed by GGBY and they get both correct. Since they have entered two sequences correctly, the game now increases to sequences of length 5. The player then receives YYGBR (a sequence of length 5) and needs to enter 3 of further correct sequences to advance to sequences of length 6.
Any time the player makes a mistake, they start again at the previous level (or reset to level 4 if they make two consecutive errors). The player cannot be given sequences shorter than 4 (as this is the starting level).
2

Angles obtained from the phone using device orientation
There are some situations where it may be too difficult for the user to interact with the app using the buttons on the screen (for example while wearing gloves). As such, we want to allow users to control the app using the phone’s orientation.
When using device orientation there are three angles that you have access to: alpha, beta and gamma; where beta represents the forwards-backwards tilt of the phone. It can visualised as below:
Figure 1 side view of phone at different beta angles
As in the figure above, where we are looking at the phone from the side, this means that when the device is flat on a surface, screen facing up it will have a beta of 0 degrees, tilting the top of the phone down gives a beta of -45 and tilting the top of the phone up gives a beta of +45
3

As in the figure above, where we are looking at the bottom of the phone, being flat on a surface gives a gamma of 0 degrees, tilting the phone to the left gives it a gamma of -45 whereas tilting to the right gives it +45 degrees
You can observe these Beta and Gamma values on the team phone using the Sensor Test app available on Moodle under “Assignment 1 Resources”.
4

What you are provided with
We have provided a skeleton version of the app, which displays the basic interface of the app and includes:
● Code that triggers the userChoiceTimeout function in gameLogic.js
⎯ This function is called when the user fails to make a decision after 2
seconds.
● Code to trigger the giveNextSequence function in gameLogic.js
⎯ The giveNextSequence function will be called automatically every time the user clicks on the play button.
⎯ This function should return a list of strings which can include the following:
▪ “blue”
▪ “green”
▪ “yellow”
▪ “red”
⎯ For example [“blue”,”blue”,”green”] which would correspond to a sequence of
● Code to trigger the sequenceHasDisplayed function in gameLogic.js
⎯ This function is called when the sequence that has been returned by
the giveNextSequence function has finished being shown to the user.
⎯ This is an opportunity to display information to the user prior to them
entering a sequence.
● Code to trigger the changeMode function in gameLogic.js
⎯ This function will be called when the user switches input modes between touch input and tilt input. The initial input method is touch.
⎯ This function has a parameter mode which will contain TOUCH_MODE or TILT_MODE depending on the mode the user has just switched to.
● The showSuccess and showFailure functions
⎯ These functions can be called by your code to display an image of a
tick or cross based on whether the user has entered a correct or
incorrect sequence.
⎯ The tick or cross will automatically disappear after one second.
● Four coloured buttons arranged in a circle on the screen 5
BlueBlue
Green

⎯ These buttons are designed to be clicked (or tapped on) by the user.
⎯ When clicked, each of these buttons will result in a call to the
buttonSelected function in gameLogic.js
⎯ When the buttonSelected function is called, it will be passed one of the
following strings as an argument representing which of the four buttons was clicked on:
▪ “blue”
▪ “green”
▪ “yellow”
▪ “red”
● A Play button on the app’s title bar which displays the next sequence for the user to enter and results in each request to your giveNextSequence function.
● A displayToastMessage function which you can call to have a “toast” message pop up at the bottom of the screen to notify the user of some information.
Other than this, you don’t need to know anything else about the skeleton to use it. You need to implement the functionality described below.
The app skeleton can be found in the MCD4290 “Assignment 1” section on Moodle.
The app skeleton is titled Skeleton.zip and contains a file ‘gameLogic.js’ where you should write your submission.
You don’t need to understand the other files we provide you with as part of the project skeleton — they include some concepts we haven’t yet covered.
6

What you need to do
Getting started
1. As a team you should download a copy of the project skeleton and unzip this.
2. The ‘skeleton’ folder contains the code of the web app.
3. You should open the entire skeleton folder in brackets to understand the
workings of the files for the assignment.
4. You will implement your solution in the ‘gameLogic.js’ file.
5. You should discuss within your team on the breakdown of coding features and
responsibilities. It is recommended that you practice pair programming.
6. Plan to have steady progress rather than complete the assignment at one go,
or to do it at the last minute.
7

Programming tasks
The Programming component of this assignment is worth 9% of your unit mark. For the programming tasks, we suggest you complete each part together before moving onto the next one.
Feature 1: Generating random sequences
The first step to displaying sequences on the screen is to generate those sequences. This should be done in the giveNextSequence function and returned as an array of strings. You should use the random method of the Math package to produce random numbers to represent any given option. Note: Your code will need to save the generated sequence for checking against the sequence entered by the user.
Feature 2: Sequence input
The buttonSelected function will be called every time the user clicks on one of the coloured buttons. You should keep track of which buttons the user presses and the order they were pressed in.
Once the full sequence has been entered, you should compare what the user has entered against the original sequence. If the sequences match then you should call the showSuccess function, otherwise you should call the showFailure function. (Both functions are part of the app skeleton.)
Feature 3: Increasing difficulty level
You should keep track of how many consecutive sequences the user has entered correctly at the current level. When the user gets enough correct in a row (see background, game progression), the game should advance to the next level.
Feature 4: Resetting difficulty level
If the user enters an incorrect sequence, they should be taken back to the previous level. For example, if they provide an incorrect sequence for a sequence of length 6, they need to do sequences of length 5 again (3 of them) before they get a sequence of length 6 again.
If the user makes two mistakes in a row, they are reset to the starting sequence length of 4.
This means that you will need to track the level the player is on and the number of successful/unsuccessful sequences entered.
8

Feature 5: Displaying status and progress
You should show on the screen (via the label with the id ‘output’) the current progress of the user, including:
● Number of items remaining to be entered for the current sequence.
● Length of the current sequence
● Number of correct sequences entered at the current level
● Remaining additional correct sequences until they advance to the next level
You should also display general status such as whether the user is currently expected to enter a sequence or watch a sequence.
This progress information should be updated anytime any of this information changes.
Feature 6: Tilt-based input method
You should add an alternative control scheme where the user tilts the phone towards the button they wish to light up. In order to do this, the app must be able to respond to changes in the orientation of the device using the DeviceOrientation event. See the Background “Angles obtained from the phone using device orientation” section.
The app has a button to switch between input modes which results in a call to your changeMode function which has a parameter mode which will either be TOUCH_MODE or TILT_MODE depending on the mode. You may need to remember this value in your code.
You should modify your app so that it can track the orientation of the phone. When the phone is tilted toward the bottom-left of the phone this should be treated as the user attempting to select the bottom-left button (i.e., the yellow button). Likewise, for the other three buttons.
There is already code in the main.js file (supplied with the skeleton) which triggers the buttons to light up and runs the buttonSelected function (that you’ve already implemented). Each of these functions are named for the corresponding buttons they light up: selectYellowButton, selectRedButton, selectBlueButton or selectGreenButton (also aliased as selectBottomLeftButton, selectBottomRightButton, selectTopLeftButton and selectTopRightButton).
The DeviceOrientation JavaScript event will notify you (via a callback function) whenever the device orientation changes, but this might be many times a second. For this reason, we don’t want to select a button as a result of every
9

orientation change, but rather just store the button that would be selected, and then we can actually register this selection after the standard button press timeout occurs (i.e., a call to your userChoiceTimeout function). Hence, if the app is in tilt control mode when your userChoiceTimeout function is called you should see if the phone is tilted and if so then select the appropriate button.
Feature 7: show tilt while in tilt mode
While the app is in tilt mode, you should ensure that you display the current tilt of the phone visually. This should be done in such a way that it’s clear to the user which button will end up being selected on userChoiceTimeout.
Hint: You can either display the current button selected by tilt in ’tilt mode’ on the output area or use CSS styling to display a selected border around the item. For example, if your reference to the button is BLRef then you can do BLRef.style.borderStyle=”solid”. Don’t forget to reset it to “none” when you dont need it selected!
10

Presentation
This assignment includes a presentation component worth 3% of your unit mark. Thoughtress have had their representatives look over the app your team has produced and are pleased with the results however despite initially agreeing with your team’s suggestion of a mobile web, they now ask your team to get the app in the Google PlayTM store and Apple AppStoreTM. In other words, they are asking your team to completely redesign the app as a native app for Android and iOS devices. Your team has little experience with iOS apps however you have worked closely with another organisation (IntellAppt) in the past
with extensive experience with both Android and iOS development environments. After some negotiation, it is agreed that IntellAppt will handle this redevelopment while your team takes more of a support role and a handover presentation is organised for three weeks’ time.
In your Week 6 prac class your team will deliver a handover presentation. Your team should present an overview of the functionality, design of the app and any specific hardware requirements. You should warn the new team about any current issues in your app as well as provide any suggestions for improvements. You should not present about the code of the app, as IntellAppt is not using Javascript in their redevelopment. As with any good presentation, it should be prepared well in advance of the due date (including any visual aids) and it should be well rehearsed as a group and individually.
Format
Each student team will deliver a 10-minute oral presentation (in prac class) describing and demonstrating the functionality of their app and detailing any limitations of the application. Every member of the team should present for 2-3 minutes.
● The target audience for this presentation is another team who will be extending the project further.
● This presentation would be delivered in a formal business setting and so all team members should be dressed appropriately.
● This presentation must discuss the structure and functionality of the application as well as any design decisions made.
11

Testing the app
1. ConnectyourAndroidphonewithyourlaptop,usingUSBcable.
2. To save your assignment folder on your mobile device select “Transfer files
(MTP) option” under “Use USB for”.
3. A folder will open in your laptop displaying all the storage folders in the phone.
4. Onyourphones,OpenGoogleChrome,andtypefile:///sdcard/intheaddress
bar.
5. Then select your folder and click on the index.html file.
6. Note that if are using MacBook, you have to download and install the Android
File Transfer to enable file transfer from laptop to the phone.
Programming resources
● Mozilla Developer Network – Math.random documentation
● Mozilla Developer Network – Detecting Device Orientation
12

Submission
Your team should submit their final version of the application online via Moodle. You must submit the following:
● A zip file named based on your team (e.g., \Team014.zip”).
This should contain ONLY one file named gameLogic.js
This should be a ZIP file and not any other kind of compressed folder
(e.g. .rar, .7zip, .tar).
The submission should be uploaded by the team leader and must be finalised by Week 5, 23:55. Please note: Your entire team needs to accept the assignment submission statement individually on Moodle.
You also need to individually complete the CATME peer assessment survey as described below. You also need to individually complete the following tasks:
● CATME peer assessment survey
● Assignment code interview
Your presentation will be given during your practical classes in Week 6.
13

Marking criteria
Programming tasks
Your assignment will be assessed based on the version of “gameLogic.js” file you submit via Moodle. Before submission check your code still works with the original app skeleton, in case you have modified your copy of any of the other files. We will run it with the original app skeleton and test it on your team smartphone. We will use the same phones when marking your assignments.
Assessment criteria:
● Whether the app functionality satisfies the assignment specification
● Quality of app source code, including structure and documentation
You will be marked as a group; however, your individual marks will be subject to peer review moderation based on CATME feedback and your assignment interview.
A detailed marking rubric is available on the unit Moodle page in the “Assignment 1” section.
14

CATME Peer Assessment
You are expected to work together as a team on this assignment and contribute roughly equal amounts of work. Peer assessment will be conducted via the CATME online system. You will receive email reminders at the appropriate time.
Not completing the CATME peer assessment component may result in a score of zero for the assignment.
Do:
● Give your teammates accurate and honest feedback for improvement
● Leave a short comment at the end of the survey to justify your rating
● If there are issues/problems, raise them with your team early
● Contact your demonstrators if the problems cannot be solved amongst
yourselves Do NOT:
● Opt out of this process or give each person the same rating
● Make an agreement amongst your team to give the same range of mark
15

Assignment code interview
During your week 6 prac class your demonstrator will spend a few minutes interviewing each team member to individually gauge the student’s personal understanding of your Assignment 1 code. The purpose of this is to ensure that each member of a team has contributed to the assignment and understands the code submitted by the team in their name.
You will be assigned a score based on your interview, and your code mark will be penalised if you are unable to explain your team’s submission:
Score
Description
Penalty
No understanding
The student has not prepared, cannot answer even the most basic questions and likely has not even seen the code before.
100%
Trivial understanding
The student may have seen the code before and can answer something partially relevant or correct to a question but they clearly can’t engage in a serious discussion of the code.
30%
Selective understanding
The student gives answers that are partially correct or can answer questions about one area correctly but another not at all. The student has not prepared sufficiently.
20%
Good understanding
The student is reasonably well prepared and can consistently provide answers that are mostly correct, possibly with some prompting. The student may lack confidence or speed in answering.
10%
Complete understanding
The student has clearly prepared and understands the code. They can answer questions correctly and concisely with little to no prompting.
0%
16

Presentation
Students are marked individually for this assignment on their presentation skills Assessment criteria:
● Voice is of appropriate volume, speed and enthusiasm
● Language is appropriate for a formal context and jargon is only used where
necessary (and explained if used)
● Eye contact is consistent and covers most of the audience
● Body language complements the presentation
● Explanations are clear and visual aids used appropriately
A detailed marking rubric is available on the unit Moodle page.
17

Other information
Where to get help
There will be a FAQ are added at the bottom of this document. You can also ask questions about the assignment on the General Discussion Forum on the unit’s Moodle page. This is the preferred venue for assignment clarification-type questions. You should check this forum (and the News forum) regularly, as the responses of the teaching staff are “official” and can constitute amendments or additions to the assignment specification. Before asking for a clarification, please look at the FAQ and forum.
Plagiarism and collusion
Cheating, Plagiarism and collusion are serious academic offenses at Monash University. Students must not share their team’s work with any student outside of their team. Students should consult the policies linked below for more information.
https://www.monash.edu/students/academic/policies/academic-integrity https://eng.monash.edu.au/current-students/cheating-and-plagiarism.html
See also the video linked on the Moodle page under the Assignment block.
Students involved in collusion or plagiarism will be subject to disciplinary penalties, which can include:
● The work not being assessed
● A zero grade for the unit
● Suspension from the University
● Exclusion from the University
You are required to reference code that has been obtained or provided by other sources (i.e. online), including formulas for calculating. This should be done within a comment above the code.
Late submissions
We do not grant extensions on the assignment unless the majority of a team has been affected substantially over the period of the assignment by factors out of your control, as outlined in the special consideration form.
Such special consideration applications should be made to the unit email address with a completed form and supporting documentation within two business days of the assignment deadline for each affected member.
http://www.monash.edu/exams/changes/special-consideration
18

Without an approved extension, late submissions are not accepted.
Unavailable team members
If team members are missing on the day of the presentation, the remaining members should proceed without them. Missing team members will receive a mark of zero unless they are granted special consideration. Such special consideration applications should be made to the unit email address with a completed form and supporting documentation within two business days of the presentation date.
http://www.monash.edu/exams/changes/special-consideration
You must also inform your team members if you will be absent on the day of the presentation.
19

Frequently asked questions
1. How do I start this assignment? I’m confused!
Begin by reading the ‘what you are provided with’ and ‘features’ in the instructions. The background reading provides some information on how to do the different steps themselves.
2. There is something in the instructions I don’t understand.
Read #1, then ask us on the forums or in-person what you don’t understand. We are happy to assist.
3. Will the assignment app work on an iPhone? Can I use my own Android phone?
No. You’re welcome to use your own Android device for testing but there are caveats – the device orientation sensor api has to be implemented differently depending on the device, platform and browser version you’re using.
4. Canweuseglobalvariables?
Yes you can. Remember to declare them using let instead of var. HOWEVER, your team should think about the minimum scope required, so don’t have everything global because you will lose marks. If your variable only needs to be accessed by one function, put it in that function instead.
5. How do I debug on the phone?
Plug in your phone via usb to the PC/Laptop with Google chrome browser installed.
You can go to developer options -> enable usb debugging.
Then in Chrome, go to F12 (developer tools) -> Sources -> ⋮ -> more
tools -> Remote devices -> (Accept the debugging notice on your phone) -> ‘inspect’ the correct tab open in chrome on the phone. The debugger here would basically be the same as the debugger on your regular browser tabs while the phone is connected.
6. I need help!
Come to the regular during-hours help desk sessions, post on the forums for help, or ask your friendly teacher in class.
20