You may have noticed that there is a small handheld device attached to your computer. There may be a ball on the bottom or a red light. There is a cord that connects this device to the computer. This is called a MOUSE. Perhaps you are familiar with it?
Mice are input devices that have sensors inside then to note the relative position on the screen. They gather data about how far the user has moved and relay it to the computer. We are going to pretend that this data is stored in a file and we are going to manipulate it.
The file of mouse data can come in two formats (well, not really. But it's fun to pretend). The first line states the format. It is either: COMPACT or HUGE.
HUGE mouse files will be set up in the following way:
|
HUGE |
COMPACT mouse files will be set up in the following way:
|
COMPACT |
Both file types yield the same output (to another data file, let your user type in the file name).
Starting Postion: 100, 200 |
Note that if the mouse moves off the screen (as specified by the file) then the mouse should just move to the edge of the screen and stay there until it is moved back. It can still move in the other direction while it is on the edge of the screen.
Further note that negative values in the up/down direction mean move up. Negative numbers in the left/right direction mean move left.
Create your own text files to test this. Choose some boundary cases (go off the screen for starters).