Implement the Dungeons and Dragons problem.