# --- Day 5: Binary Boarding --- # # Part 1: Find seat id from binary space partitioned seat string # Part 2: Find the only empty seat # import sys sys.path.append("..") from AoCCommon.InputToArray import InputToArray a = InputToArray() mydata = a.array example = "BFFFBBFRRR" def part1(): maxid = 0 for seat in mydata: row = seat[0:7] row = row.replace('B', '1').replace('F', '0') column = seat[7:] column = column.replace('R', '1').replace('L', '0') row = int(row, 2) column = int(column, 2) if row * 8 + column > maxid:
# --- Day 16: ####### --- # # Part 1: # Part 2: # import sys sys.path.append("..") from AoCCommon.InputToArray import InputToArray a = InputToArray(delimiter="\n\n") mydata = a.array sample =\ """ class: 1-3 or 5-7 row: 6-11 or 33-44 seat: 13-40 or 45-50 your ticket: 7,1,14 nearby tickets: 7,3,47 40,4,50 55,2,20 38,6,12 """
#import bpy import os os.chdir('D:\\Projects\\AdventOfCode2020') os.chdir('20201201') target = 2020 testinput = [1721, 979, 366, 299, 675, 1456] import sys sys.path.append("..") from AoCCommon.InputToArray import InputToArray a = InputToArray(mode='int') rawdata = a.array def part1(): smaller = [] larger = [] for i, entry in enumerate(rawdata): #bpy.ops.mesh.primitive_cube_add(size=2, enter_editmode=False, align='WORLD', location=(i*2, 0, entry/2), scale=(1, 1, entry)) if entry < target / 2: smaller.append(entry) else: larger.append(entry)