started a little late today, however this one was really fun so far.

This commit is contained in:
2020-12-05 19:33:41 +01:00
parent 11f6f1b4d1
commit 613823d21e
3 changed files with 915 additions and 0 deletions

26
05/main.py Normal file
View File

@@ -0,0 +1,26 @@
# doing python again because i want to :^)
lines = open("input.txt").read().split("\n")
#i will use this if i ever need it, for now it's faster to not use it
#scores = []
lastScore = 0
# its binary, time to understand bitshifting
for line in lines:
if len(line) > 3: #idk i picked 3 just cuz, sometimes python just has empty string after split
b = int(line.lower().replace("f", "0").replace("b","1").replace("l","0").replace("r","1"), 2)
row = b >> 3
col = b & int("0000000111", 2) # idk if you can do this with bitshifting too, this felt kinda cheap
score = row * 8 + col
if score > lastScore:
lastScore = score
print(lastScore)