I’m trying to find as much time to practice PHP as I can in between holiday festivities. I had a chance to write a short word-based game in PHP for one of my Codecademy assignments. I liked it so much, I decided to create a repository to remember it!
What Is This?
For this Codecademy challenge, I was tasked with writing a word-based game using conditional statements. This was a great way to practice nested conditionals and using ternary operators.
How To Play
The player has 25 turns to complete the game. There is a set of instructions at the start of the game that list the available commands. The player inputs those commands (exactly as presented) and tries to beat the game in 25 turns or less.
What I Enjoyed
I’m very familiar with conditional statements as I’ve used them often in programming, but it was fun to practice them nonetheless. I enjoyed the plot of this game and it was very simple to create.
Check out the repository and try out the game. You can run the program by inputting
php index.php and follow along with the directions in the console. Enjoy!