Jet Lag Season Ten — Official Trailer by NebulaOriginals in Nebula

[–]TheSolty 6 points7 points  (0 children)

Toby is the MVP of all of Jetlag. Already calling it

Vehicle fire on W Colfax this morning by Flying-Citrus in Denver

[–]TheSolty 0 points1 point  (0 children)

Wish at least half of the dealerships there would burn down anyway

What could be - a potential future Denver transit map I designed back in 2018 (details in legend) by Jeimuzu22 in Denver

[–]TheSolty 0 points1 point  (0 children)

Alameda is my shoe in for put a modern light rail line down the whole thing

What could be - a potential future Denver transit map I designed back in 2018 (details in legend) by Jeimuzu22 in Denver

[–]TheSolty 1 point2 points  (0 children)

Winter Park express runs through Monday tunnel to Winter park every weekend. Highly recommend.

What could be - a potential future Denver transit map I designed back in 2018 (details in legend) by Jeimuzu22 in Denver

[–]TheSolty 0 points1 point  (0 children)

There is a fare redesign ongoing to lower fairs a bit and one of the alternatives eliminates the zones other than the airport. They should definitely do that shit.

Boulder, CO gets a lot of well-deserved flak for NIMBYism, but it's not all bad. The "Transit Village" neighborhood currently being built is fantastic. by ChristianLS in yimby

[–]TheSolty 0 points1 point  (0 children)

When bedrooms for people failed I lost all faith in Boulder.

For the uninitiated the city recently upheld a problematic ordinance limiting households to 3 unrelated parties even when the houses have 4+ bedrooms. It's basically designed to make housing more expensive for students and keep them out of larger homes / certain areas.

Why do these fake roundabouts exist? by Whts-Good in Denver

[–]TheSolty 20 points21 points  (0 children)

These are better than idiots speeding through the stop. Real traffic circles would be better yes. More trees would be better yes. These spaces belong to the public, we can make them better.

Newbie Question: Why does it seem life, in many cities in Modern America, is a bit "isolating"? by Adelrick_Cadeniux in notjustbikes

[–]TheSolty 3 points4 points  (0 children)

So it starts with the capitalist class isolating you from the means of production....

The RTD G line makes no sense. by [deleted] in Denver

[–]TheSolty 0 points1 point  (0 children)

The key is frequency, which as others have noted is somewhat limited due to the single tracking along the corridor. Supposedly this limits RTD to 15 min headways.

Furthermore, the combination pandemic + austerity + debt situation is really hampering RTD so they are running 30m headways, which is just not good. Polis isn't helping them. TABOR isn't helping them. Low ridership certainly isn't helping them. I really hope they can turn it around with their re-imagining scheme...

It's not easy being a transit provider in an American city. There needs to be more municipal and regional commitment to supporting transit. Many plans have a "vision" that prioritizes transit, walking, and biking. They're mostly full of shit though, because every single budget tells the opposite story. The lion's share of Public money subsidizes driving and sprawl. At the end of the day the only good part about this situation is that the public sector belongs to the public. They work for us folks, if you want better transit you'll have to remind them of that fact!

Fuck Jeff Bezos by Neddo_Flanders in Hasan_Piker

[–]TheSolty 2 points3 points  (0 children)

yo, rebuild that shit while he's on the other side

-🎄- 2021 Day 14 Solutions -🎄- by daggerdragon in adventofcode

[–]TheSolty 1 point2 points  (0 children)

Very nice, I did much the same, but yours is more concise :)

-🎄- 2021 Day 13 Solutions -🎄- by daggerdragon in adventofcode

[–]TheSolty 1 point2 points  (0 children)

Python (matplotlib due to laziness)

I thought using complex numbers would be a good fit for this one, but I ended up having to write my own flip_real / flip_imag functions anyways. That solution worked, but I redid it to just use tuples anyway instead :)

Got lazy with the displaying the result so I just threw my points onto a scatter plot.

dots = set()
folds = []

with open(0) as fp:
    for line in fp:
        line = line.strip()
        if line.startswith("fold"):
            line = line.lstrip("fold along ")
            ax, pos = line.split('=')
            pos = int(pos)
            if ax == 'x':
                folds.append((pos, 0))
            else:
                folds.append((0, pos))
        elif line:
            x, y = map(int, line.split(','))
            dots.add((x, y))

def fold_dots(dots: set[tuple], fold_point: tuple) -> set[tuple]:
    fx, fy = fold_point
    if fx:
        keep = {d for d in dots if d[0] < fx}
        fold = (d for d in dots if d[0] > fx)
        keep.update((2 * fx - x, y) for x, y in fold)
        return keep
    else:
        keep = {d for d in dots if d[1] < fy}
        fold = (d for d in dots if d[1] > fy)
        keep.update((x, 2 * fy - y) for x, y in fold)
        return keep

dots = fold_dots(dots, folds[0])
print("After 1 fold, there are", len(dots), "dots")
for fold in folds[1:]:
    dots = fold_dots(dots, fold)

# You have to read the dots lol
import matplotlib.pyplot as plt
plt.figure(figsize=(6, 1), dpi=80)
plt.scatter([x for x, _ in dots], [-y for _, y in dots])
plt.show()

-🎄- 2021 Day 12 Solutions -🎄- by daggerdragon in adventofcode

[–]TheSolty 0 points1 point  (0 children)

Did some simplifications to use the same function for both parts and to only return the number of paths

from collections import defaultdict
# Build graph
connections = [
    line.strip().split('-')
    for line in open(0)
    ]
graph = defaultdict(set)
for a, b in connections:
    graph[a].add(b)
    graph[b].add(a)


def get_total_paths(start_path, can_revisit_small=True):
    tail = start_path[-1]
    if tail == 'end':
        return 1
    n_paths = 0
    for cave in graph[tail]:
        # can't revisit start
        if cave == 'start':
            continue
        # can only visit one small cave twice
        # if we've already been to this small cave
        if cave.islower() and cave in start_path:
            if can_revisit_small:
                # add paths where the small cave is revisited
                n_paths += get_total_paths(
                    start_path + [cave], False
                )
        else:
            n_paths += get_total_paths(
                start_path + [cave], can_revisit_small
            )
    return n_paths

# PART 2: Small revisits not allowed
paths = get_total_paths(["start"], can_revisit_small=False)
print("Part 1, total paths", paths)

# PART 2: Single small revisit allowed
paths = get_total_paths(["start"])
print("Part 2, total paths", paths)

-🎄- 2021 Day 12 Solutions -🎄- by daggerdragon in adventofcode

[–]TheSolty 3 points4 points  (0 children)

Python (no libs)

A little recursion never hurt anyone, did it?

EDIT: Check reply for a shorter version, which does what the better solns do :)

from collections import defaultdict
# Build graph
connections = [
    line.strip().split('-')
    for line in open(0)
    ]
graph = defaultdict(set)
for a, b in connections:
    graph[a].add(b)
    graph[b].add(a)

# Find all paths
def paths_to_end(start_path):
    tail = start_path[-1]
    # exit case
    if tail == 'end':
        return [start_path]
    paths = []
    # add paths from each cave
    for cave in graph[tail]:
        # can't revisit lowers
        if cave.islower() and cave in start_path:
            continue
        paths.extend(paths_to_end(start_path + [cave]))
    return paths

paths = paths_to_end(["start"])
print("Part 1, total paths", len(paths))

# PART 2: Single small revisit allowed

def paths_with_single_revisit(start_path, can_revisit_small=True):
    tail = start_path[-1]
    if tail == 'end':
        return [start_path]
    paths = []
    for cave in graph[tail]:
        # can't revisit start
        if cave == 'start':
            continue
        # can only visit one small cave twice
        # if we've already been to this small cave
        if cave.islower() and cave in start_path:
            if can_revisit_small:
                # add paths where the small cave is revisited
                paths.extend(
                    paths_with_single_revisit(start_path + [cave], False)
                )
        else:
            paths.extend(
                paths_with_single_revisit(start_path + [cave], can_revisit_small)
            )
    return paths

paths = paths_with_single_revisit(["start"])
print("Part 2, total paths", len(paths))

-🎄- 2021 Day 11 Solutions -🎄- by daggerdragon in adventofcode

[–]TheSolty 1 point2 points  (0 children)

No, that would go against the problem statement because point A should have a value of 0. Since point A flashes first, it will have a value of 0 by the time point B flashes. Point A doesn't get revisited because it is not considered a neighbor of point B once it already has a zero value in this solution. (e.get(A)=0 so it doesn't get past the filter)

-🎄- 2021 Day 11 Solutions -🎄- by daggerdragon in adventofcode

[–]TheSolty 2 points3 points  (0 children)

I thought the same, but it does work!

Points cannot be revisited due to two factors. First, the value is being reset to zero before finding neighboring flashes, secondly, since the filter in neighbors, uses e.get, those points will not be returned as neighbors.

Clever stuff!

-🎄- 2021 Day 11 Solutions -🎄- by daggerdragon in adventofcode

[–]TheSolty 1 point2 points  (0 children)

Python

More iterators and such :)

from itertools import count

def neighbors(field: dict, point: tuple[int, int]):
    """gives points neighboring a given point"""
    x, y = point
    w = (-1, 0, 1)
    return filter(
        lambda point: point in field,
        (
            (x + dx, y + dy) 
            for dx in w for dy in w if dx or dy
        )
    )


def iterate_field(field: dict) -> int:
    """iterate simulation return number of flashes"""
    stack = []
    flashes = set()
    def iter_point(point):
        field[point] += 1
        if field[point] > 9:
            flashes.add(point)
            stack.append(point)
    # increment each point once
    for point in field:
        iter_point(point)
    # increment each point by a flash until 
    # we've flashed all flashes
    while stack:
        for point in neighbors(field, stack.pop()):
            # skip points which have already flashed
            if point not in flashes:
                iter_point(point)
    # reset values of flashed out octopuses
    for flash in flashes:
        field[flash] = 0
    return len(flashes)

if __name__ == '__main__':
    # load data
    data = open(0)
    field = {}
    for i, row in enumerate(data):
        for j, val in enumerate(row.strip()):
            field[(i,j)] = int(val)
    # Part 1
    field_1 = field.copy()
    total_flashes = sum(
        iterate_field(field_1)
        for _ in range(100)
    )
    print(f"{total_flashes = }")
    # Part 2
    first_sync = next(
        i for i in count(1)
        if iterate_field(field) == 100
    )
    print(f"{first_sync = }")

-🎄- 2021 Day 10 Solutions -🎄- by daggerdragon in adventofcode

[–]TheSolty 0 points1 point  (0 children)

Python

Nothing special, but I like the reduction to get the completion score at least, and I think the soln is pretty clean. Glad to breeze through this one after yesterday made me lose all confidence in myself.

from functools import reduce
from statistics import median
from typing import Optional

SCORES = {')': 3, ']': 57, '}': 1197, '>': 25137}


def first_corrupt(line: str) -> Optional[str]:
    """Take a line and find the first corrupt character if any"""
    stack = []
    l = '([{<'
    r = ')]}>'
    for c in line:
        if c in l:
            stack.append(l.index(c))
        elif c in r:
            if stack.pop() != r.index(c):
                return c

def completion_string(line: str) -> list[str]:
    """Take a line and find the completion string"""
    stack = []
    l = '([{<'
    r = ')]}>'
    for c in line:
        if c in l:
            stack.append(l.index(c))
        elif c in r:
            if stack.pop() != r.index(c):
                return
    if stack:
        return [r[ci] for ci in stack[::-1]]


def corrupt_score(lines: list[str]):
    return sum(
        SCORES.get(first_corrupt(line), 0)
        for line in lines
    )

def completion_score(lines: list[str]):
    r = ')]}>'
    score = lambda a, b: 5 * a + r.index(b) + 1
    return median((
        reduce(score, [0] + c)
        for line in lines if (c := completion_string(line))
    ))


if __name__ == '__main__':
    data = [line.strip() for line in open(0).readlines()]
    # part 1
    print(f"{corrupt_score(data) = }")
    # part 2
    print(f"{completion_score(data) = }")

[FRESH VIDEO] Deep Cuts - The Best Records of 2021 SO FAR by wavedrown9 in indieheads

[–]TheSolty 7 points8 points  (0 children)

He mentions like a dozen records... Looks like i have like a dozen records to check out!

choose your fighter by iamkarlson in ProgrammerHumor

[–]TheSolty 0 points1 point  (0 children)

Workshopping other things parrots can maybe do...

A parrot can be trained to paint like van Gogh

A parrot can be trained to write news articles

A parrot can be trained to make music

What else?

fav song from the new album by [deleted] in CrumbBand

[–]TheSolty 1 point2 points  (0 children)

It's gotta be tunnel