Crestwave's recent activity
-
Comment on Slay the Spire 2 | Official gameplay trailer in ~games
-
Comment on Day 5: Print Queue in ~comp.advent_of_code
Crestwave Like many others here, I was initially very worried about part 2 but I managed to hack my way through it. AWK solutions: Part 1 Pretty straightforward. I iterate through each page then go through...Like many others here, I was initially very worried about part 2 but I managed to hack my way through it. AWK solutions:
Part 1
Pretty straightforward. I iterate through each page then go through its rules to see if I already encountered anything that is defined to come after it.
#!/usr/bin/awk -f BEGIN { FS = "[|,]" } /\|/ { rule[$1] = rule[$1] $2 "," } /^[^\|]*$/ { for (i in pages) delete pages[i] for (i = 1; i <= NF; ++i) { pages[$i] = 1 r = rule[$i] n = split(r, a, ",") for (j = 1; j < n; ++j) if (pages[a[j]]) next } total += $(int(NF/2)+1) } END { print total }
Part 2
As I have mentioned quite a few times here already, AWK doesn't provide any sorting option, much less an advanced one where you can provide custom rules or weights, so I was initially worried about this. However, I decided to try the naive approach of simply swapping the pages in each violation until they were sorted and it worked surprisingly well.
#!/usr/bin/awk -f BEGIN { FS = "[|,]" } /\|/ { rule[$1] = rule[$1] $2 "," } /^[^\|]*$/ { # clean up all arrays and variables from previous iterations # in hindsight, there would probably be less of this boilerplate if I used a function instead for (i in pages) delete pages[i] for (i in order) delete order[i] temp = 0 # set this separately now since it will be modified during the loop for (i = 1; i <= NF; ++i) order[i] = $i for (i = 1; i <= NF; ++i) { pages[order[i]] = i r = rule[order[i]] n = split(r, a, ",") for (j = 1; j < n; ++j) if (pages[a[j]]) { # swap the places of the updates in the rule violated temp = order[i] order[i] = a[j] order[pages[a[j]]] = temp # restart the processing again to correct any cascading errors for (i in pages) delete pages[i] i = 0 break } } if (temp) total += order[int(NF/2)+1] } END { print total }
-
Comment on Day 7: Bridge Repair in ~comp.advent_of_code
Crestwave This one was surprisingly simple. Part 2 especially required very, very minimal changes for me, at least as far as AWK goes. Part 1 Simple recursive solution. I actually accidentally...This one was surprisingly simple. Part 2 especially required very, very minimal changes for me, at least as far as AWK goes.
Part 1
Simple recursive solution. I actually accidentally misinterpreted it initially and thought I was supposed to find the number of possibilities for each equation, but it runs quick enough that doing so doesn't really have any downside.
#!/usr/bin/awk -f function check(a, ptr, len, val, test) { if (ptr > len) return (val == test) else return check(a, ptr+1, len, val+a[ptr], test) + check(a, ptr+1, len, val*a[ptr], test) } BEGIN { total = 0 } { sub(/:/, "") for (i = 1; i <= NF; ++i) a[i] = $i if (check(a, 3, NF, a[2], a[1]) > 0) total += a[1] } END { print(total) }
Part 2
This one was very simple, I just copied another function call into the chain on line 6 and deleted the operator (which automatically leads to concatenation in AWK). I finally felt the consequences of recursively finding all possible solutions here, but it still completes within a few seconds so I just let it be.
#!/usr/bin/awk -f function check(a, ptr, len, val, test) { if (ptr > len) return (val == test) else return check(a, ptr+1, len, val+a[ptr], test) + check(a, ptr+1, len, val*a[ptr], test) + check(a, ptr+1, len, val a[ptr], test) } BEGIN { total = 0 } { sub(/:/, "") for (i = 1; i <= NF; ++i) a[i] = $i if (check(a, 3, NF, a[2], a[1]) > 0) total += a[1] } END { print(total) }
-
Comment on Day 4: Ceres Search in ~comp.advent_of_code
Crestwave This was one problem where rushing it worked surprisingly to my favor. AWK solutions: Part 1 My approach here was to locate X's and look for occurrences of "MAS" in all directions. I generally...This was one problem where rushing it worked surprisingly to my favor. AWK solutions:
Part 1
My approach here was to locate X's and look for occurrences of "MAS" in all directions. I generally would have used loops for this, but I was in a rush so I just hard-coded everything. Quick and dirty.
#!/usr/bin/awk -f BEGIN { FS = "" total = "" } { for (i = 1; i <= NF; ++i) grid[i, NR] = $i } END { for (i in grid) { if (grid[i] == "X") { split(i, xy, SUBSEP) print(xy[1], xy[2]) x = xy[1] y = xy[2] # upper-left if (grid[x-1, y-1] == "M" && grid[x-2, y-2] == "A" && grid[x-3, y-3] == "S") total += 1 # upper-right if (grid[x+1, y-1] == "M" && grid[x+2, y-2] == "A" && grid[x+3, y-3] == "S") total += 1 # lower-left if (grid[x-1, y+1] == "M" && grid[x-2, y+2] == "A" && grid[x-3, y+3] == "S") total += 1 # lower-right if (grid[x+1, y+1] == "M" && grid[x+2, y+2] == "A" && grid[x+3, y+3] == "S") total += 1 # left if (grid[x-1, y] == "M" && grid[x-2, y] == "A" && grid[x-3, y] == "S") total += 1 # right if (grid[x+1, y] == "M" && grid[x+2, y] == "A" && grid[x+3, y] == "S") total += 1 # up if (grid[x, y-1] == "M" && grid[x, y-2] == "A" && grid[x, y-3] == "S") total += 1 # down if (grid[x, y+1] == "M" && grid[x, y+2] == "A" && grid[x, y+3] == "S") total += 1 } } print total }
Part 2
I was expecting to have to switch to a smarter approach, but this was even easier than part 1 for me. I locate A's and look around diagonally for M/S pairs.
#!/usr/bin/awk -f BEGIN { FS = "" total = "" } { for (i = 1; i <= NF; ++i) grid[i, NR] = $i } END { for (i in grid) { if (grid[i] == "A") { split(i, xy, SUBSEP) x = xy[1] y = xy[2] if ((grid[x-1, y-1] == "M" && grid[x+1, y+1] == "S") || (grid[x-1, y-1] == "S" && grid[x+1, y+1] == "M")) if ((grid[x+1, y-1] == "M" && grid[x-1, y+1] == "S") || (grid[x+1, y-1] == "S" && grid[x-1, y+1] == "M")) total += 1 } } print total }
-
Comment on Day 3: Mull It Over in ~comp.advent_of_code
Crestwave Pretty standard AoC stuff so far. AWK solutions: Part 1 Everything went pretty much as expected here, regex worked excellently. #!/usr/bin/awk -f BEGIN { input = "" } { input = input $0 } END {...Pretty standard AoC stuff so far. AWK solutions:
Part 1
Everything went pretty much as expected here, regex worked excellently.
#!/usr/bin/awk -f BEGIN { input = "" } { input = input $0 } END { while (match(input, /mul\([0-9]{1,3},[0-9]{1,3}\)/)) { mul = substr(input, RSTART+length("mul("), RLENGTH-length("mul()")) split(mul, arg, ",") total += arg[1]*arg[2] input = substr(input, RSTART+RLENGTH) } print total }
Part 2
I had to change my approach here for detecting the other operators. I probably could have made it more efficient by using
match()
all-around, but I took the quick and easy route by iterating over each character.#!/usr/bin/awk -f BEGIN { input = "" } { input = input $0 } END { b = 1 while (length(input)) { if (b) { if (input ~ /^don't\(\).*/) { b = 0 } else if (input ~ /^mul\([0-9]{1,3},[0-9]{1,3}\)/) { match(input, /mul\([0-9]{1,3},[0-9]{1,3}\)/) mul = substr(input, RSTART+length("mul("), RLENGTH-length("mul()")) split(mul, arg, ",") total += arg[1]*arg[2] } } else { if (input ~ /^do\(\).*/) b = 1 } input = substr(input, 2) } print total }
-
Comment on Day 2: Red-Nosed Reports in ~comp.advent_of_code
Crestwave Part 1 was fun, although I got stuck for a bit on part 2. AWK solutions: Part 1 Pretty simple. I calculate a multiplier using the difference between the first two levels and use it to convert...Part 1 was fun, although I got stuck for a bit on part 2. AWK solutions:
Part 1
Pretty simple. I calculate a multiplier using the difference between the first two levels and use it to convert negative steps into positive ones.
#!/usr/bin/awk -f BEGIN { total = 0 } { m = $1-$2 > 0 ? 1 : -1 for (i = 1; i < NF; ++i) if ((($(i)-$(i+1))*m > 3 || (($(i)-$(i+1))*m <= 0))) next total += 1 } END { print total }
Part 2
I spent a bit overthinking this and trying to create a non-brute-force solution, but it turned out to be much more complicated than I initially thought. I eventually gave up and just went for a simple brute-force, which did the job excellently.
#!/usr/bin/awk -f function check(a, p , i) { m = a[1]-a[2] > 0 ? 1 : -1 for (i = 1; i < p; ++i) if (((a[i]-a[i+1])*m > 3 || ((a[i]-a[i+1])*m <= 0))) return 0 return 1 } { for (n = 1; n <= NF; ++n) { p = 0 for (i in a) delete a[i] for (i = 1; i <= NF; ++i) if (i != n) a[++p] = $(i) if (check(a, p)) { total += 1 next } } } END { print total }
-
Comment on Day 1: Historian Hysteria in ~comp.advent_of_code
Crestwave Late to the party, so I'm sticking to my default and using POSIX AWK again as always. :P Quite an interesting day 1, I already had to reach for further tools... (details in part 1) Part 1 I knew...Late to the party, so I'm sticking to my default and using POSIX AWK again as always. :P
Quite an interesting day 1, I already had to reach for further tools... (details in part 1)Part 1
I knew the quicksort function I wrote way back for 2021's day 10 would come in handy again some day! For reference, POSIX awk does not have
asort()
norabs()
; they are available as GAWK extensions, but I've been too much of a purist to use them so far. Simple loops are usually enough to get me by most sorting-related problems, but I made my own sorting function for when they aren't quite enough.Most of my solution is just a pasted copy of my old
qsort()
then a couple of lines for the actual logic.#!/usr/bin/awk -f function qsort(arr, left, right, i, j, tmp, pivot) { if (left >= 0 && right >= 0 && left < right) { pivot = arr[int((left + right) / 2)] i = left - 1 j = right + 1 while (1) { do { i = i + 1 } while (arr[i] < pivot) do { j = j - 1 } while (arr[j] > pivot) if (i >= j) break tmp = arr[i] arr[i] = arr[j] arr[j] = tmp } qsort(arr, left, j) qsort(arr, j + 1, right) } } { left[NR] = $1 right[NR] = $2 } END { qsort(left, 1, NR) qsort(right, 1, NR) for (i in left) total += left[i] - right[i] > 0 ? left[i] - right[i] : right[i] - left[i] print(total) }
Part 2
Very simple changes for part 2.
#!/usr/bin/awk -f function qsort(arr, left, right, i, j, tmp, pivot) { if (left >= 0 && right >= 0 && left < right) { pivot = arr[int((left + right) / 2)] i = left - 1 j = right + 1 while (1) { do { i = i + 1 } while (arr[i] < pivot) do { j = j - 1 } while (arr[j] > pivot) if (i >= j) break tmp = arr[i] arr[i] = arr[j] arr[j] = tmp } qsort(arr, left, j) qsort(arr, j + 1, right) } } { left[NR] = $1 right[$2] += 1 } END { for (i in left) total += left[i] * right[left[i]] print(total) }
-
Comment on I just bought a 64GB iPad, anything I should know/do? in ~tech
Crestwave Another 64GB iPad user here. iOS has a very long-standing issue where deleting a file that is bigger than the available free space will instead move it to the system data, where it gets stuck in...Another 64GB iPad user here. iOS has a very long-standing issue where deleting a file that is bigger than the available free space will instead move it to the system data, where it gets stuck in an unusable limbo—you cannot restore it nor can you delete it directly. Over time, your system data will grow to overtake and suffocate your storage space; you will then desperately delete things to free up space, only to find that the system data only consumes it and grows further.
This is probably part of why everyone in this thread is aghast at your choice of "just" 64GB. Sometimes it misattributes it to other apps, which is quite fun as well. It's very thrilling to delete a 2GB app only to see the next app on the list magically grow by 2GB to compensate.
Thankfully, workarounds do exist to free up space, so it's important to be aware of them. They include restoring backups, downloading huge files, or turning off WiFi, setting the clock a year forward and rebooting.
Another thing to note is that there is only one browser engine available on iOS. All other browsers are simply frontends to the default Safari engine, so you might want to just stick with Safari unless you want certain integrations like tab syncing.
By default, the app store will ask for auth for every installation. This is configurable and you may want to set it to install free apps without permission if you feel like it. I find that having it on makes it easy for me to accidentally authorize payment for paid apps.
The camera's Live mode may be turned on by default; this makes it take a series of photos in succession to make a gif-like result rather than a regular photo, which takes up much more space. If you don't care about the animation, there's a setting in the camera where you can preserve the setting of Live mode. Then you can turn it off in-app and it will stay that way instead of resetting back to on every time.
Shaking your device will trigger a pop-up for Undo by default, which may be confusing the first few times it happens. You can make use of it or turn it off in the settings.
Double tap to select a word, triple tap to select a paragraph.
The iPad does excel at stuff like browsing, reading books and lightweight office work. Microsoft apps like OneDrive, OneNote, Office and Teams work very well (or at least as well as they usually do, anyway) so no worries there. Enjoy!
-
Comment on United States Department of Justice will push Google to sell Chrome to break search monopoly in ~tech
Crestwave From my understanding, it used Shadow DOM v0 specifically, which was an experimental spec and deprecated at the time of the article*. V1 was in-development at Firefox Nightly and could be turned...From my understanding, it used Shadow DOM v0 specifically, which was an experimental spec and deprecated at the time of the article*. V1 was in-development at Firefox Nightly and could be turned on with a config.
* I don't recall for sure whether it was deprecated at the time of the redesign, but as you mentioned, it was experimental and should not have been used. Malicious or not, I think it's clear that they design for Chrome as a target platform and give it preferential treatment. They would never adopt an experimental Firefox technology and put a 5x slower placeholder for Chrome.
-
Comment on United States Department of Justice will push Google to sell Chrome to break search monopoly in ~tech
Crestwave I am definitely in favor for dismantling Google's monopoly on the web, but I can't help but be puzzled by this decision. The article only mentions Chrome, so will Chromium remain as-is? It's quite...I am definitely in favor for dismantling Google's monopoly on the web, but I can't help but be puzzled by this decision. The article only mentions Chrome, so will Chromium remain as-is? It's quite a weird choice if so, since Chrome is basically Chromium with extra Google branding.
What would stop Google from making another Chromium-based browser to replace it? I doubt they would keep Chrome as Android's default browser if they sold it off. And who would buy Chrome? It doesn't have much to provide for someone who's not Google, other than the existing user-base.
-
Comment on United States Department of Justice will push Google to sell Chrome to break search monopoly in ~tech
Crestwave One infamous example was YouTube shifting to use a deprecated API* that was only implemented in Chrome, which made performance much worse (5x slower page loads) on other browsers. The linked...One infamous example was YouTube shifting to use a deprecated API* that was only implemented in Chrome, which made performance much worse (5x slower page loads) on other browsers. The linked article also mentions some examples of other Google services that have blocked Firefox and other browsers in the past.
* Yes, they moved from a completely fine implementation to a deprecated API.
-
Comment on In praise of Arcane season 2 in ~tv
Crestwave Spoilers Yes, they used Isha and the return of Vander to mend their sisterhood and enact a family reunion. But at the end of the act, Isha seems to unnecessarily blow herself and Warwick up using...Spoilers
Yes, they used Isha and the return of Vander to mend their sisterhood and enact a family reunion. But at the end of the act, Isha seems to unnecessarily blow herself and Warwick up using three hex crystals (the exact same thing Powder did), which could potentially put us back to square one. Hopefully the writers do something more interesting with it rather than just rehashing Jinx's transformation again. I do realize there's quite a lot of routes they could take in act 3 other than the obvious outcome, especially with all the crazy stuff that's concurrently happening.
-
Comment on In praise of Arcane season 2 in ~tv
Crestwave I'm glad you like it, though personally I have found it quite a mixed bag. I loved season 1 for all the reasons you mentioned and more; the writing was incredibly tight and every scene was woven...I'm glad you like it, though personally I have found it quite a mixed bag. I loved season 1 for all the reasons you mentioned and more; the writing was incredibly tight and every scene was woven together into perfection. Season 2 has some amazing moments and incredible animation as always, but it feels much messier. Still, I enjoyed it and will definitely be seated for act 3.
Complaints - Act 1-2 spoilers
There are so many plot-lines, with even more being introduced on the fly, and several of them are going in circles. I'm getting whiplash from how many times they spontaneously go back and forth between peace and war—whether it's Piltover vs Zaun, Caitlyn vs Vi, Vi vs Jinx, etc. Mel's scenes are really cool, but she's practically in a completely different show.
The entire point of season 1 was to kill off Powder and create Jinx, exploring and grounding the transformation in great detail before the final point of no return in the ending. But this season randomly reverses it with the addition of a new character, then seems to be reversing that reversal by killing them off.
Every song in season 1 was memorable and felt integral to the story, but here it feels almost shoe-horned in sometimes (with some exceptions, of course, like Remember Me) with the constant music video openings. The scenes move by so fast that you can't really take them in anymore.
-
Comment on Kagi Translate in ~tech
Crestwave Considering that it happily spits out many standard curses, I'm guessing that it's not necessarily restrictions like swear filters or instructions in the system prompt, but rather that its...Considering that it happily spits out many standard curses, I'm guessing that it's not necessarily restrictions like swear filters or instructions in the system prompt, but rather that its training data contained censored words as well as uncensored ones.
I personally think that translation is one of the few suitable use-cases for LLMs (they do it pretty well and support an incredible amount of languages), so I'm glad to see services like this being implemented instead of shoving AI in random places.
-
Comment on Steam game recording - available now in ~games
Crestwave Feature overview Previous beta discussion Seems quite well thought out; the timeline features and the ability to transfer video files through a QR or directly through the Steam mobile app...Feature overview
Previous beta discussionSeems quite well thought out; the timeline features and the ability to transfer video files through a QR or directly through the Steam mobile app especially look quite neat.
Also particularly excited for the Linux support, as most of the current "instant replay" options are not very efficient. GPU Screen Recorder is the current go-to option but it's a bit janky.
-
Steam game recording - available now
35 votes -
Comment on Valorant is winning the war against PC gaming cheaters in ~games
Crestwave (edited )Link ParentValorant does not work on macOS in any way, shape or form. As for LoL, this is their justification for not porting Vanguard to macOS yet: ...which seems an awful lot like the situation of EAC on...This gets to the crux of what I’d prefer. Actual proper isolation and sandboxing. Macs have made a similar great effort here, and it’s why Riot are fine having a significantly less intrusive solution on that platform.
Valorant does not work on macOS in any way, shape or form.
As for LoL, this is their justification for not porting Vanguard to macOS yet:
There isn't yet as much tooling on OSX for script development, although the "need" is growing. For now, Mac won't have Vanguard, but we've still got a few bullets in the chamber for when cheaters inevitably try to exploit this.
...which seems an awful lot like the situation of EAC on Linux.
-
Comment on Valorant is winning the war against PC gaming cheaters in ~games
Crestwave Don't worry, this kind of cheating is rare so it can be ignored for now. And when it inevitably grows due to other avenues for cheating being closed off, they can force their hand by requiring a...Don't worry, this kind of cheating is rare so it can be ignored for now. And when it inevitably grows due to other avenues for cheating being closed off, they can force their hand by requiring a camera focused on your face and another focused on your hands to play. AI can then track and analyze your hand and eye movements to see if it matches your input, thereby ensuring competitive integrity! Yay!
-
Comment on Apex Legends dev team update: Linux and anti-cheat in ~games
Crestwave Unfortunately, this was kind of inevitable when Epic made EAC available but refused to enable it for Fortnite. It was clear that they didn't trust the implementation and didn't particularly care...Unfortunately, this was kind of inevitable when Epic made EAC available but refused to enable it for Fortnite. It was clear that they didn't trust the implementation and didn't particularly care about making it more than a nerfed version of the Windows version.
As far as user-mode AC goes, CS:GO used to have a good reputation for their anti-cheating measures but seem to have completely lost it on the move to CS2. Overwatch (the game, not the CS review program) seems to be a better example currently; I can't recall seeing cheaters at all, although it might be biased by the fact that various abilities can counter good aim.
People say that cheaters just turn to subtle cheats, with mouse corrections that are realistic and inaccurate enough to mimic human movements. But personally, if a cheater's aim is weak enough that I don't even suspect they're cheating, it doesn't really ruin my experience. MMR will just place them in lobbies where their "enhanced" aim is completely normal, so they're kind of playing themselves.
-
Comment on Paper: Feminism in Programming Language Design in ~comp
Crestwave The Turing-completeness of HTML+CSS is actually quite controversial, since it requires user input. Repetition, whether its through recursion, loops, jumps, etc. is usually considered to be key to...The Turing-completeness of HTML+CSS is actually quite controversial, since it requires user input. Repetition, whether its through recursion, loops, jumps, etc. is usually considered to be key to Turing machines.
SQL was in a similar boat until SQL-99, which added CTEs and thus a form of recursion.
That said, there's a recent response buried in the thread you linked that operates through hover events, such that the user can leave their cursor and go hands-off during execution, which seems like a more convincing proof to me.
It used to a have a different thumbnail parodying typical YouTube strategy guides.