Hands-on Rust dungeon crawler bug I can't figure out (Amulet of Yala)

Hoping someone can point me in the right direction here: I’m working through the book Hands-On Rust and have just written the code required to spawn the Amulet of Yala in the map at the most accessibly distant tile from where the player spawns. It’s supposed to be added in the corner of some random faraway room, like this:
That image is from the book on pg 180. My code, however, has the amulet spawning not in a room but in one of the four corners of the entire map screen. i.e. completely unreachable:
I combed through every line of code and compared it to what’s in the author’s official repo (HandsOnRust/WinningAndLosing/winning at main · thebracket/HandsOnRust · GitHub) but can’t see what my mistake is. I finally just copied the code from all the files I touched for this Amulet of Yala task to ensure it’s identical, but the amulet is still spawning in a screen corner out of reach. The only files I edited for this are winning/src/components.rs
winning/src/spawner.rs
winning/src/map_builder.rs
winning/src/main.rs
winning/src/turn_state.rs
and 'winning/src/end_turn.rs
. I’m pretty sure the error involves map_builder.rs
because it’s the Dijkstra map code that is determining the distance/placement of the amulet in relation to the player:
Anyway, I created a Github repository of all my code in case someone is willing, able, and kind enough to have a look. GitHub - pudgyturtle/dungeoncrawl I’m reluctant to suggest it’s a bug or error with the book because so far every error I’ve had has been my own typo or oversight, but this one has me super stumped. I’d appreciate any suggestions or help!
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
- /nim
- /vuejs
- /emacs
- /elm
- /nerves