const airport_name_list = 'res://resources/airports.txt' var airport_names = [] const airport_difficulties = ["easy", "medium", "hard"] func load_airport_names(): var f = File.new() f.open(airport_name_list, File.READ) var index = 1 while not f.eof_reached(): # iterate through all lines until the end of file is reached airport_names.push_back(f.get_line()) f.close() func get_random_airport_name(exceptions=[]): var name_index:int = randi() % len(airport_names) while airport_names[name_index] in exceptions: name_index = randi() % len(airport_names) return airport_names[name_index]