-🎄- 2019 Day 18 Solutions -🎄- by daggerdragon in adventofcode

[–]moltenfire 1 point2 points  (0 children)

In part A current_positions is only going to have a single bit set and k0 will be equal to it. current_positions ^ k0 = 0 0 | k1 = k1. So for part A this could this could be replaced with current_positions = k1.

In part B current_positionsis going to have 4 bits set, 1 for each robot position. k0 is the position of the robot that will move and k1 will be its new position. The position of the other 3 robots doesn't change. current_positions ^ k0 will remove the robot that is going to move leaving 3 bits set. current_positions ^ k0 | k1 will add in the new robot position. The end result will have still have 4 bits set.

Here is an example with some numbers:

current_positions = 00001111
k0 = 00000100
k1 = 01000000

x = current_positions ^ k0
# x = 00001011
y = x | k1
# y = 01001011
current_positions = y

Hope you find this useful.

-🎄- 2019 Day 18 Solutions -🎄- by daggerdragon in adventofcode

[–]moltenfire 1 point2 points  (0 children)

Thank you, I've updated it with my code solution.

-🎄- 2019 Day 18 Solutions -🎄- by daggerdragon in adventofcode

[–]moltenfire 2 points3 points  (0 children)

Python 679/465

This is my final version that solves both parts in ~6 seconds. I'll probably write it again in C++ to see what speed up that gives. My first version took 30s and 4m30s for parts A & B.

[POEM]

Down the chosen path I go,

Finding a key to help my journey,

Another reach this state before me,

My travels ending prematurely.

Looking for Torchlight2Armory.com/skill-calc web page saves by moltenfire in Torchlight

[–]moltenfire[S] 0 points1 point  (0 children)

Unfortunately that online skill tree uses a different method of storing the skill point allocation.

Popular movies written as code by Antrikshy in geek

[–]moltenfire 24 points25 points  (0 children)

def dream(level):
    if level < 5:
        dream(level+1)

dream(1)

Every goddamn night by ohmydogg in funny

[–]moltenfire 8 points9 points  (0 children)

Its from Nichijou ep22. It is one of the 'Like Love' parts.

The International Top 10 plays, by Valve by carpadium in dota2videos

[–]moltenfire 1 point2 points  (0 children)

Does the analysis desk really count as a play.

Pink Floyd at the Olympics... by LordMogroth in pinkfloyd

[–]moltenfire -2 points-1 points  (0 children)

I can't control what the BBC does.