Sure! Here's an example of a text-based game where the player must escape the house by finding the yellow key, while being pursued by a monster who also has the yellow key. The player needs to steal the yellow key from the monster in order to escape.
To keep it simple, I'll provide the JavaScript code that you can include within a single HTML file:
To play the game, open the HTML file in a web browser on your smartphone. You'll see text prompts asking for your actions. Enter either "search" to search the room or "steal" to attempt to steal the key from the monster. Follow the prompts and try to escape by stealing the key from the monster before getting caught. Good luck!