def run(): recipes = Recipes([3, 7], 0, 1) number = load_input_as_string( os.path.join(os.path.dirname(__file__), 'input.txt')) return recipes.get_total_recipes_before(number)
def run(): track = Track.parse( load_input_as_string(os.path.join(os.path.dirname(__file__), 'input.txt'), trim=False)) return track.find_first_collision()
def run(): serial_number = int( load_input_as_string( os.path.join(os.path.dirname(__file__), 'input.txt'))) grid = Grid(serial_number) return '(%d,%d) = %d' % grid.largest_power_grid(3)
def run(): recipes = Recipes([3, 7], 0, 1) number = int( load_input_as_string( os.path.join(os.path.dirname(__file__), 'input.txt'))) return recipes.get_following_10_scores_after(number)
def run(): data = [ int(d) for d in load_input_as_string( os.path.join(os.path.dirname(__file__), 'input.txt')).split(' ') ] tree = Node.load(data) return tree.calculate_checksum()
def run(): data = load_input_as_string(os.path.join(os.path.dirname(__file__), 'input.txt')) pattern = compile(r'^(?P<players>\d+) players; last marble is worth (?P<points>\d+) points$') match = pattern.match(data) players = int(match.group('players')) points = int(match.group('points')) game = Game(players, points) return game.get_highest_score()
def run(): s = load_input_as_string( os.path.join(os.path.dirname(__file__), 'input.txt')) shortest_length = len(s) for c in ascii_lowercase: length = len(reduce(remove_units(s, c))) if length < shortest_length: shortest_length = length return shortest_length
def run(): zone = Zone.parse(load_input_as_string(os.path.join(os.path.dirname(__file__), 'input.txt'))) return zone.part1()
def run(): value = load_input_as_string( os.path.join(os.path.dirname(__file__), 'input.txt')) return len(reduce(value))