« first day (2902 days earlier)      last day (2236 days later) » 

00:12
Hmm, I wonder if a Cheers to the Governor KotH could ever work. It's a drinking game where you take turns counting to 21 but you say 14 instead of 7 and 7 instead of 14, and every time you make it to 21, you implement a new rule for one of the numbers. Messing up means taking a drink and starting from 1
You can substitute actions and phrases as well for numbers in the game but making that into a satisfying KotH seems tricky.
Sounds like Mao but with more poison. :P
00:42
Mao would be fun to play with bots except for the implmenting rules part
01:02
Agreeing to play Mao once was the worst decision I ever made
I'm still salty about it and this was two years ago
@Pavel Mao is the best card game hands down
 
1 hour later…
02:15
@quartata any tips on implementing a malloc
@Downgoat Yes, link libc instead
can't doing WASM
Hold on I saw this on hacker news recently
Malloc for WASM
Found it
Apparenty like all of LLVM's WASM source is undocumented so time for source code dumpster diving T_T
02:56
hmm seems like that sort of implementation will lead to a lot of fragmentation with splitting chunks at a threshold of 16
03:12
LLVM wtf is the difference between memory.grow and grow.memory
real_realFoo comes to mind
 
2 hours later…
04:49
Oh no, guest271314 has been banned from asking questions? How "terrible".
Pour one out for the fallen
the ban at PPCG is not related to the Politics SE or History SE or SO bans. Is anyone else sensing a pattern?
 
3 hours later…
07:40
Is the game "Zigg zagg zugg" (sometimes spelled "Sigg sagg sugg") popular in any other countries? I am working on a prospective new KotH challenge, and I can't really find any information about the game. Has anyone heard of it? Maybe it goes by another name?
never heard of it
It's a children's game, you all stand in a circle with your feet in. You say "Zigg, zagg, zugg", and on "zugg" you either keep your foot in or pull it out. The goal is to be alone with your choice. Ideally played with 3 people, but you can play with more people if you allow several rounds
08:03
@DJMcMayhem I have posted a comment on my question yesterday. Since the question is quite old I don't think people can notice it. Can you(or anyone else interested) kindly have a look. vi.stackexchange.com/questions/18448/…
08:14
0
A: Sandbox for Proposed Challenges

guest271314Index and Get/Set Nested Arrays/Lists This question is intended as extension of Home on the Range of Lists. This challenge is to write one or two functions or a program which are getter and setter for a nested array/list mapped to 0-based or 1-based indexing. Input An array/list containing a...

 
1 hour later…
ngn
ngn
09:29
@maxb sounds like the best strategy would be random (assuming everyone plays for him/herself)
if there's a collusion between 2 of the 3 players, they could guarantee that one of them will win by making different choices
@ngn I have been designing some example bots, and you're probably right. I even tried to run bigger games with an odd number of bots, and have the smaller group win. But even then, the outcome was extremely dependent on the other bots rather than any clever tactic implementation. So I'll probably scrap the idea
ngn
ngn
@maxb maybe you could make it more interesting by generalising it? for instance there could be a table specifying the outcomes for each player depending on the choices of all players - a table with N * 2^N entries
(where N is the number of players)
09:46
@ngn I think you could get some interesting data from it, but I don't think it's well suited for a KotH, since your top answer could become worthless by subsequent bots. Ideally there should be some aspect of randomness, while you could develop an optimal strategy independent of any prospective future opponents
0
Q: Nested lists as printable 2D objects

Joe HealeyI don't know if something like this exists already (and I'm not finding the right key words) but if not, it felt like it could be an interesting coding puzzle. The challenge is, to take an arbitrarily nested list (no more than 2 deep), and display the content in a terminal in 2 dimensions in a '...

CMQ: Is there a way to search for all messages said by a specific chat user in a specific room without restricting it to any particular word or phrase?
10:18
There's this. Don't ask me how to use it
@H.PWiz that's TNB specific though
Oh yeah
And I want it for the Orchard.
10:36
0
Q: Split Longer Message to multiple short messages

AlgoCoderPost short messages limited to 50 Example Suppose the user wants to send the following message: "I can't believe Tweeter now supports chunking my messages, so I don't have to do it myself." This is 91 characters excluding the surrounding quotes. When the user send, it will s...

 
2 hours later…
12:41
If anyone's not lurking rn: Would you rather have = or == for equality?
Assuming you haven't seen a single programming language before
@ASCII-only If you use = for equality, what would you use for assignment?
also, = vs := for assignment and <> vs != vs ~= vs /= for inequality? (more than one answer for inequality is valid, but preferably list which is your preferred one)
@Emigna probably :=, i guess? not actually sure
12:55
@ASCII-only I presume?
@Adám ?
@ASCII-only I presume you want ASCII-only answers. Correct?
@ASCII-only And does it have to be one of your stated options?
@Adám Nope
@Adám Yes (but you could suggest non-ASCII-only ones as alternatives)
@ASCII-only name:value to assign, val1=val2 for equality, val1~val2 for inequality, the latter with as non-ASCII alternative.
Hmm. I guess bitwise not is much less useful when bare-metal performance isn't really a focus (i.e. for languages that aren't C)
@Adám would a~b not be confused with approximately equals?
13:05
@ASCII-only I know people abuse ~ to mean , but are you even contemplating having approximately equals? And if so, what about other approximate comparisons?
@ASCII-only What are you using for NOT?
@Adám not really decided yet
just plain not would be sufficient though
@ASCII-only If you stick to single-symbol operators, you can "overload" them with meaning (infix/prefix) just like commonly done with -. Then ~ can be NOT, and it reads nicely for the infix version "val1 (is) not val2".
this is a prefix language though (for ease of implementation), so i'm probably going to go with fixed arity
@ASCII-only But you still have infix operators like >, no?
@Adám nope
13:10
@ASCII-only So when you asked what to use for inequality, you meant e.g. <>(val1,val2)?
basically, yes
@ASCII-only Ugh, even more so reason to stick to single symbols, not to make it completely unreadable. And yeah, NOT can just be not, but if it is prefix, and = means equals, such that =(val1,val2) means whether the two are equal, then automatically using ~ for NOT would make ~(=(val1,val2)) and therefore ~=(val1,val2) be inequality, even if ~= isn't parsed as a single token.
 
1 hour later…
14:40
0
A: Sandbox for Proposed Challenges

Kevin CruijssenMatrix Jigsaw Puzzle code-golfmatrixnumberinteger Input: An integer n Two equal-sized square matrices (with their width/height being a multiple of n) Output: One of two distinct values of your own choice, one being for truthy results and one for falsey results (so yes, 1/0 instead of true/...

15:26
0
A: Sandbox for Proposed Challenges

AdmBorkBorkMatrix Jigsaw Puzzle (Randomly inspired by https://codegolf.meta.stackexchange.com/a/17272/42963) code-golf matrix Given a rectangular matrix of digits (i.e., 0 - 9), output the "pieces" of the matrix as if the digits are connected together forming a single piece, in ascending order by the dig...

Woo, I was hoping NSP would post before NMP could. :D
@AdmBorkBork um, hm, I don't think you can post a question with the same title as another one, so I suggest changing "Matrix Jigsaw Puzzle" to "Matrix Jigsaw Pieces" or something else
0
Q: What are the repeating Fibonacci Digits?

DonielFAs you probably know, a Fibonacci Number is one which is the sum of the previous two numbers in the series. A Fibonacci Digit™ is one which is the sum of the two previous digits. For instance, for the series beginning 1,1, the series would be 1,1,2,3,5,8,13,4,7,11,2... The change occurs after t...

@EriktheOutgolfer Sure, I know. Just thought it would be amusing.
@AdmBorkBork That one sounds like so much fun. Can't wait (possibly solved already depending on your answer to my comment).
15:40
@Narasimhan Answered.
@Adám I must admit I didn't think about simple space-substitution. I kinda feel that extra whitespace is against the spirit of the problem, since you're not really outputting just the piece at that point.
0
A: Sandbox for Proposed Challenges

BMOSource permutation Tags: code-challenge, integer, permutations, sequence A permutation of a set \$S = \{s_1, s_2, \dotsc, s_n\}\$ is a bijective function \$\pi: S \to S\$. For example, if \$S = \{0,1,2,3\}\$ then the function \$\pi: x \mapsto (x + 1) \mod 4\$ is a permutation: $$ \pi(0) = 1,...

However, that's a valid strategy to find and define what is a piece, so I don't want to rule it out. How about stating that extraneous whitespace-only lines per piece is invalid?
15:54
@AdmBorkBork Lines and leading columns, I presume?
The more I think about it, the more I'm feeling against extraneous whitespace.
@NewMainPosts yeah... pretty sure that just became a keep-out zone for Jelly...
@AdmBorkBork i have no idea what other strategy could even come close to it, and doing that and trimming whitespace would probably beat anything else anyways
imo you pretty much have to allow inputs with multiple shapes with the same digit for anything else to make sense
BMO
BMO
16:09
How can I move a conversation in the comments to chat?
Hm, checked meta.. Doesn't seem to be possible :(
@BMO Ask a mod
Hey look, I found a mod
BMO
BMO
@DJMcMayhem Lol
Can you please move this?
I think this will get longer than suited for the comments section
BMO
BMO
Thank you :)
Also, the automatic message that gets posted when I do that sounds a lot more disapproving than I really am lol
> Comments are not for extended discussion... Ugh. This conversation was moved to chat where it belongs
16:14
"Get the ---- outta here."
Yeah, I usually edit that part out. >_>
more disapproving version (that can actually work better in some situations but unfortunately violates the CoC since it went in effect):
> Maybe we should remind you that there's something called "chat" in Stack Exchange...?
Can I get some assistance on this sandbox post? I like the challenge, but I'm out of my depth when talking XML, JSON, etc., and what would be feasible or best for other languages.
@Dennis What do you usually edit it to?
It kinda depends on context for me. Like, if there was a 30+ comment argument about something tangential to the question, it seems perfectly appropriate. But in this case, I just moved at request, it wasn't really problematic. Which is why it seems disapproving
s/Comments are not for extended discussion; t/T/
I leave it in when people should have gone to chat in the first place.
s/$/ ಠ_ಠ/ for severe cases. :P
16:30
I think I've reimplemented the linked list 4 times today after realizing I need to be able to get the next and previous of a value I did not previously expect to need the next and previous of
Btw, I just learned Python 3.7's dict is essentially ordered.
Oh?
Well, even if it is it might not stay that way
So I shouldn't use it
It has been that way since CPython 3.5. The ordering is mandated by the spec since 3.7.
except that a dict is equal to itself and all of its permutations
It's not equal to an OrderedDict, no. It just respects insertion order.
16:35
That's pretty much all an OrderedDict does, too
It defines a couple of extra methods though. And changes __eq__, as Erik pointed out.
Hmm. I don't need __eq__, and dicts support typing.Dict...
I wonder how well these would work for an LRU cache.
My caching is dumb. Instead of an LRU cache's key->value it's just filename->data
It works ok
16:45
That's more or less what TIO currently uses. It's still LRU.
LRU implies there's a limit on dictionary size
Yeah, I have a cronjob for that. >_>
I just run git clean -fdx occasionally
Surprisingly Java's LinkedHashMap has a removeEldestEntry which sorta lends itself to being a LRUCache
Eventually I'm gonna need to implement a DB for this thing I'm making and I'm torn between an actual database and sqlite
16:47
it doesn't really have any other eviction policies, though
which i'd imagine you'd want in a real lru implementation
@Pavel do you need network access
that's usually the big pull for a real db
sqlite it is
also depends on how large you expect your database to be
since iirc sqlite will just use up all your ram
The buddy memory allocation technique is a memory allocation algorithm that divides memory into partitions to try to satisfy a memory request as suitably as possible. This system makes use of splitting memory into halves to try to give a best fit. According to Donald Knuth, the buddy system was invented in 1963 by Harry Markowitz, and was first described by Kenneth C. Knowlton (published 1965). Buddy memory allocation is relatively easy to implement. It supports limited but efficient splitting and coalescing of memory blocks. == Algorithm == There are various forms of the buddy system; those in...
@Pavel Looks like sqlite team actually has a page for this, haha sqlite.org/whentouse.html
If SQLite does eat all the ram that's bad
We're trying to save money by getting the cheapest DO droplet we can
The entire point of the project is basically to pay wordpress less money
Eh, I'll probably try SQLite
17:32
Shaders are fun
18:27
"If provided, the template parameter list cannot be empty (<> is not allowed)."
Blast. This means `[]<>(){}` will not be valid C++.
@Khuldraesethna'Barya Boy, do I have a language for you.
18:47
0
A: Sandbox for Proposed Challenges

SEJPMThis is not the Timing Attack you are looking for! code-golf cryptography Introduction I recently was writing a piece of code to verify a HMAC signature (to verify an API request). While doing that I found the given method in the documentation to be "incredibly verbose" and as a somewhat as...

19:32
@DJMcMayhem hahaha, shameless self plug much?
@Khuldraesethna'Barya Is [](){} valid C?
@Pavel it is valid C++
A lambda capturing nothing, taking no parameters and doing nothing
Right, lambdas exist
With their dumbass syntax
I recently ran into a situation where boost::bind would incorrectly mark all of the arguments as const but a lambda was fine.
19:47
@Pavel this just in: [](){} is C++'s coolest No-op
20:16
[](){[](){[](){[](){}}}}
]:(:) moooooh
20:43
@quartata Idk if this would be most efficient given JS obj refs which would be most common object is only a 4-byte object
20:56
CMC: Write two programs (in the same language) that take X and output the X'th number of some OEIS sequence. You must reveal 1) The language it's written in (and if you are using 0 or 1 based indexing), 2) The longer program, 3) The OEIS sequence, and 4) the byte count of the shorter program, we'll call this n. Robbers crack your code if they can write an equivalent program (same language, sequence, and indexing) in n or less bytes.
For example, here's a pretend submission. Brain-flak, 4 bytes, outputs A000027 (1-indexed): ({}). Length to beat: 2.
That could be cracked by any brain-flak program of length <= 2 that also outputs A000027 (1-indexed)
@DJMcMayhem () :)
Yep! Cracked.
This would also have been an acceptable answer: Brain-flak, 0 bytes:
Wasn't that an actual CnR?
I don't know. Wouldn't surprise me
Ah, it was except that you reveal the levenshtein distance between them:
16
Q: Levenshtein distance & OEIS (Cops)

Stewie GriffinThis is the Cop post. The Robber post is here. Your task is to take an integer input N and output the Nth digit in the sequence OEIS A002942. The sequence consists of the square numbers written backwards: 1, 4, 9, 61, 52, 63, 94, 46, 18, 1, 121, 441, ... Note that leading zeros are trimmed...

Yup, by Adnan a couple years ago
83
Q: Can you outgolf me? (Cops section)

AdnanCops section The robbers section can be found here. Thanks to FryAmTheEggman, Peter Taylor, Nathan Merrill, xnor, Dennis, Laikoni and Mego for their contributions. Challenge Your task is to write 2 different programs (full programs/functions/etc.) in the same language and the same version (...

21:10
@DJMcMayhem 1) Dyalog APL, ⎕IO←1 2) (⌈ׯ1*⊢=⌊)⎕÷2 3) A001057, a(0)=0 4) 6 bytes
21:25
0
Q: Add to number using regex

Lostkoz8Using a regular expression, I want to add 1 to 1 to get 2, 1 to 2 to get 3, 1 to 3 to get 4, 1 to 22 to get 23, 1 to 145 to get 146, etc. So I would have the expression, the value, the replacement, and the output. For example: Expression: Value: 1 Replacement: Output: 2 Expression: Value: 2 ...

@Adám -/⍳
@dzaima Well done.
21:59
@NewMainPosts why are people closing this as "you should have asked on Stack Overflow?" the answers on Stack Overflow will just be "this is a terrible idea, don't do it"
it's also not a dupe, in the sense that you can solve it much more easily than an "add two numbers with regex" challenge and so answers to the second wouldn't fit as answers to the first
it is, however, missing a victory condition
assuming , I can do 170 bytes including the // delimiters at either end of the regex, PCRE-style
also this is the version, if you want a regex-substitution version you can't do it in a single regex as you can't have a regex substitution which conditionally generates certain digits
(for anyone interested, here's my solution: Try it online!)
@ais523 Because it is impossible to close it as only the first two sentences of "This site is for programming contests and challenges. General programming questions are off-topic here. You may be able to get help on Stack Overflow."
I interpreted it as a contest because there's no way you'd want to do that for any other reason :-D
@ais523 It was literally a Lost koz
I guess "based on the literal wording of the challenge, it's impossible" may also be a good reason to close it (but is a better reason to fix it)
despite all these problems, I nonetheless had fun solving it
CMC: Invert a non-negative integer by subtracting each digit from 9. E.g. 31415 → 68584, 987 → 12
22:12
what if there's a 9 in the middle of the number?
presumably it becomes 0, so are leading 9s special?
@ais523 They also become 0, what do you mean?
@ais523 Correct.
I guess this depends on whether we're treating this as a string or as an integer
You must strip leading superfluous leading 0s in the answer. And 999 → 0
So note that the inversion does not round-trip.
22:17
@ais523 Care to explain?
produce a generator of things that can be added to the input to produce an output with all digits equal and first digit 9, filter by positive
@ais523 Amazing.
values closer to 0 are generated first, so this will give the smallest value we can add to the input to produce a number that's all-9s
err, filter by non-negative
program is right, description was wrong
99 gives output 0, as expected (not 900, which is the first positive result)
huh, just noticed that that answer is almost all ASCII until the end
@Adám C# with Linq, 71 bytes
89 if you want to also count using System.Linq;, which you probably should
@Skidsdev Pro tip use one of the interactive compilers on TIO
They both include Linq by default
22:23
@Skidsdev What is all the ""+ and +"" about? Converting a number to string?
Yes
@Adám yep, much shorter than .ToString()
x+"" is actually converting a char to a string
@Skidsdev You could take input as string though.
22:24
@Adám you never specified, you just said a non-negative integer
Defaults for io
You can take numbers as strings
@Pavel oh I didn't know C# supported removing the argument parens for single argument lambdas, thoguht that was a js thing
@Adám Vim, <s>24</s>, 23 keystrokes: :s/./\=9-submatch(0)/g<cr>
@Adám 64 bytes takes input as string
@Adám Perl -p, 11 bytes: s/./9-$&/ge
@Quintec only because you used a different approach, which by the looks of it, would work in C# too
@Skidsdev Oh i didn't bother to see what you were doing lol oops
@Quintec The C# approach to that is almost exactly equivalent, but one byte shorter because .length => .Count
@Pavel 3 bytes shorter, .length() => .Count
22:28
@Skidsdev I don't think strings have a .Count
The have a .Count() and a .Length iirc
oh yeah
.Length is still shorter though
2 bytes shorter then
taking input as int and doing (""+n) is shorter than taking it as string and doing -int.Parse(n) :P
Use the Mono interactive compiler lets you save bytes in the footer lol: tio.run/##Sy7Wzc3Py9ctzkjNyfnvVpqXbJOZV6KjkJJfmpSTaqeQZvs/…
oh nice
OTOH, The other interactive has using static System.Console implicitely so you can do WriteLine instead of Console.WriteLine
@Pavel fails for leading 9s
Without parseInt i would've had 32 bytes darn
Clam doesn't have a length operator yet, otherwise I'd be able to do it in clam
@ais523 Numbers with leading 0s is valid io
22:33
it was specifically disallowed above
FWIW, I had a go at the challenge in Brachylog v1 (which is ASCII not SBCS): :.#++#=h9,, 10 bytes Try it online!
it's basically the same as the Brachylog v2 answer, just in an older syntax with longer builtin names
Clam, 17 bytes: =a*rp--^+55na*a*1
better yet, Clam, 11 bytes: p--^+55nRR1
@ais523 Fine, fine. 17 bytes s/./9-$&/ge;$_+=0
Perl -p, also 17 bytes: $_=0+s/./9-$&/ger
if you do allow leading 0s, I can do it in six bytes of Sesos: Try it online!
22:41
I wonder if you can pull it off in Dodos
@ais523 Oh, I don't know if you saw my message a while back, in my TAFM implementation I added an extension where if a counter is initalized to @{} it'll read an integer from STDIN
@Pavel I noticed, it seems reasonable for batch I/O
Golfed the HW yet?
I think an ungolfed HW is better than no HW, anyway
no; one problem is that base conversion may be the tersest way, in which case the program won't run in a reasonable time (unless we do something Ratiofall-style)
I could try to write optimizations but I'd have to come up with which optimizations are possible
@Downgoat ??
isnt this VSL
wait
ok back it up
22:51
VSL WASM target? :thinking:
"JS object references is only a 4-byte object" because its a reference. its not heap allocated
??
its literally an int
wait it cant even be 4 bytes, that doesnt work on a 64-bit system
i
what??
the way WASM does it is that you can ask for a 32-bit or 64-bit heap regardless of your OS's bitwidth
@Quintec That's actually pretty good. I just shuffled your code around a bit and got 9 bytes: -+10⊥9⊣¨⍕
it wouldn't surprise me if JS were similar
@ais523 ok, doesnt change the fact that i have no idea what he means by mallocing a reference
its a pointer
22:57
you can allocate enough space to hold a pointer but I don't see why you'd want to
@Adám Cool, didn't know you could do ⊣¨, neat trick
@Quintec I'm even lobbying for to be supported, though it wouldn't save a byte in this case.
what does ¨mean in APL?
@ais523 (for/on/applied to) each
ah right, that explains why it comes up so often
Jelly uses for that but it's implicit in most contexts
22:59
@ais523 the less ¨ the better, it's usually implied in APL also
that said, I like the golflangs which use generators, that way you can have both lists (explicit-each) and generators (implicit-each) and it tends to get the eaches in the right places
Heh, the -+10⊥9⊣¨⍕ train actually reads nicely: - the negated argument + plus 10 ten- based evaluation of 9 nine for ¨ each element of the character representation.
that inspired me to write it in 5 bytes of Jelly: O57_Ḍ Try it online!
take representation as a sequence of codepoints, subtract each from 57, convert sequence of decimal digits to decimal
although it's slightly cheaty as it takes a string as input and outputs an integer
oh, duh; Jelly, 4 bytes: D9_Ḍ: Try it online!
shorter to use integers on both sides :-)
there's a language I'm working on which could do it in 18 bits using the same algorithm, M9D in a 6-bit character set, but sadly the language isn't implemented yet so I can't count it
@Quintec I guess constant¨ could save a byte by taking argument as string: ⍎-⍨10⊥9¨
23:15
I assume the intended behaviour of is to replace every element with 9?
I just checked Jelly, that's how it interprets 9€
Basically, that just means "for each element, 9".
@ais523 Yes, although only dzaima/APL and my extended Dyalog APL support that
Which is just replace everything with 9. You're using 9, which is technically a constant nilad, as a monad, which just discards the argument effectively.
(Because Jelly literals aren't actually objects they're like lambda: x lol)
However, I'm envisioning (as in: my extensions have it) a whole family of those: 9⍨ replaces everything with a single 9. replaces each item. 9⍤k replaces each sub-array that has k dimensions. 9⍤(-k) replaces each sub-array that has k less dimensions than the argument. 9⍥k does a tree traversal and replaces each semi-leaf that has k or less further nodes including itself. 9⍥(-k) replaces each node that has k less or less further nodes than the argument.
Does ¨ currently act as a for-each/map or is there something that does that?
23:24
@HyperNeutrino It does for functions. So you can currently just do {constant}¨ or constant∘⊣¨ etc.
Oh cool, okay.
same thing. isn't implemented yet except in my extensions.
@quartata uhhh idk what I meant >_> it was morning and I was tired

« first day (2902 days earlier)      last day (2236 days later) »