Advertisement
AtEchoOff

Python Warmup - Count Walkable Tiles

Jul 12th, 2025
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | Source Code | 0 0
  1. # "F" = Floor, "W" = Wall
  2. dungeon_map = [
  3.     ["W", "W", "W", "W", "W"],
  4.     ["W", "F", "F", "W", "W"],
  5.     ["W", "W", "F", "F", "W"],
  6.     ["W", "F", "F", "W", "W"],
  7.     ["W", "W", "W", "W", "W"]
  8. ]
  9.  
  10. player_x = 2
  11. player_y = 2
  12.  
  13. def count_adjacent_floors(map_data, x, y):
  14.     # TODO: Count how many floor tiles (F) are directly adjacent (up/down/left/right)
  15.     return 0  # Placeholder
  16.  
  17. print(count_adjacent_floors(dungeon_map, player_x, player_y))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement