![]() |
|
|
POTM: Programmer of the Month: Nuts: Input and Output SpecificationsIn addition to the long rules (the details), it is necessary to be very explicit about the input to your program and the output it produces. That is the purpose of the following. If you have questions - please post them to the forum.When your entry runs, it will be asked to read a file that will contain definitions of the following problem elements: 1) The size of the grid (containing N by N squares) 2) The location of all nuts in the grid 3) The number of squirrels on each square in the grid 4) YOUR current position ... It will then be asked to output a move.
The input file will be presented as a full path argument to your executable, and your executable will write output to stdout.
A. The GRID will contain SQUARES which are identified with a standard X,Y coordinate system ... with the lower left square identifed as 0,0.
B. The OUTPUT of your program will be the X and Y coordinates of the square to which you wish to move, separated by a comma and containing no red space and followed by a CR/LF as in printf("\n"). For example: 3,3 is a legitimate move if you are curently at 2,2. No equal signs, no parentheses, no red space, only a single comma separating two numbers. Sep 26: There will be NO output to stderr and NO additional output to stdout other than the two comma-separated numbers. C. The INPUT of your program will be a series of Name=Value pairs with one Name=Value pair per line. The "Name" will be one of the following; the Value will always be a X,Y pair with no red space on the line. (Examples shown below for Values):
A sample grid (mid-game) and its description to help clarify any issues:
NOTE: there are five squirrels including yourself NOTE: you share a square with another squirrel NOTE: NUT and SQUIRREL lines are not ordered in any particular way NOTE: All NUT lines will appear before any SQUIRREL lines |
| The POTM is unsponsored and just for fun. Tuesday 04:36:59 AM Copyright © 2004-6 - Fred Hicinbothem |
|---|