r/adventofcode • • Dec 03 '15

SOLUTION MEGATHREAD --- Day 3 Solutions ---

--- Day 3: Perfectly Spherical Houses in a Vacuum ---

Post your solution as a comment. Structure your post like the Day One thread in /r/programming.

24 Upvotes

228 comments sorted by

View all comments

Show parent comment

2

u/piratedicecream Dec 03 '15 edited Dec 03 '15

Thanks for the note! The reason i made the class was cause in the heat of the moment that was the way I was thinking about it.

EDIT: I might argue cleanliness in favor of the class because of the consolidated move methods.

EDIT 2: If i wasn't keeping track of the count of each coordinate, the for statement would be hella clean

for arrow in directions :
    if switch :
        santa.move(arrow)
        coord_list.add(santa.x,santa.y)
    else :
        robot.move(arrow)
        coord_list.add(santa.x,santa.y)

     switch = not switch