| 1 |
>>> import adventure |
| 2 |
>>> adventure.play(seed=2) |
| 3 |
WELCOME TO ADVENTURE!! WOULD YOU LIKE INSTRUCTIONS? |
| 4 |
<BLANKLINE> |
| 5 |
>>> no |
| 6 |
YOU ARE STANDING AT THE END OF A ROAD BEFORE A SMALL BRICK BUILDING. |
| 7 |
AROUND YOU IS A FOREST. A SMALL STREAM FLOWS OUT OF THE BUILDING AND |
| 8 |
DOWN A GULLY. |
| 9 |
<BLANKLINE> |
| 10 |
>>> brief |
| 11 |
OKAY, FROM NOW ON I'LL ONLY DESCRIBE A PLACE IN FULL THE FIRST TIME |
| 12 |
YOU COME TO IT. TO GET THE FULL DESCRIPTION, SAY "LOOK". |
| 13 |
<BLANKLINE> |
| 14 |
|
| 15 |
This doctest exercises all of the different ways that people try to |
| 16 |
invoke Adventure commands from the Python prompt. |
| 17 |
|
| 18 |
Simple movement can be invoked simply by typing the direction, but some |
| 19 |
players will try to call them as functions instead. |
| 20 |
|
| 21 |
>>> s |
| 22 |
YOU ARE IN A VALLEY IN THE FOREST BESIDE A STREAM TUMBLING ALONG A |
| 23 |
ROCKY BED. |
| 24 |
<BLANKLINE> |
| 25 |
>>> n() |
| 26 |
YOU'RE AT END OF ROAD AGAIN. |
| 27 |
<BLANKLINE> |
| 28 |
|
| 29 |
That pretty much exhausts the possibilities when a word is being used |
| 30 |
alone as a command. But when two words are being combined, there are |
| 31 |
several different ways that they might be called! |
| 32 |
|
| 33 |
One word can be used as a function and the second as an argument: |
| 34 |
|
| 35 |
>>> goto(building) |
| 36 |
YOU ARE INSIDE A BUILDING, A WELL HOUSE FOR A LARGE SPRING. |
| 37 |
<BLANKLINE> |
| 38 |
THERE ARE SOME KEYS ON THE GROUND HERE. |
| 39 |
<BLANKLINE> |
| 40 |
THERE IS A SHINY BRASS LAMP NEARBY. |
| 41 |
<BLANKLINE> |
| 42 |
THERE IS FOOD HERE. |
| 43 |
<BLANKLINE> |
| 44 |
THERE IS A BOTTLE OF WATER HERE. |
| 45 |
<BLANKLINE> |
| 46 |
|
| 47 |
Or, a period can be used to separate the words. Note that nouns and |
| 48 |
verbs can be in either order. |
| 49 |
|
| 50 |
>>> get.keys |
| 51 |
OK |
| 52 |
<BLANKLINE> |
| 53 |
>>> lamp.get |
| 54 |
OK |
| 55 |
<BLANKLINE> |
| 56 |
|
| 57 |
Why do we support putting the noun and verb in either order? Because |
| 58 |
some users think of verbs as methods supported by the game's nouns, and |
| 59 |
will format their commands like method calls: |
| 60 |
|
| 61 |
>>> food.get() |
| 62 |
OK |
| 63 |
<BLANKLINE> |