Sure! Here's an example of a text-based game implemented in a single HTML file using JavaScript:
In this game, you start by receiving a welcome message and your goal is to escape the house by finding the yellow key. You have 7 steps to reach your goal. The game presents you with different options such as "look around", "steal key", and "use key". Depending on your choice, the game will respond accordingly and keep track of your progress. If you manage to escape with the yellow key within 7 steps, you win. Otherwise, the game is over and you have the option to restart.