« first day (2670 days earlier)      last day (564 days later) » 
02:00 - 20:0020:00 - 00:00

2:15 AM
This problem just occurred to me: How can you maximize the number of unique substrings of a bitstring of length n?
2:42 AM
@EsolangingFruit I'd imagine slicing the optimal substring would be optimal (or close to)
2:57 AM
^ above CJam script brute forces for n = 10
the answer is 1110100111, which is not at all obvious to me
@EsolangingFruit O_o 111 two times?
actually, there are 80 different answers tied for first (34 unique substrings)
that one just happens to be the lexicographically largest
for n = 17 it's 11110110010100011
@ASCII-only A bitstring of length 10 necessarily has 8 substrings of length 3. This one has 7, and one is duplicated. It's not that strange.
3:19 AM
@EsolangingFruit brute force
@LeakyNun Certainly that is a way. But is there a faster method?
use a neural network
Would NNs even be a good choice for this? It doesn't seem like making a small change to a bitstring necessarily corresponds to a small change in the number of unique substrings
Well, actually, I guess it does when n gets large
just find a local maximum
I wonder if there's a way to find the optimal bitstring in polynomial time though
looks like it's A094913
3:34 AM
@ASCII-only Careful, that leads to clbuttic mistakes.
@Dennis >_> \b should fix that basically all the time shouldn't it
side note: LINE Webtoon makes this mistake for their comment section >_>
With \b, you don't get dumbbutt.
@Dennis shouldn't that be in the swearword list anyway though
@ASCII-only Only if you think people swear with perfect grammar all the time
in which case you might want to specify which alien species you're referring to
@EsolangingFruit well then add some fuzzy matching
3:46 AM
An exhaustive list of swearwords? Good luck.
(fun fact: I pasted that link without knowing that that was the correct video, because my computer's YouTube filter blocked it)
@Dennis well it will certainly not be exhaustive, but a decently sized (say, 20-30?) should filter most of it out unless people are deliberately trying to get around it
@EsolangingFruit :|
Because nobody would ever try to get around censorship.
4:05 AM
> Noun. clbuttic (uncountable) A type of error in which some bowdlerizing software garbles words by replacing objectionable words that occur within a word with tamer alternatives, such as the erroneous correction of "classic" to "clbuttic".
@EsolangingFruit Then don't paste it :|
Oh lol, now YouTube has it's own messenger. Google now has, like 8 different messaging apps.
1 hour later…
5:28 AM
CMP How do you debug Brain-flak programs?
with... wait for it
great difficulty
that joke never gets old
(ok I figured out my problem, I forgot to push after popping)
Making a MCVE proves to be useful.
5:45 AM
@EsolangingFruit then how did you get the link
@user202729 Bottom-up. Format everything nicely with comments, test the smallest pieces alone first. Check for stack cleanliness.
Is there something you need help with?
No problem, I solved it.
@H.PWiz sorry I forgot to mention, every second term of that oeis is the sum of the first n of 1+2^2+2^4+..., so that's why I use 4^2n
6:16 AM
@user202729 Personally I wrote a brain-flak interpreter that goes through the code step by step with a visualisation of each stack (as well as the working stack) at each step
6:56 AM
When you do need conditional, Dodos is terrible.
7:14 AM
Very interesting, but terrible.
It's extremely annoying that most simple challenges require negative number support, although that's completely unrelated to the challenge.
Or strings. :/
7:32 AM
@user202729 wait really :|
See? This requires negative number. That's annoying.
This doesn't require negative, but require O(n log n). If taking the head of a list is linear in Dodos, how can it sort in linearithmic...
Hm. @Dennis (in Dodos) Would special-case subtraction to take O(1) arithmetic operations be a good idea?
@user202729 That one is Lembik's ... well ... expected restriction.
But.... mergesort is O(n log²(n)) bit operations anyway.
7:48 AM
maybe Dodos should get better optimizations :P
@user202729 well actually no. that's not a stated restriction, so since Dodos doesn't have negative numbers as a builtin type IMO it shouldn't be needed
But the test cases...
That's what happen with underspecified challenges.
@ASCII-only Optimizing Dodos is very hard.
Mar 15 at 15:35, by Dennis
@user202729 Easier said than done. Results may depend on the call stack.
Probably make a challenge "Interpret Dodos as fast as possible"?
Should be easier than interpret Fractran or BF? ... (I guess....)
@user202729 well the thing is. what if you optimize the call stack
@user202729 BF is easy
most languages can eval-terpret
see code-golf.io
@ASCII-only sigh I don't think compilers are smart enough to multiply by 171 modulo 256 from the code [--->+<].
Just try it.
@user202729 ah, you mean interpret BF as fast as possible
then Tritium should come close, I think
8:04 AM
Looks interesting.
@dzaima That looks intriguing.. what are you discussing?
@dzaima Compilers are very smart, indeed. Explains the loooooong compile time.
@user202729 that's clang. GCC didn't do that
8:09 AM
how does it know not to loop?
@Anush Whether C compilers can optimize BF code [--->+<].
1 min ago, by user202729
@dzaima Compilers are very smart, indeed. Explains the loooooong compile time.
sorry I am being stupid.. in C does while(a) loop as long as a != 0>
@Anush that's just regular c++
@dzaima ok but my c++ is poor... why doesn't while(a) loop until a==0?
8:12 AM
@Anush Compilers are free to do anything as long as the as-if rule is kept.
@Anush it does loop until a==0. And my c++ is poor too, I've just luckily watched many c++ optimization youtube videos lately :p
@Anush And some modulo arithmetic.
(because 3 is coprime with 256, and the modular inverse of 3 modulo 256 is 171 ≡ -0x85 (mod 256))
have you got a non picture version? that is a url to godbolt?
@Anush ... just type it in yourself ...
@user202729 thanks! :)
8:14 AM
@Anush can't find a permalink button in it :/ here's the code to save you some time
oh there it is
@user202729 that code has a loop
so it seems that clang can compute how much to increase b++ by.. right?
8:18 AM
@user202729 oh right that's a jumpahead not back
my assembly is poor too :(
@Anush my assembly knowledge is non-existent but here my logical sense is what broke down :p
what does mul cl do?
it only has one argument
@Anush over over mul
@Anush ... why don't you learn some assembly ...
Multiply al with cl, store to ax.
8:20 AM
what does over voer mean?
oh ok..
@user202729 I am .. just very very slowly :)
(although I have no idea why gcc need to gen the branch)
but mostly because I never code in assembly
Changing it to a do-while loop eliminate the branch from both version.
@user202729 I used to report this sort of thing to the gcc bugzilla
@user202729 that's not the BF then though
8:22 AM
so what on earth is ICC doing? godbolt.org/g/RtAUBD
that is looping, right?
@Anush mhm. B1.3 is getting jumped to from L8
@Anush Why do you expect compilers to be very smart...
@user202729 Hm... I am not sure I exactly expect that
but it is interesting when they are differently dumb :)
@dzaima I am guessing jne means that it loops until a == 0
@Anush I am guessing too.
so it's the worst .. which is interesting as icc is always sold as the best optimizer
8:27 AM
@Anush The problem is nobody in real life would write such code.
@user202729 that's a good point. I suppose the question is there there is real life code for which this optimization helps
one thing that annoys me personally is how terrible clang and gcc are at complex arithmetic. ICC is way better
I even contacted the gcc devs whose reply was more or less "Who on Earth uses complex arithmetic" :)
@Anush Complex as in √-1 or "long expression"? (example?)
why is this that optimized I don't even know.
@dzaima Probably a good thing. Saves you from memorizing complex sumamtion formulas.
@dzaima because it's an optimizer.
8:35 AM
For example. Also works with 3rd degree.
Guess I never need to memorize summation formula again.
huh so this works too. Now I'm just here being amazed at compilers.
Now I can't read assembly too. but I can google them. ...
@Anush well they are always competing for fastest compiled programs
@ASCII-only right... but gcc/clang don't care about complex numbers :(
@user202729 the point of my example is that it isn't vectorized
8:40 AM
I can't read fp instructions anyway...
I was wondering if there was some way to ask a simd question on ppcg
I guess not many languages give you control over the assembly produced
@Anush Language specific challenges are frowned upon...
@user202729 Do you know any more detail of this frowning?
I mean most code-golf challenges are really just competing <5 different golfing languages
so are in some sense language specific
and most fastest-code ones similarly are competing <5 languages
22 hours ago, by Mr. Xcoder
And that's why we encourage intra- and not inter-language competition
anagol encourages intra more effectively than ppcg
8:43 AM
another golfing website
Q: J and GolfScript suck all the enjoyment out of Code Golf

TimwiI have found code-golf a fascinating pastime for several weeks now. However, I’m already losing interest because the contests allow any language, and because of that it is pretty much impossible for anything other than J or GolfScript to get anywhere close to winning. As soon as I see a less-tha...

8:45 AM
hmm.. I can't even find the code on that site
how do you find the python code, say, answers to golf.shinh.org/p.rb?Non+Unique+Arrays ?
are they not publicly viewable?
> the server will not save your submission
ok.. weird :)
@Cowsquack same with code-golf.io :P
why would anyone use that website?
@Anush they are saved for non-endless problems though
8:48 AM
however in challenges like these golf.shinh.org/p.rb?Branching+Computations you can see them after 2 weeks
@Anush to compete...
ppcg seems much better
@user202729 J is a practical language :|
@Anush not for competition...
@ASCII-only Dont' tell me, tell Timwi about that.
@Anush I do like the endless problems, it is a direct competition in golfing skill, normally in ppcg once I see another answer in the same language, I don't give it a try at all, but it doesn't happen in anagol
8:51 AM
@Cowsquack (who says that you can't post another shorter solution?)
it still discourages me anyways, most of the times anyways
@ASCII-only true
I'm stuck in code-golf.io now
the last few bytes are the hardest to golf
I thought that new thing about not accepting any answer on ppcg was meant to address this
I should probably not admit that I don't like code-golf at all anyway :)
I like the PP part of PPCG
well I love clever succinct solutions
but not the part where you just make it unreadable :)
I like it when there is an intersection between cleverness and golfiness, like here codegolf.stackexchange.com/a/114113/41805
@Cowsquack :| yes. that's the same with any language >_>
basically all my submissions are >2nd
9:04 AM
i have two perl solutions off by 1 byte >_>
and since they basically don't use braces/parens that basically means a rewrite >_>
you should see my submission dump >_> i have so many solutions withing 1 byte of each other
js fizzbuzz is one that particularly bugs me
@Cowsquack same as all the lisp ones
because they probably have a shorter way to print but idk what they're using >_>
here's the js section on anagol for fizzbuzz golf.shinh.org/p.rb?FizzBuzz#JavaScript
56=30/26, 58=27/31
9:50 AM
@BMO I hope so
Feb 6 at 2:05, by Grace Note
@totallyhuman Here's the real deal - I got poked about this earlier and while I did reply, I didn't actually answer the question properly, oops. At any rate - consider it noted for review.
A lot of moths have passes since and this should really be trivial to enable...
@Mr.Xcoder because of all the moths?
In case it is unclear, I meant A lot of moths have passed since; enabling this should be trivial.
Typo >__>
10:14 AM
@Mr.Xcoder Should it be "months"?
Yeah. Hence the Typo >__>
A: Sandbox for Proposed Challenges

Sam Dean99 bugs in the code The adaption of "99 bottles of beer on the wall" for computer science where the bugs increase instead of the bottles decreasing is often re-posted around the internet. Example T-Shirt Here. I think it'll be interesting to see recursion and random number generation across a h...

Nobody else star orlp's "interesting problem"? :(
@NewSandboxedPosts Should I tell the OP that "you don't have to accept an answer", or just leave it as is?
10:36 AM
@Cowsquack me too!
10:53 AM
@user202729 You totally should, most of the time there's no point in accepting answers.
11:04 AM
@Mr.Xcoder I didn't see that one and thought it has been forgotten since February.. Then again this was over a a month (or moth?) ago too. I doubt that this would be a lot of work, but maybe I'm wrong.
Q: Returning -2^25 back for an empty color

andreasThis is a real problem that I just encountered. I am using a proprietary API that somebody else has created. There is a call to get the color of an object. The color is denoted to be of type uint in C++. The documentation of the API does not say anything about the value to be returned for obje...

it's so quickly closed NMP is so slow...
12:14 PM
CMC: Given the mana cost of a Magic: the Gathering card, return its CMC (Converted Mana Cost). X is considered to be 0. e.g. "3RR" -> "5", "11G" -> "12", "XRR" -> "2", "WUBRG" -> "5"
@Dehodson So, X=0, letter=1, number=number?
@Emigna Yep! Technically there are other symbols but those are the only ones needed to be handled.
upper-case required?
@Emigna You can assume that the letters will always be uppercase. The only ones that will appear are "X" and "WUBRG".
@Emigna For "15" I got "6". Sorry for not mentioning a test case with only numbers D:
Ah :)
@Dehodson 05AB1E, 12 bytes: AuS¡Osá'XKgO
12:27 PM
@Emigna Nice!
@Emigna: 11 bytes with á instead of Au
@H.PWiz @Cowsquack Beautiful argument, without taking 2 separately and without using modular arithmetic.
12:44 PM
@Emigna I think this 8 byte solution works for all valid M:tG mana costs þsá'XKgO
1:06 PM
@Dehodson Can't you have more than one number? I.e. is 15GW3 invalid input?
1:19 PM
@Emigna In Magic, all the numbers come front loaded such as "5WR" or "XXRR" or "10WWGGG". Sorry for not being more specific in my original problem statement, I didn't stop to think about all the assumptions that come with knowing what is and isn't valid in the game.
Okay, then your 8 byte version works. :)
1:33 PM
@DJMcMayhem In fact there are three answers containing \$ that are not in <code>-tags, however one of them tries to use MathJax, so 2 answers need to be fixed :)
These answers would be: 23089, 59050 (tries using MathJax) and 138058
I used this script (tio-link is too long) and the csv-data from this query
@Dehodson Retina, 9
Oh, the input should have been X3RG in fact
But does not invalidate the answer
@TwiNight Fails on multi-digit numbers
@user202729 "Subtraction" is already special-cased. Try it online! Dodos could use a lot more optimizations though.
@Dehodson: What about costs like {G/U}?
@Emigna Oh multi-digits
10 bytes then
1:46 PM
@BMO See this message, I thought about including things like {2/W} and {W/P} but decided against ;p
Oh, missed that one..
@BMO Would be interesting to see a version that handled that though!
Yeah, you could post that to main.
I just wondered what card has the highest CMC.. This is ridiculous, haha
14 bytes handles all current on black border cards
*mana costs currently on black-border cards
2:10 PM
Actually I don't think there is {1/2} in mana costs even in silver border
@TwiNight Little Girl costs half a white mana
I see people talking about Magic in here. Today's a good day, it seems.
Ahh, I knew I have seen a 0.5 cmc card somewhere
Now I want to make new decks..it's been such a long time since I last played.
These new C manas are quite weird..
@BMO nah, they're just the same thing with a different representation. The only true difference is that you cannot pay for {C} with colored mana. But now, every land that generated {1} (or more) will generate {C} (or more) instead.
2:26 PM
Ok that makes sense, it's still a bit weird when you're used to the 5 basic lands and colorless mana though. But I guess they had to make it a bit more difficult for all those crazy Eldrazi guys
@AdmBorkBork APL 9: ⍸¨1 0=∘⊂= CC @EriktheOutgolfer @dzaima
@BMO yeah, but once you get it you'll see that basically nothing has changed other than the newer Eldrazi dudes. And yes, they were as unbalanced as they could possibly be, especially for standard.
@J.Sallé Not really "instead". They have always generated what we call C now. It's just we have a different symbol for it now
@TwiNight yeah, that's what I meant. I should've said something like "have 'add {1}' printed will now have 'add {C}' "
2:42 PM
Q: Generalized Cantor set segment lengths

AngsProblem Let's define a generalized Cantor set by iteratively deleting some rational length segments from the middle of all intervals that haven't yet been deleted, starting from a single continuous interval. Given the relative lengths of segments to delete or not, and the number of iterations t...

3:18 PM
Q: Determining Yes or No?

SquareootAfter inputting a string [length 1-20], only cotaining the chars y for yes and n for no, your program should output the result (y or n). Example input: yynynynny =y The result is determined by combining the y's and n's in the following way: yes and no equals no yes and yes equals yes no and no...

3:31 PM
@TwiNight 17 bytes is as short as I could get with 05ab1e, maybe someone more experienced could golf this down: ðì'/¡vy¦Dþsá'XKgO
C#'s lock keyword is excellent, I wish more languages had it.
I'm still not quite sure how to guarantee an object in, say, python is only accessed by a given thread for a certain amount of time.
@Pavel What does it do?
@Adám lock (Foo) { /*This is the only thread that can access Foo until the end of the block, all other threads will wait. */ }
@Pavel So it is a temporary property of the function itself? Or is it a special way to call said function?
@Adám Foo is an object. Let me give you a (bad) example from some code I just wrote for a game:
foreach (var player in Players) {
                    lock (player) {
While a player is updating, the thread that fetches it's status from the server will wait for the update to finish.
Otherwise, two threads would write to it at the same time, and the object could get mangled.
3:40 PM
@Pavel If I understand your code right, the equivalent Dyalog APL is:
 :For player :In Players
     :Hold player
         player.Update Timing.UpdateTiming.Dt
That looks right
Which is lovely
@Pavel I think it may need a between :Hold and player. I have not really used :Hold.
@Pavel What if you just want an arbitrary lock, not tied to any particular object?
@Adám Then you'd generally have something like object MyLock = new Object(); and set locks on MyLock.
Even if you don't actually access properties of it.
@Pavel Ugh. :Hold can take any character scalar/vector/vector-of-vectors, so you can just make your own signalling system.
@Adám In C# locks are stored in a table of metadata that holds objects for the purpose of stuff like garbage collection. As such, you can't lock value types, only reference types.
Though you could lock a string or list
Just not characters
Oh, you didn't say characters. My bad.
3:50 PM
@Mr.Xcoder nice, but I wonder if HPWiz's suggestion of using bases would also work
@Adám There are data types built specifically for concurrency in the standard library you can use.
@Pavel Fair enough, but isn't it a bit silly to have duplicate data types just for parallel programming? What about other paradigms — do they need their own types as well‽
@Adám Lower level languages like C just aren't thread safe and require you build thread-safe systems yourself from the ground up. Higher level languages might gurantee thread safety for certain types, but then you end up paying the cost in performance for when it isn't necessary.
@Pavel OK, I guess that's a good argument when performance is key. However, for the everyday programmer that just needs the job done, the added complexity (in programmer-hours!) of additional types is probably worth the hit in performance.
C# (and Java, and other languages of a similar level) sit in that spot where performance is critical enough that having multiple implementations for each basic type for many common usecases is neccessary, but not so critical that the programmer makes custom types for his individual usecase.
3:58 PM
@Pavel I didn't know that. Thank you for teaching me.
@Adám Well no, because you still have your basic "use this if unsure" type. While you're working, you can just use List everywhere, and then later switch to a different kind of list if you realize it'll be faster, without much difficulty since all the provided lists implement ICollection.
@Pavel But you still have to know and think about all this.
I sure don't.
I could think about which list would give me the most performance, but I generally don't care.
I actually faced a problem with that in C#
4:01 PM
When implementing a Queue, the method names were quite a bit different to what I was expecting
That being Queue.enqueue and Queue.dequeue
Queues don't satisfy the IList<T> contract
and that's a good thing generally
If you could index into them like a list, you would defeat the purpose of using a Queue.
They don’t, but the point is that changing from a generic List to a queue was more fiddly than expected
Also, indexing methods may be the greatest thing C# has over Java
The whole point of using a queue instead of a list is that it supports fewer operations.
And operator overrides in general
@recursive and it’s faster, because of an expected data structure
4:04 PM
My code is just IEnumerables of IEnumerables anyway :P
@ATaco Yes, it's less capable, but faster for those cases it can handle.
Indexing the first entry of a Queue should always be O(0), much like indexing the top of a Stack
@ATaco O(1)...
(I used it in this particular case to buffer messages sent to a server)
O(0) would be done at compile time I guess
4:05 PM
@user202729 oops
Earlier today I wrote a line of code that had 13 chained Linq calls together.
I’ve still yet to touch linq
That's probably too many.
Linq is great.
4:06 PM
I’m rather glad I gave C# a go
It infinitely better than Java
Linq is one of my favorite parts of C#
I have an evergrowing list of Enumerable extension methods I bring with me to every project I work on.
I should once start using C#. My brother keeps telling great things about it, TNB does it too. But I don't have anything I could write in it, sadly.
@Pavel similar to morelinq?
Write an esolang, always fun
@ATaco Grammar error again...
4:09 PM
@recursive Exclusively my own stuff, I already inlcude morelinq in everything.
Oh no, now I can’t edit it
Blame the IPhone
4:20 PM
How can I golf lambda a,b:a!=b with Python 2?
do you know the types of a and b?
bool.__ne__ doesn't work :(
@recursive: It's in a reduce and changes
Wait, I think that even makes my submission invalid..
Coconut, 2 bytes: !=
@BMO: I don't think that part can be golfed in isolation. But reduce is often a good golfing candidate IMO.
@Pavel That looks like an awesome language, thanks!!!
4:24 PM
It is!
It's like Python, but better!
Yes :)
I always wanted sane (syntax-wise) partial application for Python and algebraic datatypes are pretty nice too.
Also pipes
Why did I not know about it earlier..
Pipes are nice
@recursive As in it's short or it could be replaced if smart enough?
4:27 PM
@BMO Because no one uses it :P
I mean to say that reduce can often be changed to something else shorter
particularly if it uses a lambda
The only problem I have with coconut is that the compiler is rather slow
but it's hard to say without seeing the whole expression
@recursive It was invalid anyways because of that exact reason that the types became bool and str and the comparison didn't yield useful results.. Oh well, I think I'm no good at golfing with Python
@BMO Try golfing in coconut :P
4:37 PM
@Pavel I will :D
Just installed it..
I'm in awe, though I'm wondering why nobody seems to be using it..
@Pavel Is the generated code at least usable? Or is this just too good to be true?
@BMO It's totally usable, and it's compatible with every version of python since 2.5. (You can specify later targets for things like async)
I think the reason it's not used very much is because there's no tooling.
No text editor properly supports coconut syntax hiliting, there is a pygments hiliter and a sublime text package but they're both broken.
@Pavel ahem
@DJMcMayhem Yeah. I've used it. It's broken.
Lots of minor bugs that ruin the experience.
For example, last I checked fstrings f"" aren't supported and cause the string literal to appear to continue until the end of the file.
4:47 PM
@DJMcMayhem sometimes I feel like I should start golfing in python
Is there a way to convert string to integer in Jelly?
eval (I think)
Not regular eval?
Uneval is like stringify
4:56 PM
I misread the question
Thanks! :)
5:42 PM
Q: Find the longest line(s) in an image of the same color

haykamI was inspired by a graphic of the longest interrupted lines on a pixel art site: (image credit to JadeX#1046 on Discord) So for this challenge, you must take an input image and output the top straight lines in the image, including the start position, end position (dx and dy), length (l), and...

1 hour later…
6:59 PM
Can you ping office.com? I'm getting 100% packet loss and can't open the site - but everything else.
Same here
Their status page seems unimpressed.
--- office.com ping statistics ---
7 packets transmitted, 0 received, 100% packet loss, time 6158ms
The site works fine for me though
As does traceroute
7:02 PM
I can only access outlook.office365.com, but not e.g. excel.office.com. The one time I need it.
If I use the office start menu to navigate to excel online, it works. Well, go figure.
7:37 PM
@mınxomaτ PowerShell, 15 bytes: ping office.com Tried hard to golf this one further but I've hit a wall. Up to chat now
02:00 - 20:0020:00 - 00:00

« first day (2670 days earlier)      last day (564 days later) »