def main(): fullInput: List[str] = readFile(FILEPATH) rules: List[str] = [s.strip() for s in fullInput[0:fullInput.index("\n")]] messages: List[str] = [ s.strip() for s in fullInput[fullInput.index("\n") + 1:] ] # Part 1 whiteFlag(1, "Num valid strings", "12/19") # Part 2 whiteFlag(2, "?", "12/19")
def main(): inputLines: List[str] = [line.strip() for line in readFile(FILEPATH)] yourTime: int = int(inputLines[0]) onlyValidBuses: List[int] = [ int(i) for i in inputLines[1].split(",") if i != "x" ] # Part 1 partOne: int = calculateWeightedWaitTime(yourTime, onlyValidBuses) print(f"Part 1 -- Time Diff: {partOne}") # (my attempt at) Part 2 fullBusSchedule: List[str] = inputLines[1].strip().split(",") busOrder: List[List[int]] = findBusOrder(fullBusSchedule) whiteFlag(2, "Special Time", "12/13")
def main(): inputLines: List[str] = [s.strip() for s in readFile(FILEPATH)] # Part 1 # I am honestly not sure why the function does not work. I tested it for over an hour # with a bunch of individual inputs, and it worked fine for every one. If anyone knows # why this is failing, please let me know! total: int = 0 for line in inputLines: total += parseArithmetic(line) print(f"Part 1 -- Total Sum: {total}") # Part 2 whiteFlag(2, "?", "12/18")
def main(): allInputLines: List[str] = readFileWithEmptyLineBreaks(FILEPATH) fieldsInput: List[str] = allInputLines[0].split("\n") yourTicketInput: str = allInputLines[1].split("\n")[1].strip() nearbyTicketInput: List[str] = [s.strip() for s in allInputLines[2].split("\n")[1:]] fieldsList: List[Field] = constructFieldsList(fieldsInput) # Part 1 print(f"Part 1 -- Error Rate: {calculateErrorRate(fieldsList, nearbyTicketInput)}") # Part 2 relationships: List[str] = determineFieldTicketRelationships(fieldsList, nearbyTicketInput) whiteFlag(2, "Product of Departure Tickets", "12/16")
def main(): inputLines: List[str] = readFileWithEmptyLineBreaks(FILEPATH) identificationRegex = re.compile(r"(Tile) (\d*)") tiles: List[Tile] = [] for line in inputLines: tileInfo: List[str] = [l.strip() for l in line.split("\n")] identificationInfo: int = int( identificationRegex.match(tileInfo[0])[2]) tiles.append(Tile(identificationInfo, tileInfo[1:])) # Part 1 print(f"Part 1 -- 4 Corners Product: {calculateFourCornersProduct(tiles)}") # Part 2 whiteFlag(2, "Roughness", "12/20")