Nov-13-2019, 07:20 PM
(This post was last modified: Nov-13-2019, 07:22 PM by the_ophidian_order.)
First, I echo ichabod801's comments.
Second, here's my crack at debugging your code: I found that if I use a stone hoe without silk touch, and a fortune enhancement of 21711917, that puts me in the apparently offending section of the code. If we look at the last five lines (358 through 362), we have this:
I'm assuming you're not done with the program yet, because when I go out with a bucket I always get nothing.
Second, here's my crack at debugging your code: I found that if I use a stone hoe without silk touch, and a fortune enhancement of 21711917, that puts me in the apparently offending section of the code. If we look at the last five lines (358 through 362), we have this:
else: count = 1 item = "cornflower" print(count, end=' ') print(item) r = r - 1"count" is defined, but only under the "else" that's started on line 357. The two "print" commands are not on the same indentation, so they're actually in the "while" loop that starts on line 274 -- they'll get executed every time in that while loop regardless of any of the checks (and subsequent settings of "count") between line 276 and 359. This is what makes it possible to get to line 360 without defining "count". I suspect what you want is this:
else: count = 1 item = "cornflower" print(count, end=' ') print(item) r = r - 1... which puts those print statements under the "else" where they (apparently) belong. This seems to avoid generating the "count not defined" error under the same conditions (The stone hoe without silk touch, and a fortune enhancement of 21711917). However, I can't say that's a definitive test of all of the possibilities.
I'm assuming you're not done with the program yet, because when I go out with a bucket I always get nothing.