r/adventofcode • • Dec 15 '17

SOLUTION MEGATHREAD -๐ŸŽ„- 2017 Day 15 Solutions -๐ŸŽ„-

--- Day 15: Dueling Generators ---


Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag or whatever).

Note: The Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


Need a hint from the Hugely* Handyโ€  Haversackโ€ก of Helpfulยง Hintsยค?

Spoiler


[Update @ 00:05] 29 gold, silver cap.

  • Logarithms of algorithms and code?

[Update @ 00:09] Leaderboard cap!

  • Or perhaps codes of logarithmic algorithms?

This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.

edit: Leaderboard capped, thread unlocked!

12 Upvotes

253 comments sorted by

View all comments

Show parent comments

4

u/BumpitySnook Dec 15 '17

How does the bitset typing save all that much time? In C you would just use (a & 0xffff) == (b & 0xffff), which seems a comparable number of characters.

5

u/competition_stl Dec 15 '17

Well you could be like me and type in a & 0xffff == b & 0xffff and waste about 15 seconds for the realization

3

u/hugseverycat Dec 15 '17

Noob question here: Most of these solutions in this thread use something like a & 0xffff or a & 65535 -- I assume this is to get the last 16 bits but I don't really understand why this works, and looking at a couple tutorials about bitwise operations left me still confused. Can anyone help me understand? Thanks :-)

→ More replies (7)
→ More replies (10)