41 lines
1.0 KiB
Python
41 lines
1.0 KiB
Python
from aocd.models import Puzzle
|
|
from aocd import submit
|
|
|
|
class Game:
|
|
|
|
# data fields
|
|
moves = list()
|
|
opponent = list()
|
|
|
|
def __init__(self, moves : list, opponent : list) -> None:
|
|
self.moves = moves.copy()
|
|
self.opponent = opponent.copy()
|
|
|
|
def parse_input(data: list) -> list:
|
|
'''
|
|
parses the input data and generates a list of elfs
|
|
'''
|
|
# split input string into move sets
|
|
splits = data.split('\n')
|
|
# split move set list into game sets
|
|
n = 3
|
|
games = [ splits[i:i+n] for i in range(0, len(splits), n) ]
|
|
print(games)
|
|
|
|
if __name__ == "__main__":
|
|
# get puzzle and parse data
|
|
puzzle = Puzzle(year=2022, day=2)
|
|
data = puzzle.input_data
|
|
parse_input(data)
|
|
print(len(data))
|
|
|
|
|
|
# part a: submit biggest number of calories
|
|
answer = 0
|
|
print(f'answer part a: {answer}')
|
|
#submit(answer, part='a', day=2, year=2022)
|
|
|
|
# part b: submit the calorie sum of the top 3 elfs
|
|
#print(f'answer part b: {answer}')
|
|
#submit(answer, part='b', day=2, year=2022)
|