How should I define the reward function to solve the Wumpus game with deep Q-learning?
The reward function is up to you when you set the goals for the agent.

If the goal is to score as highly as possible, before ending the game, then use the score. You may want to scale the score down if you are using neural networks, to prevent needing to handle very large error values in early phases of learning.

If the goal is to win the game, and you do not care about the score, then use the win/loss end result. I am not familiar with the game, but if it is possible to win the game - e.g. reach an exit - whilst not collecting all the gold, then the agent may choose to do that if it reduces the chance of losing.


The second option is harder for the agent to assess. You may want the current score to be one of the state variables, as the score is likely to be correlated with win/loss.
Most computer games are designed around giving a numerical score as feedback for human play, with high score tables, players considered &quot;better&quot; if they get more points etc. If you want your agent to compete in the same way, then using the score directly will help achieve that goal.