private static void PopulateMaze(Maze maze, EntityLegend legend, string[] fileLines) { for (var y = 0; y < fileLines.Length; y++) { for (var x = 0; x < fileLines[y].Length; x++) { var symbol = fileLines[y][x]; var entity = legend.GetEntity(symbol, new Position(x, y), maze); if (entity == null) { continue; } maze.AddEntity(entity); } } }