예제 #1
0
    def test_write_beam_map(self):
        # arrange
        infile = open('data/input_19.txt', 'r')
        program = infile.readline().strip().split(',')
        # program[0] = 2
        a = SpaceMap(program)
        result = []

        # act
        print()
        result = a.WriteBeamMap()
        a.PrintSpaceMap()
        print(a.GetAffectedCells())

        # assert
        self.assertEqual(result, 2500)
예제 #2
0
    def test_load_map(self):
        # arrange
        s = SpaceMap([1101, 100, -1, 4, 0])
        m = [
            '#.........', '.#........', '..##......', '...###....',
            '....###...', '.....####.', '......####', '......####',
            '.......###', '........##'
        ]

        # act
        points = s.LoadMap(m)
        print(points)
        result = s.GetAffectedCells()

        # assert
        self.assertEqual(result, 27)
예제 #3
0
# Advent of Code 2019: https://adventofcode.com/2019/day/11
#
#

from AoC19_classes import SpaceMap

infile = open('data/input_19.txt', 'r')
inputData1 = infile.readline().strip().split(',')

# Part 1
e = SpaceMap(inputData1)
e.WriteTractorMap()

print("Part 1: ", e.GetAffectedCells())

# Part 2
# result = w.RunAgain()
result = e.FindSquareDistance(100)
print("Part 2: ", result)