Hunt the Wumpus: Difference between revisions

Content added Content deleted
Line 228: Line 228:
println("AHA! YOU GOT THE WUMPUS!")
println("AHA! YOU GOT THE WUMPUS!")
return("win")
return("win")
elseif any(x -> x == "Wumpus", rooms[arrowroom])
elseif any(x -> roomcontents[x] == "Wumpus", rooms[arrowroom])
numrooms = rand([0, 1, 2, 3])
numrooms = rand([0, 1, 2, 3])
if numrooms > 0
if numrooms > 0
println("...OOPS! BUMPED A WUMPUS!")
println("...OOPS! BUMPED A WUMPUS!")
wroom = rooms[arrowroom][findfirst(x -> x == "Wumpus", rooms[arrowroom])]
wroom = rooms[arrowroom][findfirst(x -> roomcontents[x] == "Wumpus", rooms[arrowroom])]
for i in 1:3
for i in 1:3
tmp = wroom
tmp = wroom