This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
SPOILER ALERT | |
Puzzle at: https://adventofcode.com/2022/day/15 | |
Part 2 could be brute-forced with the use of "part1" in less | |
than 10 minutes, I guess. | |
I opted for a rectangle-splitting approach, and checking if |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
SPOILER ALERT! | |
Problem at: https://adventofcode.com/2022/day/14 | |
I guess, no special comments this time. | |
Just that terminedia.V2 is truly great! | |
""" | |
import terminedia as TM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
SPOILER ALERT! | |
Problem at: https://adventofcode.com/2022/day/13 | |
This one was made quite easy by using Python's native comparison heuristics | |
along with operator overloading. | |
Part 2 was ready without a single new line of code on the class- just adding the markers, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
SPOILER ALERT | |
Advent of Code, day 12 - 2022 | |
At least, I am using terminedia for something | |
beyond the 2D vectors - | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
SPOILER ALERT | |
As usual, these are snippets used to get the answer in interactive mode, not | |
a self-contained interactive program. | |
""" | |
class Monkey: | |
monkeys = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Puzzles at: https://adventofcode.com/2022/day/8 | |
SPOILER ALERT!!! | |
Not super-smart - but very conffy to look and operate at the map. | |
Probably with some heavy caching (using attached dicts) could go from quadractic time to near linear time. | |
(Or O(MxN) M being the total points, N being max (Width, Height)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Problem at https://adventofcode.com/2022/day/6 | |
SPOILER ALERT! | |
This is a problem that could easily be solved by "brute-force" and simply | |
creating a set for each 14-character window and checking its length. | |
I created a "counter of counters" that I think could hold | |
constant time for counting, and therefore, linear time to | |
find large un-repeated sequences in large (multi GB) datasets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
( https://adventofcode.com/2022/day/5 ) | |
SPOILER ALERT! | |
Instead of the end-to-end solution, just the class I've used | |
which can display the animation of containers been | |
moved around - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
( https://adventofcode.com/2022/day/4 ) | |
SPOILER ALERT! The snippets in here present a complete solution | |
This is both "my style" and what I like most about Python: | |
creating a minimal class which implements one or more operators | |
turns the solving of thiz puzzle into a super-readable | |
one liner! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<script type="text/javascript" src="brython.js"></script> | |
<script type="text/javascript" src="brython_stdlib.js"></script> | |
</head> | |
<body onload="brython(1)"> |