V22.0002 - ASSIGNMENT 5


You are part of a team that is developing a new video game and you have been assigned the task to write the part that computes the new cursor position on the screen and prints a specific symbol. Your procedure will also detect errors (illegal moves and illegal input) and report the number of errors.

Specs : (i.e., what procedures you should write and what they should and should not do)


Example run:

   Test-run of CursorMovement. Enter series of commands ending in $

   ddrrld+ddl>rrr#+l<$
   
                                                                                   
                                                                                   
    +                                                                              
     
    >   +<                     
    
   There where 2 errors
The errors above are
  1. Using the illegal symbol #
  2. Trying to move left on the same line (after the symbol +)


Notes :

CursorMovement will keep on fetching characters until it reaches the end command ($). You will need to keep three counters, the horizontal offset and the vertical offset and the previous horizontal position, which you will update depending on the command you just received. If the command is a printable symbol, verify that the counters have a legal value: i.e.,

If the counters have legal values, print the symbol (remembering to update the previous position counter), otherwise update the error count.