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.
-
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:
-
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.
Popular Pragprog topics










Other popular topics










Latest in Pragprog
Latest (all)
Categories:
My Saved Portals
-
None saved yet
Popular Portals
- /elixir
- /opensuse
- /rust
- /kotlin
- /ruby
- /erlang
- /python
- /clojure
- /react
- /quarkus
- /go
- /vapor
- /v
- /react-native
- /wasm
- /security
- /django
- /nodejs
- /centos
- /haskell
- /rails
- /fable
- /gleam
- /swift
- /js
- /deno
- /assemblyscript
- /tailwind
- /laravel
- /symfony
- /phoenix
- /crystal
- /typescript
- /debian
- /adonisjs
- /julia
- /arch-linux
- /svelte
- /spring
- /preact
- /flutter
- /c-plus-plus
- /actix
- /java
- /angular
- /ocaml
- /zig
- /kubuntu
- /scala
- /zotonic
- /vim
- /rocky
- /lisp
- /html
- /keyboards
- /vuejs
- /nim
- /emacs
- /nerves
- /elm