Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Projet description
- This projet is a small text-based labyrinth game.
- The users navigates in a 2D matrix of cases, his objective being to find the treasure as fast as possible.
- The labyrinth structure is as follows
- - '.' represent regular cases
- - '#' represent wall cases (user cannot walk though walls !)
- - 'T' represents the treasure (only ONE treasure in the labyrinth)
- The user moves with the following inputs
- - 'L' or 'l' to go left
- - 'R' or 'r' to go right
- - 'U' or 'U' to go up
- - 'D' or 'D' to go down
- Initially, the user starts at position (1,1).
- The user's position is stored in a 2-elements list, with first element being the X coordinate, and second element the Y coordinate.
- The labyrinth origin is located in the top left corner, and X/Y coordinate are always positive.
- This is a working "codebase", I hope you like it.
- Many improvements could be made, will you help me out ?
- ### And now, play on !
- Please complete all features of a category before going to the next.
- Commit your code when you completed a feature, mention the feature ID in the commit message !
- ## Easy features
- - E1. Change the labyrinth
- * HINT : all lines must have the same length !
- - E2. Translate all printed messages to French
- - E3. Translate all comments messages to French
- - E4. Ask the user for its name at the beginning to welcome him
- - E5. Display a version number of your program at startup
- - E6. When the user reaches the treasure, display the number of moves
- * HINT : you will have to use a variable the holds the number of moves so far !
- - E7. Handle a new type of case : 'B' that represent a bomb (when the user reaches it he dies)
- * HINT : don't forget to add a B in your maze to test this functionality
- ## Moderate features
- - M1. Handle a new type of user input : '?' that will display the labyrinth to the user, with 'X' at it's current position
- * HINT : the position of the treasure must remain hidden !
- * HINT : in Python you cannot modify a character at a position in a string.
- * HINT : to to so, you have to convert the string into a list, update the list, and convert back the list into a string
- * HINT : functions such a `list` and `join` should be helpful
- - M2. Give a hint to the user by printing the distance between the user and the treasure before each move
- * HINT : you can compute several distances (euclidian, manhattan), use a function per distance !
- - M3. Give another hint to the user by printing the angle between the user and the treasure
- * HINT : you will have to use trigonometry (I know...), in particular the `atan2` function !
- - M4. Handle a new type of case : 'o' that when reached, allows the user to go though the walls
- * HINT : you will have to use a variable that holds the information whether the user can go though walls or not !
- - M5. Handle a new type of case : 'm' that mixes up the moves with a mirror effect
- * HINT : when user says up it actually goes down, when it says right it goes left, and conversely
- - M6. Use colors in messages so that the user interface is better looking
- * HINT : you can use a package (termcolor) or use ANSI escape code from [this link](https://en.wikipedia.org/wiki/ANSI_escape_code)
- - M7. When the user reaches the treasure, display the time (mm:ss) spent
- * HINT : you can use the `time` module, and in particular the `time()` function in that module to measure the time spent
- ## Advanced features
- - A1. Tell the user whether he already visited the current case (such that he can find out if he's going in circles !).
- * HINT : You will have to use a structure that will hold this information.
- - A2. When the user reaches the treasure, also print the shortest path (minimum number of steps needed),
- or print it at the beginning to make the user sweat !
- * HINT : You will need to precise what the shortest path is, with the walls it can get really tricky !
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement