mirror of
https://github.com/ZeusWPI/Advent-of-Code-Aggregator.git
synced 2024-11-25 07:51:10 +01:00
done fucked it up
This commit is contained in:
parent
77ee7859a2
commit
ac3b2142b1
9 changed files with 0 additions and 2076 deletions
Binary file not shown.
File diff suppressed because it is too large
Load diff
|
@ -1,10 +0,0 @@
|
|||
from w1 import d1
|
||||
|
||||
|
||||
def main():
|
||||
print(d1.part1())
|
||||
print(d1.part2())
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
|
||||
def read(inputData):
|
||||
with open(inputData, "r") as infile:
|
||||
data = infile.readlines()
|
||||
return data
|
||||
|
||||
|
||||
def strArrToIntArray(inputData):
|
||||
return [int(value.replace("\n","").replace(" ","")) for value in inputData]
|
||||
|
||||
|
||||
def readAsIntArray(inputData):
|
||||
return strArrToIntArray(read(inputData))
|
||||
|
||||
def keepEven(inputData):
|
||||
return [d for d in inputData if d % 2 == 0]
|
||||
|
||||
def keepUneven(inputData):
|
||||
return [d for d in inputData if d % 2 == 1]
|
||||
|
||||
def keepIfContaint(inputData, toContain):
|
||||
return [d for d in inputData if toContain in d]
|
||||
|
||||
def removeIfContains(inputData, toContain):
|
||||
return [d for d in inputData if not toContain in d]
|
||||
|
||||
def keepIfDevisor(inputData, toDiv):
|
||||
return [d for d in inputData if toDiv % d == 0]
|
||||
|
||||
def keepIfDivisibleBy(inputData, toDiv):
|
||||
return [d for d in inputData if d % toDiv == 0]
|
||||
|
||||
def get_primelist(lower, upper):
|
||||
result = []
|
||||
for cp in range ( lower, upper + 1 ):
|
||||
for i in range ( lower, cp ):
|
||||
if ( cp % i == 0 ):
|
||||
break
|
||||
else:
|
||||
result.append(cp)
|
||||
return result
|
Binary file not shown.
Binary file not shown.
|
@ -1,24 +0,0 @@
|
|||
import util
|
||||
|
||||
def count_increments(depths, slice_length):
|
||||
increments = 0
|
||||
slice_start = 0
|
||||
slice_end = slice_start + slice_length
|
||||
prev = depths[slice_start:slice_end]
|
||||
for i in range(len(depths)):
|
||||
idx = i+1
|
||||
slice = depths[idx:idx+slice_length]
|
||||
if (sum(slice) > sum(prev) and len(slice) == slice_length):
|
||||
increments += 1
|
||||
prev = slice
|
||||
return increments
|
||||
|
||||
|
||||
def part1():
|
||||
depths = util.readAsIntArray("id1.txt")
|
||||
return count_increments(depths, 1)
|
||||
|
||||
def part2():
|
||||
depths = util.readAsIntArray("id1.txt")
|
||||
return count_increments(depths,3)
|
||||
|
|
@ -1 +0,0 @@
|
|||
# AoC
|
Loading…
Reference in a new issue