Hands-on Rust: Inconsistency (page 91)

Continuation of the code snippet shows using “x > 0 && x < SCREEN_WIDTH” (and same for y) bounds, however other places where bounds are checked uses “x >= 0”.

It’s not entirely clear if this is a case of forgotten ‘=’ sign (to make it in line with other checks), or if the intention was to disallow the room to be adjacent to the edge of the map and as such missing a wall (in which case second check should’ve been “x < SCREEN_WIDTH - 1”)

Thanks for finding that. It does look inconsistent (I think the idea was to avoid rooms on edge boundaries, so the -1 case makes more sense). I’ve added it to my issue tracker for any future editions that may appear in the future.