CS2030DE Lab 7 Final v2
CS2030DE Lab 7 Final v2
Instructions:
(1) You must test all possible input cases/different parameter values, etc., to make
sure your code runs successfully. There may be other cases of inputs and/or input
parameters that may not show a “green” signal!
(2) Do make sure to submit your work at least 30 minutes before the deadline to
avoid any last-minute technical issues or delays. Submissions made too close to the
deadline will not be excused for reasons such as folder closures or system timeouts.
Plan accordingly to ensure a smooth and timely submission.
Grading:
Lab work - 100 marks for each lab (20 marks in class and 80 marks post lab);
Final marks for each lab will have a weightage of four (4) marks. Total of all the 8
labs account for 32 marks.
Your attendance to every lab carries: 1 Mark
Lab component overall: 8 + 32 = 40 Marks.
class MoveFunctor:
Method Description
__init__(positio Initializes the functor class with the given position and
n, reward) reward.
map(moveMethod) Returns a new Functor after applying the movement.
class Navigator:
Method Description
__init__(grid) Initializes with an NxN grid
move(path, Apply the movements as specified in path (e.g., ['R',
p=(0,0), r=0) 'D', 'D'], where 'R' represents a right movement and
'D' represents a down movement), starting from the
initial position p and initial reward r. Chain the
movement functors to execute the movements. This
method should be implemented using lazy execution,
yielding the resulting functor after each step as
needed.
navigate() Returns the maximum accumulated reward and the
optimal path to achieve it using recursion. This
function must be pure, and movements should be
simulated using the map() method of the
MoveFunctor class.
-END-