« first day (3610 days earlier)      last day (1227 days later) » 

12:14 AM
@RedwolfPrograms wait you already have 10 hats?
 
I guess so, yeah
 
yet none of them are interesting to put on?
 
I'm wearing Warm Welcome
This is an annoying hat
 
12:36 AM
oh right I still need to reload chat
 
1:15 AM
0
Q: The Missing Number

TheProgrammerQuestion: Given a String s of randomly-shuffled numbers from m to n such that -100,000 <= m < n < 1E9, your job is to find the number that is missing from the group. Note that the string can be (and generally is) randomly-generated/constructed, and the below cases are only an example of what that...

 
 
2 hours later…
3:01 AM
@RedwolfPrograms Husk, 4
 
3:12 AM
@cairdcoinheringaahing hmm that might work
 
3:29 AM
@Lyxal is Keg still a work in progress? esolangs.org/wiki/Works_in_progress
 
4:01 AM
@Razetime technically yes. But I've pretty much stopped working on it
 
4:19 AM
ah ok
might as well add Vyxal to it
 
4:50 AM
10m to AoC!
7
5
 
3
 
@Razetime why?
 
1
 
4:59 AM
get ready for my rank 27k
fucking game of life
 
3D GOL LMAO
 
And I never did finish writing my 3d array.map...
 
7/6
oh if you think 3d is bad...
 
Already?!?!?!?!?
 
dammit i knew i should've written an N-dimensional cellular automaton template
@RedwolfPrograms speed :3
zoom
oh well guess i'll code a cellular automaton template and hope it's helpful next year
wish i made my neighbor function multi-dimensional; not sure why i didn't :/
 
5:10 AM
3d gol...
 
heh just you wait
 
stop
ugh
 
what is wrong with my padding code
 
wait why do you need padding
actually nvm
 
@Lyxal its in progress right
@HyperNeutrino increases each iteration
 
5:21 AM
Part 1 first try!!!
 
yeah i forgot using sets isn't actually more efficient for this particular problem
since it's not really that sparse and the space constraint is tiny
 
bruh im doign so bad
imagine they told us to impl hashlife lel
 
what on earth is that lol sounds pain
 
553/561
pretty good for late start
 
@Razetime you mean add it to the wiki or to the Keg page>
 
5:26 AM
to wiki
 
APL is definitely the best tool for the job today
 
oh? does it have good functionality for like getting neighbors or smth
 
My part two is too slow
 
of course it does, otherwise why would there be hype on GoL written in APL in the first place
 
@HyperNeutrino APL has a builtin for 3x3 blocks of a 3d array
 
5:30 AM
LOL
 
@RedwolfPrograms same
cya in 200 hours when my solution finishes
 
I just optimized out a bunch of repeated calculations
 
wait i could've done my thing so much more quickly
might've been able got get an extra 1-3 points, potentially (part 1)
 
hyper smol brian
 
maybe one for part 2
@ASCII-only implying i have brain
 
5:36 AM
I finished with 236/982
 
that's pretty good
 
Would have done better at part 2 except I made a typo
 
i still haven't finished ;_;
 
Except for two days when I went to bed before finishing the problem (AOC unlocks at midnight my time), my worst rank is 1825
on day 9 part 1
 
5:38 AM
midnight would be annoying but i'm usually up til 4 anyway
 
Did both parts first try!
 
i did a few like the day after and two of them i started late but my worst ranks so far for ones where i started on time are 284/407
 
Wait, my rank for part 2 was exactly the same as my correct answer
 
oh wow
lmao
 
Day       Time  Rank  Score       Time  Rank  Score
 17   00:21:23   629      0   00:39:01  1206      0
 
5:39 AM
It's hard to get a wrong answer here, because there aren't that many subtle ways for things to go wrong in implementing life
 
yeah if your sample is right the answer is probably right
 
I didn't run the sample, too slow
It took me like 1-2 minutes per attempt, wasn't going to waste it if my result wasn't NaN
 
lel 799/1287
 
If 6 iteration for 3d/4d is too slow, there's a serious problem somewhere
 
wait how did the sample take too long lol
 
5:41 AM
It probably wouldn't have
But the real input did
 
By the way, this challenge may be the record for most nested loops I've ever written in one piece of code.
 
Same here
 
my 4d 8x8 runtime is like 1.5s
4... there's a chance i've nested more
 
if you don't shortcircuit once count reaches 4 it takes way longer.
 
unlikely, but idk i write shit code a lot
@ASCII-only i don't lol. that would've been smart
 
5:42 AM
Actually, it isn't, since I once made an answer that failed to compile because it hit the nested block limit.
 
@pppery And most number of individual loops for a single solution too
 
I didn't shortcut either.
 
My problem was data structures; I used a 4d array with a side length of 31
 
What did y'all do for storing it?
 
5:43 AM
I used a set of all active cubes
 
i used an array so it was slow
 
simple nested array, blazing fast
 
What lang?
Factor?
 
yes
 
should i spend some time making it fast
 
5:44 AM
JS arrays are slow I think, due to the memory optimization. A Uint8Array would've been 10x faster I'm sure
 
(Factor compiles the source code before running it, btw)
 
So does JS
At least V8 does
 
i used a set
and each time i found the set of neighbors and then counted, except i should've just accumulated the counts in the first loop
... wasn't v smart
 
my algorithm was like
 
ok im too lazy
 
5:46 AM
pad zeros in all directions, then add 3-chunks in all dimensions
 
I used a linked list of URIs pointing to Unix file systems which I FTPed for the index of the multidimensional array of floats which I used to store the unicode representations of the boolean values of the states of each cell, with a SHA-512 checksum and blockchain (plus jQuery to make it short)
5
 
recursive generators are fucking me up
the stats are making me depressed now
 
: life4d-pad1 ( x -- y )
  [ ] [ length 2 + ] [ first [ [ [ drop 0 ] map ] map ] map ] tri pad-center
  [ [ ] [ length 2 + ] [ first [ [ drop 0 ] map ] map ] tri pad-center ] map
  [ [ [ ] [ length 2 + ] [ first [ drop 0 ] map ] tri pad-center ] map ] map
  [ [ [ [ ] [ length 2 + ] bi 0 pad-center ] map ] map ] map ;
The beauty of hardcoding the dimensions
 
equivalent code in APL: (2 3 4 1⍉0,,∘0)⍣4
 
5:53 AM
I swear if I can't figure out why my grid is gaining a dimension on each iteration I'm just rewriting this in Haskell
 
wait gaining a dimension?
oof
 
this is the shape of the result for 6 generations from the glider example
[3, 1, 3, 3]
[5, 3, 1, 3, 3]
[7, 5, 3, 1, 3, 3]
[9, 7, 5, 3, 1, 3, 3]
[11, 9, 7, 5, 3, 1, 3, 3]
[13, 11, 9, 7, 5, 3, 1, 3, 3]
the...
the initial plane
isn't even growing
this homebrewed deep mapping shit is driving me insane
okay of course the pad function is the culprit lol
 
@Bubbler I'm having a bit of trouble figuring this out, do you mind checking my code?
 
no problem
 
nevermind I got it
I mistyped 7 instead of 6
 
5:58 AM
wat
 
yep lmao
ok 4 dimensions now
 
My source file for today has 44 copies of the word map
 
lmao. nice
 
and I'm pretty proud that I didn't make any error when solving part 2, except for a silly typo (lief instead of life)
 
now I'm losing dimensions
 
6:05 AM
 
pad seems to actually work fine this time so
...I forgot to not subscript its result
errors, gone
result, still 0
 
@Bubbler wait what
I have no experience beyond 2d
man
 
6:19 AM
my code seems to think this is a still life
.#
##
 
meanwhile, in my Factor code I found that life4d functions can be implemented using life3d, so the appearance of map is reduced to 25 copies
 
it is magically fixed after some slight refactoring
...it's probably python's wack ass scoping
the answer is still wrong but it's less wrong
 
python scoping can't be simpler than that imho
unless you're using classes and whatnot
 
or i guess a mix of scoping and closure mechanics
I forgot that... if the cell is dead... the cell is dead
 
6:35 AM
Day       Time  Rank  Score       Time  Rank  Score
 17   01:34:14  3827      0   01:35:24  3301      0
 
was hard carried by APL today
 
it may have taken me an hour and a half but at least part 2 was literally just adding a pair of brackets to line 5
 
I wonder how much participation will drop today
 
Protip: Don't try to visualize 3D arrays and beyond. Just feel them.
 
^
hey quick poll for python users
did y'all use numpy
because i feel like relearning numpy might have gone faster than [this](https://github.com/UnrelatedString/advent-of-code-2020/blob/master/aoc17.py)
now i'm just going to write a solution in fucking jelly in 10 minutes
 
6:42 AM
wait does jelly have a window builtin
 
yeah, I guess it's a breeze if you know the necessary numpy APIs
 
@UnrelatedString are you answering all the days in python?
 
@Razetime scan with the optional nilad is basically reduce over windows
@Razetime yeah
...okay actually I have no idea how I could make that work over more than 2d
the way I did it the last time I wrote GoL
 
i was thinking the same
 
f-each f-each-each f-each-each-each
 
6:46 AM
+3\Z$⁺_|=3
Z being the issue
 
In husk it's X3 repeated for n dimensions
 
ah, so build up the neighborhoods before summing them lol
 
yep
 
7:24 AM
0
A: Sandbox for Proposed Challenges

bigyihsuanHow Many Atoms? code-golfchemistryparsingstring Given a chemical formula as input, output the total number of atoms in the formula. Input A chemical formula. Chemical formulas are governed by the (E)BNF: <formula> = <number>? <group>+ <group> = <atom> | "(" <atom>+ ")" <subscript> <atom> = <symbol>

 
 
1 hour later…
8:26 AM
0
Q: Ken Iverson’s Favourite APL Expression?

Adám Ken Iverson, 1920–2020 Let's implement his favourite expression: Given a row of Pascal's triangle, compute the next row. This can for example be computed by taking the input padded with a zero on the left, and the input padded with a zero on the right, and then adding the two element...

 
9:11 AM
> Rep Hunter: 10 answers in 1 day with positive score
Sounds like Code Golf is the best site for that
(better chance if you do it in APL)
 
9:31 AM
in python, is there compact way to find the minimum of a list that contains numbers and Nones?
 
What is the range of "numbers"?
 
0 to 12
integers
 
min(x or 99for x in l)
no, it doesn't work with zeros
and Python version?
 
3.6
 
min({*l}-{None})?
 
9:36 AM
oh that's really obscure! :) So l is the list, {*l} extracts the elements and puts them in a set and then we remove None from the set?
 
Yes
 
thanks! There is no default for min right? I mean if l is empty
it just crashes
 
Yeah, it's an error
 
oh there is a default! min(iterable[, default=obj, key=func]) -> value
I had no idea
 
You can do min({99,*l}-{None}) if you want to get a high number (in place of 99) as default :)
 
9:41 AM
true :)
 
@Anush There's a reason the Python doc says "Library Reference - keep this under your pillow"
 
10:07 AM
0
Q: Convert all the newlines in a file from \r\n to \n

ToonAlfrinkInspired by what I'm doing at work right now. Your program should take one parameter, the path to the file It should convert all the windows style newlines (\r\n) to unix style (\n) and write the result back to the file

 
11:00 AM
bah, I have more secret hats than overt hats
and that's even if you include the dark mode hat, which you can't get on ppcg
(although interestingly it's the one that gets chosen for chat)
 
The social distancing hat reveals which sites I've looked at. Isn't that revealing personal info without consent?
 
@Bubbler does it really say that?
 
11:33 AM
@Adám yes
 
@Anush Ah, technically that info is always available in the form of the user's "🕓︎ Last seen" for each site.
 
hmm.. @Adám I was sad not to see an APL answer for codegolf.stackexchange.com/questions/216303/…
 
@Anush Too late?
 
no!
 
OK, I've asked for an answer in the APL Orchard.
 
11:49 AM
where is that?
found it
 
 
1 hour later…
1:14 PM
... and there's another secret hat...
hmm, my hat seems to be falling off...
 
 
1 hour later…
2:35 PM
CMQ: what is the highest amount of edits you've ever done on a non-meta post?
 
@Razetime How do we track that?
 
uh you don't
you just check your edit history on each answer I guess
mine is currently 11 on "Is it still life?"
 
@Razetime But I have 1246 posts!
 
maybe there's a query for that lol
 
3:02 PM
@Razetime Mine's 16, on a deleted answer. (Does Stack Overflow count?)
 
feel free to mention the name
@wizzwizz4 I guess so
 
“What does the Google Analytics.js code do?” – but I misread copyright law in my jurisdiction, and am no longer confident I'm allowed to publish something like that.
 
I forgot that privileges don't transfer over sites
 
@wizzwizz4 A bit out of context, but we've recently looked into that at my company, and it seem quite certain that running that code is prohibited by GDPR unless the user actively agrees to it, so simply including it isn't OK.
 
@Adám That matches my understanding of GDPR.
But everyone's using some third-party “looks official” pretend-to-get-consent system, so… :-|.
 
3:09 PM
In general, any inclusion of resources from 3rd party domains is outlawed, it seems.
 
That's not quite true.
 
0
Q: increment a binary number without arithmetic manipulations

EliminationInput: binary string Output: binary string that represents the binary input + 1 Example: Given 10111 as an input, output 11000 Limitations: Can't use arithmetic operators or functions

 
If you have a contractual relationship with the third-party domain that limits their data processing, it's okay.
 
Ah, true, but it has to be for all access to the included resource.
 
If a CDN's Terms of Service say “I promise I'm not collecting anyone's data”, my totally-unofficial not-a-lawyer legal opinion is that that's sufficient.
Assuming it's a legally-binding ToS, of course, which it probably is? I don't understand contract law.
 
3:11 PM
Because the user's browser will send a request to the 3rd party server, which can then log IP, without the user having consciously contacted that server, and so there's no consent for that logging.
 
@Adám It can, but if it's contractually obliged not to, then it's okay (afaik).
It's only if it does that it's an issue.
Otherwise those karaoke machines that show off televisions would be illegal.
 
Right, but unless one makes specific contracts, this rules out all sorts of CDNs, Google Fonts, ReCAPTCHA, etc. etc.
 
It rules out those, yeah.
But if there were ever a Mozilla CDN, with the usual “no tracking” stuff that Mozilla likes to have, I think that'd be fine to use.
 
"GDPR allows usage of resource X (which doesn't exist)"
@wizzwizz4 That page is clearly not GDPR compliant!
 
Hmm… Fair point.
 
3:18 PM
I've seen other such services claim GDPR compliance on non-compliant pages.
 
To be fair, the webpages are generally run by some kind of marketing team. I think BunnyCDN itself is compliant.
(That's no excuse, though.)
 
I've even seen websites for large companes with non-functional "GDPR" links. It seems common behaviour is to pretend that one is compliant just by mentioning compliance!
― Sir, you were driving 120.
― But officer, I have a speedometer!
 
@Adám Mind if I link your message in an email to BunnyCDN?
 
Of course not.
 
3:35 PM
2
Q: Compute the Redwolf Checksum™ of some data

Redwolf ProgramsI will preface this by saying that I made this for fun; I have absolutely no formal knowledge on cryptography or error correction. Do not use this algorithm in anything remotely important. I was kind of bored a few days ago, so I decided to write a simple function to take some data and return an ...

 
This is spam, right?
 
3:48 PM
@NewMainPosts This isn't cryptographically secure.
 
Nope, about the farthest possible :p
 
If I know a section of the plaintext, I can substitute it and produce a handful of hashes, one of which is the hash of the modified text.
Why “a handful”? Well, it's because the checksum is biased.
It's neat, though.
 
I made it mostly just for fun, although its intended use was just to give long chunks of text an easily memorable label. Not at all meant for crypto or error correction :p
Although, in what way is it biased? I made sure every outputted digit is equally probable.
 
@RedwolfPrograms No, you didn't.
> mod 256
> mod 36
 
And because 255 + 31 + 1 is the maximum value before mod 36, that's 287 which gives each one an equal chance
 
3:53 PM
Hmm… I missed that.
 
Since 288 is a multiple of 36
 
Overall, it's still biased, but the distribution of individual letters might not be.
That means I can certainly create modified hashes! Yay!
@RedwolfPrograms I don't think it's possible to end up with, say, 0001 as the output.
 
That is true, only about half of the length-4 outputs are possible
That might be fixable by using the 6th least significant bit instead of the lsb
 
@RedwolfPrograms It's impossible for you to produce an unbiased hash.
 
I feel personally attacked :p
 
4:01 PM
You can get it arbitrarily close, but if the number of possible hashes isn't a factor of the number of possible inputs, you can't give each possible hash an equal probability.
A power-of-two base would work.
That's why most people have one.
You can get arbitrarily close, but only if you keep as much information for as long as possible.
You do the “change base” operation after you've thrown away lots of information about the original input.
If you did it earlier, it'd be less biased.
 
Just brute forced every possible input to the size 4 one, it looks like every possible output is possible if you use the 6th least significant bit instead
But yeah, some are definitely much more likely than others
 
4:18 PM
Is there a built in way to get the whole AoC leaderboard, with anyone who has any amount of points?
 
That would have over 100 000 lines...
 
@WheatWizard > and this one count negatively against you
Unfortunate typo.
 
@JohnDvorak No, only with people who have top 100 on any day
 
Uh yeah Thanks I will have to edit that.
 
That's probably around 5-10k
 
4:24 PM
You could scrape them day by day
 
@Adám Do you have a link to it?
Ok I found it
 
 
4 hours later…
7:59 PM
Yes! Hit top 25 for the hat game
 
Does anyone know if you can keep the Mariachi secret hat if people unstar your message in chat? If so, can y'all star this message?
 
Use the room they made for the hat
There's a link in the winter bash room
 
Thanks!
 
8:37 PM
0
Q: Quine in zero lines of code

TheOnlyMrCatInspired by this challenge about creating a "Hello, world!" program which the npm tool sloc considers to have no lines of code, I thought it would be interesting to have a quine challenge around the same idea. Quoting directly from the previous challenge, NPM's sloc is a moderately popular tool ...

 
8:51 PM
CMC: Given two arrays, determine if they are identical. The arrays may contain arrays, but if fully flattened, all elements will be integers.
 
9:17 PM
@Adám Jelly, 1 byte
 
Yes, yes, and APL has but I want to see what non-array language solutions look like.
 
Would [[1,2],[3,4]] be considered different from `[[1],[2,3,4]]
 
@RedwolfPrograms Yes. The arrays have to be identical.
 
@Adám I'm just fulfilling my mandatory "check PPCG today" :P
 
Sure.
 
9:19 PM
If there's a question without a Jelly answer, I must provide one (barring laziness) :P
 
@cairdcoinheringaahing Aren't there things Jelly can't do? Or can it call out to Python in a worst-case scenario?
 
@Adám Well, it's Turing complete, but in the absolute worse case (file systems for example), Jelly can just evaluate as Python
 
@cairdcoinheringaahing I was thinking of things like GUI, network communications, multi-threading, etc.
 
@Adám It does have a GET command, but beyond that, I don't think it can do anything of those
 
@cairdcoinheringaahing But it can evaluate arbitrary Python, no?
 
9:24 PM
@Adám Yeah, by "can't do" I mean it doesn't have the builtin capability beyond using the ŒV (Python eval) command
 
OK.
 
@Adám Also, I can't speak for other Jelly coders, but I personally would rather just not post a Jelly answer than post a "compressed Python code eval'd" answer
 
7 mins ago, by caird coinheringaahing
If there's a question without a Jelly answer, I must provide one (barring laziness) :P
 
@Adám s/laziness/low-effort/ :P
 
@Adám #'equalp
 
9:29 PM
o.O I have done almost nothing since hats started and I have 4 secret hats + the social distancing ones :/
 
@Wezl What language is that?
@cairdcoinheringaahing My boss used ∘.○ in a presentation just a couple of hours ago.
 
@Adám Ooh, I reckon I can guess what that does
 
@Adám common lisp -- comparisons are so weird
 
. is the "outer product" "quick" in APL, and is compose, so I'm guessing something like creating a table of results for a given function?
 
you can use eq, eql, equal, =, equalp, string=, string-equal, char=, and char-equal
 
9:32 PM
@cairdcoinheringaahing Your conclusion was right, but the reasoning was wrong. Go figure.
 
@Adám What should the reasoning be?
 
@cairdcoinheringaahing There really isn't much. ∘. is special syntax, unrelated to both . being outer product and being compose. But indeed, it does compute a table of results for the function on its right, the function in this case.
 
@Wezl and they all do different things
 
@Adám From my limited APL knowledge, is trig functions/related stuff right?
 
Correct. Things relating to the unit circle.
 
9:35 PM
What was the full context of ∘.○, if you don't mind my asking?
 
#'_ is syntactic sugar for (function _), which in turn means the function with the name of _
 
@Wezl Ah. OK.
@Wezl Yikes. APL just has = and , even though one of the two is sufficient. Which one depends on the exact APL dialect.
@cairdcoinheringaahing This
 
@Adám That's not a bad CMC/main challenge. "Produce this nxn array, given n"
 
Draw a circle. Have we not had that?
 
It looks to me more like "draw the borders, except for the corners", rather than a circle
 
9:40 PM
Increase the number 5.
 
@Adám Ah, I see
 
9:52 PM
CMM: Do we have a consensus on (re)posting Advent of Code challenges? Do we need one?
 
Same as with reposting anything else, no?
 
@Adám It does come somewhat with the spoiler effect
 
0
Q: (Almost) Solve Fermat's Last Theorem

caird coinheringaahingIt's a well-known fact that Fermat's Last Theorem is true. More specifically, that for any integer \$n \ge 2\$, there are no three integers \$a, b, c\$ such that $$a^n + b^n = c^n$$ However, there are a number of near misses. For example, $$6^3 + 8^3 = 9^3 - 1$$ We'll call a triple of integers \$...

 
You don't want to open up PPCG for the day, just to find a challenge posted that spoils todays AoC that you haven't done
 
@cairdcoinheringaahing I wouldn't re-post while the original competition is still ongoing, to avoid questions about "outsourcing".
 
9:55 PM
Wait, @RedwolfPrograms how do you have 11 hats? Shouldn't you have 12, because you get Milliner once you get 11?
@Adám Yeah, but it might be nice to have a definite consensus on such a thing (or for more general coding competitions outside this site) if we don't have one already
 
@cairdcoinheringaahing chat.stackexchange.com/transcript/message/56467873#56467873 some hats were taken away because of bugs
 
10:36 PM
I had 13, I guess some were removed
 
 
1 hour later…
11:51 PM
@RedwolfPrograms on which site do you earn the hat for a starred message in chat?
ugh, why won't SO save my hat preference?
 
0
Q: Formal Verification_How to create a counter that counts the number of times a variable has the value 1 mod 8

MiaImplement a system that simulates a counter (modulo 8) interacting with the environment as a binary model for Xchek and a set of properties. Build a model for the counter that counts the number of times a variable has the value 1 modulo 8 with binary variables in GCLang. In other words, one of yo...

 

« first day (3610 days earlier)      last day (1227 days later) »