Question: For this problem, I am looking for you to write the code necessary to check each value in three vectors to evaluate if a simulated

For this problem, I am looking for you to write the code necessary to check each value in three vectors to evaluate if a simulated sequence of colors generated (color_picks) match a simulated series of clicks that would be generated by using the ginputfunction (x_valsand y_vals). If the click location matches the section of the play area corresponding to a color generated from color_picks, you need to increment (add one to) the correctvariable. Do not use ginputin this problem, I am giving you the result of a simulated series of clicks. The order of each vector needs to match for this problem, like it would in your team code submission. You need to use a for loop to go through the first to the last element in each vector. The length of each vector is indicated by the testvariable I provide. I am providing you with extra code and comments that explains what I am providing you to use for this problem. Please note that most of this is simulated data and other code for testing to ensure your code works in any situation. You would not include a lot of this in your team code submission. However, you would want to use (or could use) the code you are expected to type for this problem in your team code submission, adjusting any variable names, as needed.
x_vals are pseudorandomly selected values between 1 and 3. y_vals are pseudorandomly selected values between 1 and 3. These represent the x and y coordinates of a click on the play area.
Selections with x_valsgreater than or equal to 2 and less than 3 AND y_valsgreaters than or equal to 2 and less than 3 represent simulated clicks in the GREENsection of the play area.
Selections with x_valsgreater than or equal to 1 and less than 2 AND y_valsgreaters than or equal to 2 and less than 3 represent simulated clicks in the REDsection of the play area.
Selections with x_valsgreater than or equal to 1 and less than 2 AND y_valsgreaters than or equal to 1 and less than 2 represent simulated clicks in the BLUEsection of the play area.
Selections with x_valsgreater than or equal to 2 and less than 3 AND y_valsgreaters than or equal to 1 and less than 2 represent simulated clicks in the YELLOWsection of the play area.
color_picksvalues of 1represent GREEN, values of 2represent RED, values of 3represent BLUE, and values of 4represent YELLOW.
Use the above information to help you determine if the color selected for an element in the color_picksvector matches the corresponding location represented by a simulated click in the same location in the x_valsand y_valsvectors. If it does match, increment (add one to) the correctvariable. Keep doing this for each value, from the first to the last, in the vectors. This represents checking each color generated by the game in sequence against the color selected by the player in the Matlab Memory Matching game.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!