https://shirotoriko.w3.websr.fr/PHP-Labyrinth/
In this exercise, you will have to program a maze game in PHP. The maze must be 15 rows by 15 columns. To represent it, you will have to make a .txt file, in which you will "draw" a maze with characters.
Then, you will have to open this .txt file in PHP, to be able to use it and transcribe the maze into an array.
You will then need to be able to display this table in a web page.
When the game starts, you will have to ask for the username, and keep it in memory until the end of the game (by displaying it on the screen).
The next step will be to create several links :
- Left : will have to move your character to the left
- Right : will have to move your character to the right
- Top : will have to move your character to the top
- Bottom : will have to move your character to the bottom
- Restart : will have to restart the game from the beginning
- Change nickname : should allow the player to change his username
Each time you click on a button, the page will reload and display the new maze if you ckicked on a move button.
If you click on Restart, the game will have to reload from the beginning.
If you click on Change nickname, the username must be changed with an input field that you will have made available.
Don't hesitate to use functions and/or OOP for this exercise.
Use sessions and/or cookies and/or BDD to record the progress of the game, so that if you close the page and reopen it, the game will resume where you left off.
The maze .txt file should be changeable (not in the middle of a game), and your program should still be running.
Onnce your character has reached the exit, you should display a won message, by offering to restart the game.
If you feel like a fearless warrior, here are some small features you can add :
- Offer several maze levels (several .txt files) and allow the user to choose a maze before starting to play.
- Add items, randomly placed in the maze. If the character reaches the end without the items, he has lost.
- Add traps that can appear or disappear randomly during the game.
- Upload your code on Github, and add the Github link in your deliverables.
Deliverables must be sent by email to [email protected] before May, 18th at 4:00PM.
They must contain all your files in a .zip archive. Please include your last and first name.
No name : 0. No mail received from you : 0.
- Code cleanliness (indentation, variable names, etc.) : 5 points
- Code structure (tree structure of files) : 3 points
- Code optimization : 2 points
- Operational program : 30 points
- Delivery time (per day of delay) : -5 points
- Points for bonus feature : 2 points
- Points for bonus OOP use : 5 points
The work is to be done individually.
However, nothing prevents you from help each other on the reflection !
Here are the controls that it might be useful to know about :
- Movement - Arrow keys
- Logout - Escape key
- Restart - Space key
Tested with Chrome and Firefox.
Renders of the main menu : | Renders of the game : |
---|---|