Hands-on Rust: potential bugs

I’ve caught up with B4.0. Quite enjoying it! I ran into a couple of “bugs” in the dungeon crawler game logic. I’ll point out what I am seeing, but maybe you can leave the implementation to the reader to try and figure out as a challenge.

  1. Chasing/Random movement: movers do not consider other intent_to_move when moving to the same destination at the same time. This causes mobs to converge onto the same tile. like this:
    converg

  2. The map building flow does not verify that amulet/exit positions are excluded from potential monster/item spawn positions (or vice-versa). While this isn’t an issue for the mobs (since they move), this can cause an item to be placed on top of the exit/amulet. There’s a few easy ways to fix this, but a solution in the book might require a more strict/safe solution to prevent confusion. In the current code the ordering of amulet/monster spawn lines in the implemented build() functions don’t particularly matter, but a fix for this could require a specific order.

I think the book itself prepared me to solve both of these problems on my own. Perhaps it could be something to point out to the users so they have a challenge for themselves to try and solve.

Also, It’s possible content in the future chapters might make these bugs not really relevant.

1 Like