コード例 #1
0
 public void BuildMaze(int size)
 {
     if (size < 2)
     {
         throw new InvalidMazeSizeException($"Maze dimension must be 2 or greater.");
     }
     Maze = MazeHandler.NewMaze(MazeType.VerySimpleMaze, size);
 }
コード例 #2
0
        public int?GetRoom(int roomId, char direction)
        {
            if (!Util.IndexInMazeRange(Maze, roomId))
            {
                throw new IndexOutOfRangeException($"Invalid roomId {roomId} for maze of size {Maze.Size}.");
            }

            return(MazeHandler.TraverseMaze(Maze, roomId, direction));
        }
コード例 #3
0
        public bool CausesInjury(int roomId)
        {
            if (!Util.IndexInMazeRange(Maze, roomId))
            {
                throw new IndexOutOfRangeException($"Invalid roomId {roomId} for maze of size {Maze.Size}.");
            }

            return(MazeHandler.TrapCheck(new RandomGenerator(), Maze, roomId));
        }