10836 - EEDS2 Chinese checker's random walk
|
Time |
Memory |
| Case 1 |
1 sec |
32 MB |
| Case 2 |
1 sec |
32 MB |
| Case 3 |
1 sec |
32 MB |
| Case 4 |
1 sec |
32 MB |
| Case 5 |
1 sec |
32 MB |
| Case 6 |
1 sec |
32 MB |
| Case 7 |
1 sec |
32 MB |
| Case 8 |
1 sec |
32 MB |
| Case 9 |
1 sec |
32 MB |
| Case 10 |
1 sec |
32 MB |
Description
We want to simulate a Chiness checker piece that randomly walks on the gameboard. The following figure dipicts the shape of the gameboard, the starting position of our checker piece (the starred position), nine positions (1~9) that are already occupied by other checker pieces, and six moving direcrtions (0~5) of our checker piece. The right half of the figure dipicts examples of valid (green) and invalid (red) moves of Chinese checker pieces.

Input
The input consists of multiple lines, each line consisting of
- A number, 0~5, indicates a dirrection our checker piece attempts to move toward. Please note that only our checker piece moves. Checker pieces 1~9 are still.
- A newline character
Output
The above figure depicts what are the results our checker piece moves according to a sequence of moving attempts, 5-4-4-5-4-4-0-0-4-2.
The output consists of multiple lines describing these results.
Each line consists of the following information
- The direction our checker piece attempts to move toward (i.e., a number between 0 and 5). This part actually repeats the input.
- A space
- The distance our checker piece actually moves (i.e., a number, 0~2) corresponding to a moving attempt. 0 corresponds to an invalid move (and our checker piece holds its position), 1 corresponds to a valid move, and 2 corresponds to a valid move over an occupied checker piece.
- If our checker piece moves to a position that has not been visited, the program additionally outputs a space and a word "new"
- A newline character
Tags