Share with you! I code with 226lines , and you?
More specific description of Input, Output of the program with mario
- INPUT: testcase_X_X.txt the file. Example: file testcase_1_1.txt
In this testcase file consists of two components:
(1) Line 1 to 10: (map) contains information of a map, a map such as size 10x20
(2) Line 11: The operation goes: each sequence of operations go, separated by a space ('')
Will have the code to help you read 2 content. Content (1) recorded in the 2-dimensional array map   and the content (2) recorded in the vector step
- OUTPUT screen print:
Line 1: goes through eg (1.0) (2.5) (diaphragm before recording, released the following record); each cell
separated by a space (' '). Oh what goes through two or more times, in both 2 or more times.
If the command is not still in the current coordinates
Line 2: Total points that Mario achieved only when the next destination, if not to the destination, in -1 (no later down the line)
- Description of requirements
Manipulation brief description:
LEFT_ : Scroll left 1 unit
RIGHT : Move right 1 unit
JUMP_ : Jumping usual spot up 2 units and falling in the initial position
LJUMP : Jumping up to 2 units left, left 2 shares fall
RJUMP : Jump right up 2 units to the right 2 shares fall
- Described in more detail on the map
Call coordinates of Mario is the 2-dimensional array corresponding to x and y, the origin is located at the bottom left map and start with 0.
Condition: 0 ≤ x ≤ 19; 0 ≤ y ≤ 9, 19 + 1 which is the maximum length of maps, 9 + 1 is the maximum height of the map. Symbols of objects on a map:
'#': Representing rock wall, obstacle
' ' (Blank character) represents the space (possibly moving)
'$' Representatives for money, only one character per box corresponding to 1 point
'! ': Destination
'@': The starting point
- Objective: Mario away from the starting point, take the first row of the previous operation, can reach the destination or not; passing on the road if the position of the coin, the coin feeding.
Each coin will be 1 point edible. Up is edible when Mario goes through the path of the coin. Only when Mario are about to target only. If the score is -1
The starting point is always on the ground (coordinates is (x, 0)) and end point located anywhere on the map.
Money may be scattered in the street. Obstacles to block the road just as (if no further action can be overcome) or can be flipped to eat pedestal currencies or to jump to the next level.
During the migration process, if you encounter the edge of the map editor that is seen as an obstacle.
In the process, if it does not pass through the target and then go forward again, ending the program and the number of points earned is the amount eaten.
- More specific description of the operation
Normally, if the current position is (x, y) is:
- Perform LEFT_, the new location is (x-1, y) and the cells go through the (x-1, y) if 1 without any other conditions (**) (see below)
- Doing RIGHT, new position is (x + 1, y) and the cells go through the (x + 1, y) if as there are no other conditions 1 (**) (see below)
- Perform JUMP_, the new location is (x, y) and the cells go through the (x, y + 1), (x, y + 2) without any other condition 1 (**) (see below)
- Perform LJUMP, for the new position (x-2, y), and the cells go through the (x, y + 1), (X, y + 2) (x-1, y + 2) (x-2, y + 2) (x-2, y + 1), (x-2, y) without any just one thing other events (**) (see below)
- Perform RJUMP, for the new position is (x + 2, y), and the cells go through the (x, y + 1),(X, y + 2) (x + 1, y + 2) (x + 2, y + 2) (x + 2, y + 1), (x + 2, y) without any just one thing other events (**) (see below)
- (**) A number of other conditions, otherwise self-similar reasoning, if the current position (x, y):
- Perform JUMP_ but on obstructions (x, y + 1), it can not be done. But if obstructions from one box at the top (x, y + 2) is still performed, but only one cell was jumping up and falling back to the position before jumping.
- Perform LEFT_ but left with no obstructions shall be done
- Perform RIGHT but right obstructions are not done
- Perform LEFT_ but not the left is about to fall down to touch the ground or the nearest obstacle, namely the new coordinates are (x-1, yn), where N is the height from the point of falling to land or the nearest obstacle.
- Same as above with manipulation RIGHT
- Perform instant LJUMP if left obstruction elevation ≥ 3 (compared to the positionpresent) is not done and seen as JUMP_ normal operation,lower if it can perform the operation. Similar to manipulate RJUMP.
- For LJUMP and RJUMP, similar to JUMP, if there are obstructions immediately above,can not be done; if there are obstructions from one box at the top is still done but only 1 box jump up and to the left or right by one cell only and falls (without obstructions).
- During the migration process, if you encounter an obstacle, it will fall right at close objects prevent possible.
- Similarly LEFT_ and RIGHT, LJUMP and RJUMP if the point falls space will continue to drop until the ground or the nearest obstacle.