コード例 #1
0
ファイル: test_day11.py プロジェクト: JDHProjects/AOC-2020
def test_inputToList():
    assert inputToList(testData) == [
        ["L", ".", "L", "L", ".", "L", "L", ".", "L", "L"],
        ["L", "L", "L", "L", "L", "L", "L", ".", "L", "L"],
        ["L", ".", "L", ".", "L", ".", ".", "L", ".", "."],
        ["L", "L", "L", "L", ".", "L", "L", ".", "L", "L"],
        ["L", ".", "L", "L", ".", "L", "L", ".", "L", "L"],
        ["L", ".", "L", "L", "L", "L", "L", ".", "L", "L"],
        [".", ".", "L", ".", "L", ".", ".", ".", ".", "."],
        ["L", "L", "L", "L", "L", "L", "L", "L", "L", "L"],
        ["L", ".", "L", "L", "L", "L", "L", "L", ".", "L"],
        ["L", ".", "L", "L", "L", "L", "L", ".", "L", "L"]
    ]
コード例 #2
0
ファイル: test_day11.py プロジェクト: JDHProjects/AOC-2020
def test_stabilizeSeatsPart2():
    assert countOccupied(stabilizeSeats(inputToList(testData),
                                        part2=True)) == 26
コード例 #3
0
ファイル: test_day11.py プロジェクト: JDHProjects/AOC-2020
def test_checkFarSeat():
    assert checkFarSeat(inputToList(testData2), 3, 4) == False
コード例 #4
0
ファイル: test_day11.py プロジェクト: JDHProjects/AOC-2020
def test_stabilizeSeats():
    assert countOccupied(stabilizeSeats(inputToList(testData))) == 37
コード例 #5
0
ファイル: test_day11.py プロジェクト: JDHProjects/AOC-2020
def test_checkAllSeats():
    assert checkAllSeats(inputToList(testData)) == inputToList(testOutput)
コード例 #6
0
ファイル: test_day11.py プロジェクト: JDHProjects/AOC-2020
def test_checkSeat4():
    assert checkSeat(inputToList(testData), 1, 0) == False
コード例 #7
0
ファイル: test_day11.py プロジェクト: JDHProjects/AOC-2020
def test_checkSeat3():
    assert checkSeat(inputToList(testData), 0, 0) == True
コード例 #8
0
ファイル: test_day11.py プロジェクト: JDHProjects/AOC-2020
def test_checkSeat2():
    assert checkSeat(inputToList(testData), 3, 2) == False
コード例 #9
0
ファイル: test_day11.py プロジェクト: JDHProjects/AOC-2020
def test_checkSeat1():
    assert checkSeat(inputToList(testData), 2, 3) == True
コード例 #10
0
ファイル: test_main.py プロジェクト: JDHProjects/AOC-2020
def test_day_11_2():
    print(
        countOccupied(
            stabilizeSeats(inputToList(loadData("day11")), part2=True)))
コード例 #11
0
ファイル: main.py プロジェクト: JDHProjects/AOC-2020
      str(sumUnanimousAnswers(loadData("day6", splitChar="\n\n"))))

from day7.day7 import countBags, generateRules, bagsInBags
print("day 7 part 1 = " +
      str(countBags(generateRules(loadData("day7")), "shiny gold")))
print("day 7 part 1 = " +
      str(bagsInBags(generateRules(loadData("day7")), "shiny gold")))

from day8.day8 import runInfiniteProgram, instructionList, fixProgram
print("day 8 part 1 = " +
      str(runInfiniteProgram(instructionList(loadData("day8")))))
print("day 8 part 2 = " + str(fixProgram(instructionList(loadData("day8")))))

from day9.day9 import findIncorrectNum, findValFromRange
print("day 9 part 1 = " +
      str(findIncorrectNum(loadData("day9", parseInt=True), 25)))
print("day 9 part 2 = " + str(
    findValFromRange(loadData("day9", parseInt=True),
                     findIncorrectNum(loadData("day9", parseInt=True), 25))))

from day10.day10 import calculateJoltage, calculateDistinctJoltages
print("day 10 part 1 = " +
      str(calculateJoltage(loadData("day10", parseInt=True))))
print("day 10 part 2 = " +
      str(calculateDistinctJoltages(loadData("day10", parseInt=True))))

from day11.day11 import inputToList, countOccupied, stabilizeSeats
print("day 11 part 1 = " +
      str(countOccupied(stabilizeSeats(inputToList(loadData("day11"))))))
print("day 11 part 2 = " + str(
    countOccupied(stabilizeSeats(inputToList(loadData("day11")), part2=True))))