O'Reilly logo

Learn Python the Hard Way: A Very Simple Introduction to the Terrifyingly Beautiful World of Computers and Code, Third Edition, Video-Enhanced Edition by Zed A. Shaw

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exercise 48. Advanced User Input

ImageVideo: Exercise 48: Advanced User Input

Your game probably works well, but your user input system isn’t very robust. Each room needed its own very exact set of phrases that only worked if your player typed them perfectly. What you’d rather have is a device that lets users type phrases in various ways. For example, we’d like to have all these phrases work the same:

• Open door.

• Open the door.

• Go through the door.

These two phrases should also work the same:

• Punch bear.

• Punch the bear in the face.

It should be alright for a user to write something a lot like English for your game and have your game figure ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required