Exemplo n.º 1
0
    def test_find_square_distance(self):
        # arrange
        s = SpaceMap([1101, 100, -1, 4, 0])

        m = [
            '#.......................................',
            '.#......................................',
            '..##....................................',
            '...###..................................',
            '....###.................................',
            '.....####...............................',
            '......#####.............................',
            '......######............................',
            '.......#######..........................',
            '........########........................',
            '.........#########......................',
            '..........#########.....................',
            '...........##########...................',
            '...........############.................',
            '............############................',
            '.............#############..............',
            '..............##############............',
            '...............###############..........',
            '................###############.........',
            '................#################.......',
            '.................########OOOOOOOOOO.....',
            '..................#######OOOOOOOOOO#....',
            '...................######OOOOOOOOOO###..',
            '....................#####OOOOOOOOOO#####',
            '.....................####OOOOOOOOOO#####',
            '.....................####OOOOOOOOOO#####',
            '......................###OOOOOOOOOO#####',
            '.......................##OOOOOOOOOO#####',
            '........................#OOOOOOOOOO#####',
            '.........................OOOOOOOOOO#####',
            '..........................##############',
            '..........................##############',
            '...........................#############',
            '............................############',
            '.............................###########'
        ]

        # act
        points = s.LoadMap(m)
        result = s.FindSquareDistance()

        # assert
        self.assertEqual(result, 250020)
Exemplo n.º 2
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)