[Tutor] A Text Adventure Problem

John Bochicchio luckytsukune at gmail.com
Sun Mar 24 22:09:38 CET 2013


1. I'm using the terminal to run the code. Using the command - (cd python
&& python2 game1.py)
2. Using python 2.6 I believe.
3. I'm running Arch Linux at the moment.
4. I'm new to python, but I assume the error must have something to do with
not having a way for the program to move to the next area of the code.


On Sun, Mar 24, 2013 at 4:58 PM, bob gailer <bgailer at gmail.com> wrote:

>  On 3/24/2013 3:41 PM, John Bochicchio wrote:
>
> I've been trying to write a simple test text adventure, but have been
> running into serious problems. Here is the error I get when I run it. It
> will give me the opening text and lets me make my first choice.
>
> What did you enter? I will bet is was 'window'.
>
>  Then I get this.
>
>  error "Traceback: (Most recent call last)
> file "game1.py", line 104, in <module>
> RUNNER (ROOMS, shack_front)
> file "game1.py", line 100 in runner
> room = map[next]
> keyerror= none
>
>   [snip]
>
> Questions:
> 1 - what are you using to run your code?
> 2 - Version of Python?
> 3 - Operating system?
> 4 - Did you think about what the error might mean?
>
> Observations:
>
> 1 - The traceback does not match your code, so either you retyped it or
> you are using some unusual way of running the program.
>
> Compare
> RUNNER (ROOMS, shack_front)
> with
> runner (ROOMS, 'shack_front')
>
> 2 - the error normally would look like KeyError: None rather than keyerror=
> none
>
>  3 - The various room functions have at least one way out of them with no
> return statement. The value returned in that case is None.
>
> 4 - There are many many blank lines in the program making it much harder
> to read. In future eliminate most or all of them.
>
> 5 - Most of us do not have the patience to count down 100 lines. In future
> flag the line with something like:
>         room = map[next] <======== line 100
>
> 6 -     quips = ["You've become a zombie and eat you pals. Douche."
>
>              "You've died and left your comrades to fend for themselves.
> Douche"
>              "Your whole group dies because of you. Douche."
>              "You've got terrible planning skills, and ruined the teams
> chances of survival. Douche."]
> quips is a list with one element, consisting of one string or 244
> characters.
> print quips[randint(0, len(quips)-1)]
> will always print the entire string.
> Perhaps you meant to put a comma at the end of each line?
>
> HTH and good luck.
>
> --
> Bob Gailer919-636-4239
> Chapel Hill NC
>
>


-- 
A computer without a Microsoft operating system is like a dog without
bricks tied to its head.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130324/5a04fd35/attachment.html>


More information about the Tutor mailing list