Question: You are asked to write a program for a game using a Brain-Computer-Interface where the user gives left/right/up/down commands to move on a board and
You are asked to write a program for a game using a Brain-Computer-Interface where the user gives left/right/up/down commands to move on a board and collect points. Write a function bciboardgame(m,x,y,moves) that takes a matrix m representing the board and x,y coordinates representing the row and column indices of the user's current location. The moves represents the sequence of user commands, as a vector of integers between 1 and 4 (1: left, 2:right, 3:up, 4:down). Your program should start at x,y coordinates, and move around the board according to user's commands and return the total number of points the user collects, including the points on the starting position. Assume that the user will not try to move off the board. Matlab!!! I am confuse about if the moves is a vector which is not only one number, how can I do?
>> disp(bciboardgame ( [10 20 30; 40 50 60], 1, 3, [ 1)) >> disp (bciboardgame ([10 20 30; 40 50 60], 1, 3, [1 ])) >> disp (bciboardgame ([10 20 30; 40 50 60], 1, 3, [1 2])) 30 50 80
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
