thecakeisalime's recent activity
-
Comment on Humble Bundle Books: (Almost) the entirety of Discworld for $16 in ~books
-
Comment on Why Jony Ive put buttons in the electric Ferrari in ~transport
thecakeisalime LinkThis is really cool; I love the engineering behind it, despite the fact that I'll never be able to drive one. Throughout the video, he kept asking "what problem is a touchscreen trying to solve?"...This is really cool; I love the engineering behind it, despite the fact that I'll never be able to drive one.
Throughout the video, he kept asking "what problem is a touchscreen trying to solve?" and saying carmakers didn't know. There is an answer: cost. Single-screen vehicles massively reduce the complexity and cost of the wiring harness, and they also save a few dollars per car by not paying for or installing buttons. As we've seen, touchscreens introduce a lot of other problems (mostly for the users), but they do solve a big problem for the manufacturers. I don't think Ferrari is worried about cost, which is why they're able to do something as cool as this.
I do think the "wrist bar" on the bottom of the screen is a great idea that could easily be adapted (perhaps even DIYed) into many existing touchscreen setups.
-
Comment on archive.today is directing a DDOS attack against my blog in ~tech
thecakeisalime Link ParentThe author outlines their motive in the linked post: Plus, the post didn't actually dox the owner, because he couldn't find anything.The author outlines their motive in the linked post:
My motives for publishing this have been questioned, sometimes in fanciful ways. The actual rationale is boringly straightforward: I found it curious that we know so little about this widely-used service, so I dug into it, in the same way that previous posts dug into a sketchy crypto coin offering, monetization dark patterns in a popular pay to win game, and the end of subway construction in Japan. That’s it, and it’s also the only post on my blog that references archive.today.
Plus, the post didn't actually dox the owner, because he couldn't find anything.
-
Comment on The hidden cost of AI art: Brandon Sanderson's keynote in ~tech
thecakeisalime Link ParentThank you, I think this is a better reply than I could have come up with. Once an artist releases the art into the world, it doesn't matter what the artist's intent was, the meaning behind it...Thank you, I think this is a better reply than I could have come up with.
Once an artist releases the art into the world, it doesn't matter what the artist's intent was, the meaning behind it becomes our own. And yeah, right now, a lot of AI-generated stuff is awful and it's hard to find meaning in it, but if someone wants to find meaning in it, that's their prerogative. I don't find any meaning in Jackson Pollock or Barnett Newman's works, but I'm not going to argue they aren't art.
Sometimes a book is about the unknowability and meaninglessness of human existence, and sometimes it's a good simple tale about a man who hates an animal.
-
Comment on Elon Musk says SpaceX will prioritize a city on the moon instead of a colony on Mars in ~space
thecakeisalime Link ParentWhy would we sink an empty boat? That seems like it would be damaging to the environment for no real gain.Why would we sink an empty boat? That seems like it would be damaging to the environment for no real gain.
-
Comment on The hidden cost of AI art: Brandon Sanderson's keynote in ~tech
thecakeisalime Link ParentAgreed. I think as a creator, he has a valid perspective, but as a consumer of art, he didn't really delve into why AI is or isn't art. I think mostly, his point is that people who only use AI to...Agreed. I think as a creator, he has a valid perspective, but as a consumer of art, he didn't really delve into why AI is or isn't art. I think mostly, his point is that people who only use AI to create something aren't artists. I can probably agree with that (for now), but I also don't know that it matters beyond semantics and philosophy. If I take a picture of something with my camera phone, am I a photographer? Or just someone who took a picture? Is it art?
When I look at the Mona Lisa, something from Deviant Art, or something generated by AI, I get to see the work in my own way. Once it's out there, the artist doesn't get to decide how I feel about their work. I mostly don't care how much blood, sweat, and tears were poured into the work. I'm just there to consume and experience the end result. I strongly believe in the separation of art from the artist, which also applies to AI generated art. Does the work stand on its own merit?
I have reasons for preferring non-AI work (and art created by non-shitty people), but it has little to do with the definition of "art" and who created it, and much more to do with how terrible capitalism is.
-
Comment on I made a word game in ~games
thecakeisalime LinkThis is a neat game. That's for sharing! I don't see how this would help someone sleep, but if it works for your wife, great! No big deal, but if you're looking for feedback, I found a few minor...This is a neat game. That's for sharing! I don't see how this would help someone sleep, but if it works for your wife, great!
No big deal, but if you're looking for feedback, I found a few minor bugs/annoyances:
- The close button for the "Congrats" screen overlaps significantly with the "How it works" button, making it difficult to click. Escape also doesn't close the Congrats screen (though that's maybe more of a feature request than a bug).
- Archived puzzles don't tell you when you've completed them. Obviously I know when it's solved, but it doesn't feel "finished".
In case it matters for these issues, I'm using Firefox on Win 11.
-
Comment on I'm back in ~talk
thecakeisalime Link ParentThere's no algorithm here, but you still need to be careful, since this is still a largely left-leaning space. It doesn't feel like an echo chamber in the same way Reddit's algorithm is pushing...There's no algorithm here, but you still need to be careful, since this is still a largely left-leaning space. It doesn't feel like an echo chamber in the same way Reddit's algorithm is pushing people towards specific communities, but I also don't know if there's a good way of knowing you're stuck in an echo chamber without exploring other spaces (and wow, it's a minefield out there).
-
Comment on How well can you predict the state of the world in 2041? in ~life
thecakeisalime LinkAre you planning to publish the results of this? I'd be interested to see what the general population (or at least, Tildes and your other friends) think is going to happen in the next 16 years.Are you planning to publish the results of this? I'd be interested to see what the general population (or at least, Tildes and your other friends) think is going to happen in the next 16 years.
-
Comment on China drafts world’s strictest rules to end AI-encouraged suicide, violence in ~tech
thecakeisalime Link ParentI suspect it won't. Chinese companies aren't going to stop developing AI. They might not even follow all of these regulations, because they're incredibly difficult and potentially impossible to...Maybe the adoption of these regulations in China will help deflate that excuse
I suspect it won't. Chinese companies aren't going to stop developing AI. They might not even follow all of these regulations, because they're incredibly difficult and potentially impossible to follow. One good thing about this specific legislation is that it immediately requires a human involved when suicide is mentioned. That means that people trying to work around the restrictions are more likely to be identified before something happens, since it's much more difficult to avoid these sorts of barriers without occasionally touching them. The obvious drawback is that it makes it very easy for a bad actor to overwhelm the service with a botnet spamming "How do I suicide?" thousands or millions of times.
-
Comment on Leaving Apple behind after eighteen years in ~tech
thecakeisalime Link ParentI don't know what it looked like before, but for me, the issue is the background visible behind the semi–transparent text box. The assorted coloured lines are making it difficult to focus on the...I don't know what it looked like before, but for me, the issue is the background visible behind the semi–transparent text box. The assorted coloured lines are making it difficult to focus on the text, and the contrast from the background that isn't behind the text makes it even worse.
-
Comment on Can a heavily modified Rivian take the electric vehicle Cannonball record? (Part 1) in ~transport
thecakeisalime LinkPart 2 has been posted. This completes the saga and we don't need to wait for a part 3.Part 2 has been posted. This completes the saga and we don't need to wait for a part 3.
-
Comment on Day 12: Christmas Tree Farm in ~comp.advent_of_code
thecakeisalime Link"Solving" the knapsack packing problem was a huge escalation from previous days, even if today is the last day, and was dreading trying to implement that. So instead, I decided I'd start by..."Solving" the knapsack packing problem was a huge escalation from previous days, even if today is the last day, and was dreading trying to implement that. So instead, I decided I'd start by calculating the upper and lower bounds of what the possible answers could be, since by now I've figured out that there's often a trick with the input that you can use to optimize these solutions. I was pleasantly surprised when I found they were equal. Of course, in what has become a daily occurrence for me, I still had the wrong answer; this time it was because I reversed the inequality signs. Once I fixed that though, I had the correct solution.
Solution [Python]
def parse_input(lines: list[str]) -> tuple[dict[int, list[list[str]]], list[tuple[str, list[int]]]]: presents = {} regions = [] shape = [] for line in lines: if line.endswith(':'): shape = [] presents[int(line[:-1])] = shape elif line and line[0] in '#.': shape.append(line) elif ':' in line: dimension, values = line.split(':') values = list(map(int, values.split())) regions.append((dimension, values)) return presents, regions def get_bounds(presents: dict[int, list[list[str]]], region: tuple[str, list[int]]): dimensions = tuple(map(int, region[0].split('x'))) quantities = region[1] area = dimensions[0] * dimensions[1] size = 0 nines = 0 for i, q in enumerate(quantities): size += q * sum(p.count('#') for v in presents[i] for p in v) nines += q * 9 return (nines <= area, size <= area) def part_one(presents: dict[int, list[list[str]]], regions: list[tuple[str, list[int]]]) -> tuple[int, int]: bounds = tuple(map(sum, zip(*(get_bounds(presents, r) for r in regions)))) return bounds def part_two() -> str: return '*' def main() -> None: with open('12.in') as file: lines = [line.rstrip() for line in file] input = parse_input(lines) print('Part 1:', part_one(*input)) print('Part 2:', part_two()) if __name__ == '__main__': main() -
Comment on Day 11: Reactor in ~comp.advent_of_code
thecakeisalime Link ParentIt was intentional. If there were paths from `dac -> fft` and also paths from `fft -> dac` then that would create a loop, and thus infinite paths. So the "in any order" from the problem statement...It was intentional.
If there were paths from `dac -> fft` and also paths from `fft -> dac` then that would create a loop, and thus infinite paths. So the "in any order" from the problem statement was a little misleading (potentially on purpose). Since it's acycllic, I "cheated" a little and just ran the code a couple times to see which of the two paths existed. You're correct in noting that there are valid inputs that would not work with my code, but I didn't bother generalizing for all cases. To generalize, I'd just have to check both, and ignore the one that had 0 paths.There could potentially be other loops that don't go through both fft and dac, but since my code spit out an answer instead of hanging forever, I (now) know that there are no loops. I did consider loop detection, but did not end up implementing it.
-
Comment on Day 11: Reactor in ~comp.advent_of_code
thecakeisalime LinkMuch easier today. Of course, that didn't stop me from making the same mistakes as yesterday. Copied my BFS code (that was several orders of magnitude too inefficient for yesterday's problem) from...Much easier today. Of course, that didn't stop me from making the same mistakes as yesterday.
Copied my BFS code (that was several orders of magnitude too inefficient for yesterday's problem) from yesterday to solve part 1. Why didn't I reuse the DFS (that also was too inefficient for yesterday's problem)? Because the BFS code was prettier.
Get to Part 2 and realized I should have just started with DFS. Oh well. Easy enough to just rewrite a DFS. Luckily, DFS is actually the right tool for this job, and this worked as expected. My original plan was to use a "visited" check for visiting the fft and dac nodes, but that turned out to make caching much more complicated than I wanted.
Part 1&2 [Python]
def parse_input(lines: list[str]) -> dict[str, list[str]]: deviceIO = {} for line in lines: input, output = map(str.strip, line.split(':')) deviceIO[input] = output.split() return deviceIO def count_paths(deviceIO: dict[str, list[str]], node: str, end: str, memo: set[str]) -> int: if node in memo: return memo[node] paths = 0 for n in deviceIO[node]: if n == end: return 1 paths += count_paths(deviceIO, n, end, memo) memo[node] = paths return paths def part_one(deviceIO: dict[str, list[str]]) -> int: return count_paths(deviceIO, 'you', 'out', {}) def part_two(deviceIO: dict[str, list[str]]) -> int: deviceIO['out'] = [] return ( count_paths(deviceIO, 'svr', 'fft', {}) * count_paths(deviceIO, 'fft', 'dac', {}) * count_paths(deviceIO, 'dac', 'out', {}) ) def main() -> None: with open('11.in') as file: lines = [line.rstrip() for line in file] input = parse_input(lines) print('Part 1:', part_one(input)) print('Part 2:', part_two(input)) if __name__ == '__main__': main() -
Comment on Day 10: Factory in ~comp.advent_of_code
thecakeisalime Link ParentYes, that seems likely. A few days ago I crashed my computer by using too much memory in one of these puzzles, and this time it's been running for 2+ hours and my computer is still working, so I...Yes, that seems likely. A few days ago I crashed my computer by using too much memory in one of these puzzles, and this time it's been running for 2+ hours and my computer is still working, so I think I must have not done everything incorrectly, but this definitely feels more like "age of the universe" runtime and less "I can just let it run overnight".
It has been a very long time since I've worked with problems like this (does it show?). Seems like I need to study math and try again after work.
-
Comment on Day 10: Factory in ~comp.advent_of_code
thecakeisalime (edited )LinkAs I'm typing this, my code is still running. Probably not a great sign, but if it works it works! (It's yet to be seen if it works). Similar massive escalation in difficulty between Part 1 and...As I'm typing this, my code is still running. Probably not a great sign, but if it works it works! (It's yet to be seen if it works).
Similar massive escalation in difficulty between Part 1 and Part 2 today as to yesterday. Unlike yesterday, I did know how to solve Part 2, I just didn't know how to do it efficiently (and as we pass the 5 minute mark, it's clear that I never figured that out). I started with a basic recursive depth-first search, because I like to be extra inefficient and couldn't remember how to do a BFS off the top of my head. It "worked" for the sample data, but it was clear that it would probably take several days of processing to get the answer with the real data. Then I remembered that caching/memoization was a thing. That sped it up considerably, but also got the wrong answer sometimes, because DFS was the wrong tool for this.
So then I looked up how to implement a BFS, I cached results again, and now at the 10 minute mark, my code is still executing. At least the sample data processed quickly. With 177 independent inputs, I guess this is what parallelization is for.
I'm posting this at the 30 minute mark in case my computer crashes. I wish I'd added some logging statements so that I knew it was progressing. I'll update with the code if it turns out it actually worked.
EDIT: Killed the process after ~2.5 hours. Peeked at some AoC threads, and saw that this is something called Integer Linear Programming. I don't think I covered that in university, but if I did, I've forgotten all about it. But luckily, I can use google and found a tool called PuLP that I managed to figure out well enough to use. Not sure this really counts as "my" solution at this point, but it's at least a solution, and it runs in a couple seconds. Might actually be in milliseconds, but the console output is pretty slow.
Part 1 & 2 [Python]
import itertools import pulp BIG_NUMBER = 10000 def parse_input(lines: list[str]) -> tuple[list[str], list[list[list[int]]], list[list[int]]]: lights = [] buttons = [] joltages = [] for line in lines: light, *button, joltage = line.split() lights.append([c == '#' for c in light.strip('[]')]) buttons.append([list(map(int, b.strip('()').split(','))) for b in button]) joltages.append(list(map(int, joltage.strip('{}').split(',')))) return lights, buttons, joltages def toggle_lights(target: list[bool], button_combos: tuple[list[int]]): lights = [False]*len(target) for bc in button_combos: for b in bc: lights[b] ^= True if target == lights: return len(button_combos) return BIG_NUMBER def increase_joltage_ilp(target: list[int], button_list: list[list[int]]) -> int: matrix = [[0]*len(button_list) for _ in range(len(target))] for j, buttons in enumerate(button_list): for i in buttons: matrix[i][j] = 1 problem = pulp.LpProblem("Minimum Button Presses", pulp.LpMinimize) vars = [pulp.LpVariable(f'x_{i}', lowBound=0, cat='Integer') for i in range(len(button_list))] problem += pulp.lpSum(vars) for i in range(len(target)): problem += pulp.lpSum(matrix[i][j] * vars[j] for j in range(len(button_list))) == target[i] problem.solve() return int(sum(v.value() for v in vars)) def part_one(input: tuple[list[str], list[list[list[int]]], list[list[int]]]) -> int: target_lights, buttons, _ = input presses = 0 for target, button_list in zip(target_lights, buttons): button_combos = [] for r in range(0, len(button_list)): button_combos.extend(itertools.combinations(button_list, r+1)) presses += min(toggle_lights(target, bc) for bc in button_combos) return presses def part_two(input: tuple[list[str], list[list[list[int]]], list[list[int]]]) -> int: _, buttons, joltages = input presses = 0 for i, (button_list, target) in enumerate(zip(buttons, joltages)): print(i, target) #presses += increase_joltage_dfs(target, [0]*len(target), button_list, 0, {}) #presses += increase_joltage_bfs(target, button_list) presses += increase_joltage_ilp(target, button_list) return presses def main() -> None: with open('10.in') as file: lines = [line.rstrip() for line in file] input = parse_input(lines) print('Part 1:', part_one(input)) print('Part 2:', part_two(input)) if __name__ == '__main__': main() -
Comment on Day 9: Movie Theater in ~comp.advent_of_code
thecakeisalime Link ParentI've never done graphical stuff before, so this is pretty basic, but I've plotted the whole floor and all of the valid rectangles. It's pretty crowded, since there's so many rectangles, so you...I've never done graphical stuff before, so this is pretty basic, but I've plotted the whole floor and all of the valid rectangles. It's pretty crowded, since there's so many rectangles, so you can't tell which is the largest, but the shape of the floor is kinda spoilery information (if you've made it this far into the comments and are still trying to avoid spoilers).
-
Comment on Day 9: Movie Theater in ~comp.advent_of_code
thecakeisalime LinkPart 1: less than 5 minutes. Part 2: several hours of frustrating coding, just to finally import a library that does all the hard parts. I saw someone mention Shapely in a Reddit post, and figured...Part 1: less than 5 minutes. Part 2: several hours of frustrating coding, just to finally import a library that does all the hard parts. I saw someone mention Shapely in a Reddit post, and figured that I'd learn a lot more by playing around with a new library than just brute forcing a solution poorly.
Tomorrow's goal is to discover the best python library for the job without first reading AoC threads on Tildes or Reddit. If Part 2 was any indication, I think it's well past the point where I can solve the upcoming challenges with barebones Python.
Part 1 and 2 [Python]
from shapely.geometry import Polygon, box def parse_input(lines: list[str]) -> list[tuple[int,int]]: return [tuple(map(int, l.split(','))) for l in lines] def area(tile1: tuple[int, int], tile2: tuple[int, int]) -> int: x1,y1 = tile1 x2,y2 = tile2 return (abs(x1-x2)+1)*(abs(y1-y2)+1) def green_area(greenTiles, tile1: tuple[int, int], tile2: tuple[int, int]) -> int: x1,y1 = tile1 x2,y2 = tile2 if greenTiles.contains(box( min(x1, x2), min(y1, y2), max(x1, x2), max(y1, y2) )): return area(tile1, tile2) return 0 def part_one(tiles: list[tuple[int,int]]) -> int: return max(area(a, b) for i, a in enumerate(tiles) for b in tiles[i+1:]) def part_two(tiles: list[tuple[int,int]]) -> int: greenTiles = Polygon(tiles) return max(green_area(greenTiles, a, b) for i, a in enumerate(tiles) for b in tiles[i+1:]) def main() -> None: with open('09.in') as file: lines = [line.rstrip() for line in file] input = parse_input(lines) print('Part 1:', part_one(input)) print('Part 2:', part_two(input)) if __name__ == '__main__': main() -
Comment on Day 8: Playground in ~comp.advent_of_code
thecakeisalime LinkDefinitely more to think about today, and got to learn all about sets in python. I've also started hinting most of the types in function definitions because it feels like a good practice, and...Definitely more to think about today, and got to learn all about sets in python. I've also started
declaringhinting most of the types in function definitions because it feels like a good practice, and because I kept getting confused while implementing this. Looking at it now, almost everything is the same type, so it's pretty extraneous now, but it took a while for me to settle on (lists of) sets.Fun fact... Today I figured out that I've been globally scoping my file inputs and a handful of other variables this whole time. Mostly through luck it hasn't been an issue yet, but I'll try to not do that in the future. It could have easily been a disaster in today's puzzle.
Part 1 and 2 [Python]
import math def get_distance(x1:int, y1:int, z1:int, x2:int, y2:int, z2:int) -> int: return math.sqrt((x2-x1)**2 + (y2-y1)**2 + (z2-z1)**2) def get_ordered_connections(lines):# -> dict_keys: positions = [tuple(map(int, l.split(','))) for l in lines] distances = {} for i, p1 in enumerate(positions): for j, p2 in enumerate(positions[i+1:]): distances[(i,j+i+1)] = get_distance(*p1, *p2) return dict(sorted(distances.items(), key=lambda x: x[1])).keys() def find_circuits(circuits: list[set], connections:list[set]) -> list[set]: for conn in connections: add_connection(circuits, conn) while connections != circuits: return find_circuits([], circuits) return circuits def add_connection(circuits:list[set], connection:set) -> list[set]: set = next((c for c in circuits if not connection.isdisjoint(c)), None) if set: set.update(connection) else: circuits.append(connection) return circuits def part_one(connections) -> int: # 10 for test data, 1000 otherwise sets = [set(key) for key in list(connections)[:10]] circuits = find_circuits([], sets) circuits.sort(key=len, reverse=True) return math.prod([len(c) for c in circuits[:3]]) def part_two(connections, lines) -> int: sets = [set(key) for key in list(connections)] circuits = [] for s in sets: find_circuits(circuits, [s]) if len(circuits[0]) == len(lines): return int(lines[s.pop()].split(',')[0]) * int(lines[s.pop()].split(',')[0]) return 0 with open('08.in') as file: lines = [line.rstrip() for line in file] connections = get_ordered_connections(lines) print('Part 1:', part_one(connections)) print('Part 2:', part_two(connections, lines))
Also not available in Canada.