itsapi / pycraft

A Minecraft-inspired game for the terminal
GNU General Public License v2.0
197 stars 21 forks source link

add_tree crash #96

Closed SullyJHF closed 8 years ago

SullyJHF commented 8 years ago
Traceback (most recent call last):
  File "main.py", line 311, in <module>
    main()
  File "main.py", line 19, in main
    game(blocks, *ui.main())
  File "main.py", line 82, in game
    new_slices[pos] = terrain.gen_slice(pos, meta, blocks)
  File "/home/sullyjhf/Downloads/repos/pycraft/terrain.py", line 161, in gen_slice
    slice_ = add_tree(slice_, pos, meta, blocks)
  File "/home/sullyjhf/Downloads/repos/pycraft/terrain.py", line 73, in add_tree
    - len(center_leaves) + trunk_depth)
  File "/usr/lib/python3.4/random.py", line 218, in randint
    return self.randrange(a, b+1)
  File "/usr/lib/python3.4/random.py", line 196, in randrange
    raise ValueError("empty range for randrange() (%d,%d, %d)" % (istart, istop, width))
ValueError: empty range for randrange() (2,2, 0)
tree_height = random.randint(2, air_height
                          - len(center_leaves) + trunk_depth)
# equates to
tree_height = random.randint(2, 1)