Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.85 KB | None | 0 0
  1. ### Projet description
  2.  
  3. This projet is a small text-based labyrinth game.
  4. The users navigates in a 2D matrix of cases, his objective being to find the treasure as fast as possible.
  5.  
  6. The labyrinth structure is as follows
  7.  
  8. - '.' represent regular cases
  9. - '#' represent wall cases (user cannot walk though walls !)
  10. - 'T' represents the treasure (only ONE treasure in the labyrinth)
  11.  
  12. The user moves with the following inputs
  13.  
  14. - 'L' or 'l' to go left
  15. - 'R' or 'r' to go right
  16. - 'U' or 'U' to go up
  17. - 'D' or 'D' to go down
  18.  
  19. Initially, the user starts at position (1,1).
  20.  
  21. The user's position is stored in a 2-elements list, with first element being the X coordinate, and second element the Y coordinate.
  22. The labyrinth origin is located in the top left corner, and X/Y coordinate are always positive.
  23.  
  24. This is a working "codebase", I hope you like it.
  25. Many improvements could be made, will you help me out ?
  26.  
  27. ### And now, play on !
  28.  
  29. Please complete all features of a category before going to the next.
  30. Commit your code when you completed a feature, mention the feature ID in the commit message !
  31.  
  32. ## Easy features
  33.  
  34. - E1. Change the labyrinth
  35. * HINT : all lines must have the same length !
  36. - E2. Translate all printed messages to French
  37. - E3. Translate all comments messages to French
  38. - E4. Ask the user for its name at the beginning to welcome him
  39. - E5. Display a version number of your program at startup
  40. - E6. When the user reaches the treasure, display the number of moves
  41. * HINT : you will have to use a variable the holds the number of moves so far !
  42. - E7. Handle a new type of case : 'B' that represent a bomb (when the user reaches it he dies)
  43. * HINT : don't forget to add a B in your maze to test this functionality
  44.  
  45. ## Moderate features
  46. - M1. Handle a new type of user input : '?' that will display the labyrinth to the user, with 'X' at it's current position
  47. * HINT : the position of the treasure must remain hidden !
  48. * HINT : in Python you cannot modify a character at a position in a string.
  49. * HINT : to to so, you have to convert the string into a list, update the list, and convert back the list into a string
  50. * HINT : functions such a `list` and `join` should be helpful
  51. - M2. Give a hint to the user by printing the distance between the user and the treasure before each move
  52. * HINT : you can compute several distances (euclidian, manhattan), use a function per distance !
  53. - M3. Give another hint to the user by printing the angle between the user and the treasure
  54. * HINT : you will have to use trigonometry (I know...), in particular the `atan2` function !
  55. - M4. Handle a new type of case : 'o' that when reached, allows the user to go though the walls
  56. * HINT : you will have to use a variable that holds the information whether the user can go though walls or not !
  57. - M5. Handle a new type of case : 'm' that mixes up the moves with a mirror effect
  58. * HINT : when user says up it actually goes down, when it says right it goes left, and conversely
  59. - M6. Use colors in messages so that the user interface is better looking
  60. * HINT : you can use a package (termcolor) or use ANSI escape code from [this link](https://en.wikipedia.org/wiki/ANSI_escape_code)
  61. - M7. When the user reaches the treasure, display the time (mm:ss) spent
  62. * HINT : you can use the `time` module, and in particular the `time()` function in that module to measure the time spent
  63.  
  64. ## Advanced features
  65. - A1. Tell the user whether he already visited the current case (such that he can find out if he's going in circles !).
  66. * HINT : You will have to use a structure that will hold this information.
  67. - A2. When the user reaches the treasure, also print the shortest path (minimum number of steps needed),
  68. or print it at the beginning to make the user sweat !
  69. * 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