« first day (3015 days earlier)      last day (2126 days later) » 

02:10
Anybody know string slicing in Sisi
I got that so far
I haven't seen DLosc recently (chat says 27 days ago, main says 2 days, but hasn't posted since early april), and I'm not certain anybody else knows that one
yeah he hasn't done anything visible since april 5th, you'll either have to figure it out yourself or give up I believe
03:27
Any last minute thoughts on my digitsum question before I post to main?
@JoKing Is there some upper bound on the input? You might get the usual questions on integer types, etc
especially because interpreting in a high base b and then taking the result modulo b-1 works for digit sums at most b-1
@BlueRaja-DannyPflughoeft Thanks, you've convinced me that flipping my car upside down for repairs was impractical just moments before I attempted it — wedstrom Feb 8 '18 at 18:58
@xnor I was going to let the standard "number won't be above your representable number data type" handle it (though looking for a meta ruling, we don't actually reference that outside of the standard loophole)
so i'll state it explicitly
@JoKing What do you say to the inevitable Python 2 question of whether we can assume it's an int (<2^64) rather than a long, so that its string rep doesn't include an L at the end?
@xnor is that still a thing? I thought that was removed in later versions of Python 2
03:40
Only in the later version known as Python 3 :) It happens with backticks
oh. I'm going to say use the actual str function, not the repr one then
ok, that's reasonable
 
3 hours later…
06:42
@Riker flat earth confirmed :D
@Riker but if it works on my bike why not on my car?
 
2 hours later…
08:33
0
Q: Words Everywhere

MatthewGiven a list of words, output a square grid of characters, so that all the words can be read from the grid, by moving horizontally, vertically, or diagonally between characters, without reusing characters in the same word. The grid must be the smallest possible which allows all words to be read. ...

08:57
hello!
09:35
at https://codegolf.stackexchange.com/ it says "
Maximizing by swapping[...]modified 6 hours ago Sriotchilism O'Zaic 35.8k"
but if you click on that link it wasn't modified 6 hours ago
what does this mean?
0
Q: Is there support to approach 3rd parties to build a performance tool?

Phil HFor code-golf questions, TIO has been a superb resource. However, for fastest-code challenges there is no equivalent tool available. I believe we could explore working with one or more 3rd parties to build such a tool; it would be in the clear interests of performance analysers, cloud providers...

@Anush Probably some answerer modified their answer.
@user202729 wouldn't that also show as being top in the answer list at codegolf.stackexchange.com/questions/185001/… ?
maybe they added a comment and then deleted it?
That user was the last one to reopen the post.
interesting
but it wasn't reopened 6 hours ago was it?
the user has a great name too!
09:47
That user changes their name like every month...
aha ;)
10:11
0
Q: (Soft-Question) How to implement my board-game idea?

henceprovedI am a big admirer of logical board games like chess, sudoku etc. In my free time, I think of ways of tweaking rules to make games even more interesting (and sometimes think of inventing a new game altogether) but every time I feel restricted as I have no way to demonstrate my idea. I think of ma...

11:10
0
Q: Intercommunication between threads

PuzzleSo glad I found this cool site. Wanted to try sharing a coding challenge a friend gave me, an interview question. Usually it is written in java, but you can use whatever language you want, just have fun! Challenge: write efficiently and securely a program that creates an array of n threads the c...

11:31
0
A: Sandbox for Proposed Challenges

AnushA factorization game Player one picks a positive integer \$10^3 \leq x \leq 10^{15}\$. Player two outputs \$k\$ distinct positive integers \$y_1,\dots,y_k\$ such that \$(y_1+1)(y_2+2)\dots(y_k+1) = x\$. She gets \$k\$ points. The challenge is to write code for player two. Input A single int...

 
1 hour later…
12:34
@NewMainPosts Hmm, pretty sure this should shed the java tag as its open to all languages
12:52
if anyone has any comments on my challenge, gratefully received codegolf.meta.stackexchange.com/questions/2140/…
@Anush I don't understand the sequence (y1+1)(y2+2)…(yk+1). What is the third term?
(y_3+1)
@Adám does it make sense?
@Anush So you alternate between +1 and +2?
@Adám no! Hmm.. let me see why this is confusing
@Anush Oh, so now I really don't get it. What is the fourth term?
13:02
@Adám typo!
thanks
:)
they should all be +1
@Anush Why have the +1 there at all?
@Adám it makes the challenge a little more interesting
that is a little step away from factorization
@Anush No, k is the same no matter what you add or subtract.
let's take 127381 and see (you may be right)
If all the yₙ are distinct, then so are all the zₙ if zₙ=yₙ+c
13:08
actually 1099511627776 is more interesting
@Anush If I understand your text right, your challenge is actually just: given a positive integer x, determine the maximum number of distinct integers that have the product x.
-1
Q: Send first Email of each unique domain using C/java

Anshu negiChallenge Given n email addresses of different domains, please send an email to the first address(in alphabetical order) of each domain. Assume function sendmail() to send emails. You need to return an array with the list of all first emails corresponding to each domain. Take any sample array li...

@Anush If there exists a set y such that (y₁+1)(y₂+1)…(yₖ+1)=x then there must also exist a set z such that z₁∙z₂∙…∙zₖ=x, no?
hmm.. I am thinking :)
@Anush Ah, there is actually a difference. If the elements of y must be strictly positive (not just non-negative) then y₁≠0 and so you just cannot include the factor 1. If the number is even, y₂ will be 1 to represent the first factor being 2. So with your complication, one just has to subtract 1 from k.
13:14
thanks! I knew there was a reason :)
@Anush Sure, but it isn't really interesting to subtract 1 from the result, is it?
not that interesting, no
the output is just k of course
if you have a preferred wording I would be happy to use it
@Anush Given a positive integer x, answer the maximum number of distinct integers that have the product x.
That's it. Then some test cases and you're done.
so 1099511627776 gives 9 in this case
right?
@Anush I suppose, if 8 was correct before.
13:22
question changed
thanks
@Anush Why the whole story about players and naming the output and talking about "optimal output"? Just state what's to be returned.
@Adám I thought it was more fun :)
but I can make it more minimalist if people prefer
@Anush Then put a tl;dr at the top or a background story section marked "safe to skip". At least some people prefer less fluff.
it is quite minimalist now
(I changed it)
The player-bit at the start makes it feel a bit like we're making koth bots
13:27
take another look
there is very little left in the challenge :)
@Anush Only the interesting part is left.
:)
I should say, it's non trivial
if you want to be able to solve it for the full range I gave
I would add the actual numbers to the output example, like (1, 17, 59, 127) for the 127381 example, to make it a bit clearer
@Anush Why is the upper limit specifically 10¹⁵?
I didn't immediately realize that we should include 1 (although it should be obvious since we're maximizing factors)
13:31
@Anush I'd limit it to 10⁹ so languages that represent integers with 32-bit can compete.
@Anush Also, why include a lower limit at all? For 1, the answer would be 1, no?
I can't read 10⁹
what is that?
10^9?
yes
@Anush Yes.
are there really languages restricted to 32 bits these days?
@Anush BYOND.
Of course, BYOND is not a language, nor is it a game engine. It is purified awfulness in a tin can
13:36
:)
But yes, BYOND is 32-bit only. Probably because it depends on Internet Explorer for it's functionality
that and because it's probably so chock full of undefined behavior (It is, i've disassembled parts of it) it simply cannot be upgraded to even a new compiler version
CMC: Find 9 distinct positive integers whose product is 1099511627776.
just to keep people busy :)
and hopefully make them interested in my challenge
Anyways, i need to go wash off my hands now. Typing out that accursed name has tainted me
which name?
The B name
Seriously, it's awful, the fact it still exists is an evil itself
13:38
@Anush [1, 2, 4, 8, 16, 32, 64, 128, 4096]
@Emigna too fast!
:)
Well, it was a 2**x number
Anyone else here do x86-64 assembly?
@Emigna true.
So not that hard just to take the first 9 2**x numbers and increase one
13:39
@Emigna did you do it by code or hand?
code
oh cool
1*2*4*8*16*32*64*256*2048
also works
of course :)
Yeah, there are a few different solutions
512, 1024 also works for last 2 ofc
true
oh a comment by me has been starred!
You should probably change the wording on the sandbox post to show that it is "a possible solution". Sounds like it's the only one right now
13:44
it's so minimalist I am tempted to post it now
Question: Is there a pathfinding challange on PPCG?
@moonheart08
I'm sure I've already participated in multiple:)
thanks for the improvements all
Is there a guide or reference sheet I can use to read up on fancy math notation syntax in SE?
13:46
(some of them are not that obvious)
Sidenote: Should i learn C#? I currently know Rust and Javascript, and am using C# a bit for unity, but don't really know it
I mean if you're using Unity you should probably learn C#, but it's really up to you
@Skidsdev The sidebar help when asking a question links here. You don't need the parts about the document and choosing a flavour. The basics are here.
@Skidsdev what i mean is learn it for use beyond just Unity :p
@moonheart08 How about learning something radically different? — like APL…
13:51
:p
APL is on my TODO list
@Adám I love the topic named "Getting Stuff On Top of Other Stuff". That's exactly what I googled when I needed to use TeX for the first time.
LISP is on my TODO list as well
Also plan on learning RISC-V Assembly, but for that i want real hardware, and real hardware isn't very cheap at the moment
@Adám Thanks!
@Emigna your code gives the output 3 instead of 9, right?
@Anush: yes, but for a different number (1 higher than your example)
14:02
@Emigna oh ok.. it looked similar
ideally it would run for the test cases. But who am I to be fussy
I changed it to a a number beginning with 2
thanks
@Anush Inefficient code is short code ;)
yep :)
I still haven't found a way to ask for short code that isn't inefficient without risking the wrath of the ppcg community :)
The standard-ish way of "must complete test-cases within x seconds" seem to work decently. Although there is always the question of on what specs
It definitely is harder making questions asking for optimized programs in time/memory
14:07
2
Q: A factorization game

AnushInput A single integer \$1 \leq x \leq 10^{15}\$. Output The maximum number of distinct positive integers that have the product \$x\$. Examples Input: 1099511627776. Output: 9. One possible list of factors is: (1, 2, 4, 8, 16, 32, 64, 128, 4096). Input: 127381. Output 4. One possible list ...

@Anush it just doesn't make sense to ask for that - you're asking for two completely different tasks in the same answer, which kind of fits for this. For this I don't think it's that bad, but in the very big powers question golfing is definitely just an afterthought, despite being the main focus
0
A: Sandbox for Proposed Challenges

SkidsdevA Note On Frequencies In western music, we denote "musical notes" as a letter A-G, optionally followed by a ♯ or ♭. An "octave" is a collection of 12 notes, such that the frequency of any given note is double that of the same note in the octave below, and half that of the same note in the octave...

@NewSandboxedPosts I've finally learned my lesson abuot posting seemingly simple challenges without sandboxing first :P
@Skidsdev your challenge is surprisingly close to a ; there are only 12 possible outputs, and it's not immediately clear to me whether calculating them or hardcoding them is shorter
@ais523 there are a lot more than 12 possible outputs, my wording was just unclear that the number in input refers to the octave
14:47
@ais523 Is that better?
@dzaima my perspective is just completely different. I see it as "write the shortest code for any non trivial algorithm for this problem"
we have tags for restricted-time and restricted-complexity for exactly this reason
@Anush people want to write fast code or short code, not both. If you want short code, but only want non-trivial answers, you need to find a challenge that has no trivial answers, but be warned you'll get far fewer answers
@Skidsdev yes, that's clearer
@Skidsdev I do see this.. it would be much easier if we had a TIO for fastest-code
it's not satisfactory to have to time code on your home pc
@Skidsdev I'm normally happy to golf but it can often take a while to find a good algorithm
14:50
@Anush Somebody mentioned that on meta recently
@Anush but when writing the algorithm is like 99% of the challenge, golfing, being the 1%, feels way less required, despite being the scoring system
@dzaima well you have to design an algorithm which can be golfed
@dzaima there are often faster algorithms which are huge in code
See I have no formal CS or Math education, everything I've learned is self-taught, so when it comes to PPCG I tend to prefer more trivial challenges, like yesterday's Shantae Dance parser
the reason is that with pure unrestricted the shortest program is basically the program that describes the problem as succinctly as possible, with you need to force a particular algorithm, so now you need a program that describes the algorithm as succinctly as possible
it all seems like perfectly legitimate coding challenges to me
14:51
and algorithms are way longer than problem descriptions, normally
@ais523 that makes sense
@Skidsdev I see that
I am not normally happy to golf because there's normally numerous optimisations you can do to the algorithm, and having to golf them too takes the fun out of it
but the task of designing a fast and succinct algorithm seems worthwhile to me. I realise not everyone agrees :)
you can choose if the winning critierian is code size or speed
restricted-time/restricted-complexity sets the winning criterion as code size
well, golfing is really worthwhile from the language design point of view; a language that is good at that would be a language which is good at finding optimised algorithms given a problem description, and a language like that would be really useful
I agree
as an example, codegolf.stackexchange.com/questions/185062/… is a much less interesting challenge because I was bullied (joke :)) into not adding restricted-time
if I had put a max of 10 seconds, then the problem is very cool and quite hard
14:54
that's a really good pure problem too, IMO
so people didn't want the alternative wincon because it wouldn't reward golfed programs
it might be good as a restricted-complexity problem too, but possibly not (it wouldn't surprise me if it's NP-complete)
@Anush See this is where the issue lies, it's not that there's any flaws in your logic, golfing algorithms under or is still golf, and there's no inherrent problem with challenges that do that, it's just that opinion-wise, most people prefer not to.
@Skidsdev that makes perfect sense to me
@Anush for that, I'm actually not against (less so with but still acceptable)
I just don't like it when I get 5 close votes and 10 down votes in one day for usign restricted-time
is really hard to make objective
the same program won't run in a consistent time even on the same computer, usually
14:56
From what I see in PPCG, especially when golfing in non golflangs like Python and JS, a lot of the fun of golfing is stretching and twisting the language in ways so time/performance inefficient that one would never get to explore in practical code
is a lot less useful than you might think if you want actual code
Although thinking about it I could definitely get behind some golfing
the problem is that real code needs a max size for the problem which means all algorithms are constant time
why? plenty of languages have bignums
so we would have to agree what we mean by the complexity of real code
@ais523 that's quite a restriction
14:58
@Anush PPCG usually should let you slide by not defining the max input size & requiring that the code theoretically works on all inputs (or so i remember from a while ago and don't currently have any meta links to back me up)
@Anush well for we normally have something like "even if your language doesn't have bignums, you can assume that it does", together with specifying the complexity to be assumed for, say, adding or multiplying bignums
@dzaima that seems reasonable as long as everyone agrees what it means for a piece of C code to theoretically scale to large types
@ais523 that sounds good
@Anush Except we're not dealing with "real code" in any definition. Code on PPCG is and should never be production-worthy, and algorithm complexity is a theoretical construct, meaning with , the theoretical complexity of the code is what matters, not the "real" runtime
that said, even a trivial problem like multiply two numbers becomes really hard as
I think the fastest algorithm was only discovered recently
and the latter point is only an issue if you overlook the former point
14:59
and is really complicated
hmm, apparently it hasn't even been proven optimal, so there might be still faster ways to multiply numbers out there
@ais523 well only if you care about it being exact. I just want it to terminate in a reasonable amount of time. So 1 minute is fine, 1000 years is not
20
Q: What is the fastest algorithm for multiplication of two n-digit numbers?

AndyI want to know which algorithm is fastest for multiplication of two n-digit numbers? Space complexity can be relaxed here!

I guess I could add and say it should be poly time
would that be acceptable to people?
@Anush yes but you have to be objective otherwise it's impossible to compare answers with each other
@ais523 isn't that objective?
the winning criterion is still code size
but the code has to run in poly time in theory
15:05
@Anush but where do you draw the line? is 59.99s fine? is 60? is 59±10s? is 60±60?
oh, polynomial time
@dzaima sorry I moved to poly time. How about that?
your factorisation problem possibly can't be solved in polynomial time, though
@ais523 poly time after the factorisation step :)
there is a polynomial-time prime-test, so we can determine if the answer is 1 or not in polynomial time
15:06
hmm.. maybe I should just supply the factors as the input
ok so.. say I provide the factors as the input
and then the algo has to run in poly time
@Anush that's very very easy, no?
see it as a set-theoretic problem: "you have a multiset, what's the most submultisets you can divide it into so that all the submultisets are different?"
0
A: Sandbox for Proposed Challenges

msh210Generate A038666 code-golf (Needs a better description, of course.)

… and now that's helping me to come up with a better algo for the original problem
oh wait, grouping different numbers together is a thing
15:10
@dzaima no! I mean, what do you have in mind?
@dzaima right
if I change it now people will kill me of course... sigh
@Anush: it's best as two different problems anyway
@Anush this is why you should keep a question in the sandbox for more than 3 hours :|
the as you have it atm, and the based on a multiset
sure but if I pose another related problem now they will also kill me :)
if you disguise it correctly people won't be able to tell it's the same problem :-D
15:12
@dzaima I agree in principle but the difference in attention you get in the main site is just massive. There should be a "1st hour" on the main site where you answer it at the risk that it will be changed :)
@ais523 good thinking!
actually, I agree, reposting a challenge under a completely different winning criterion is allowed
@ais523 oh you think fastest-algorithm! I would prefer restricted-complexity
@EriktheOutgolfer I know but they killed me when I did this last time!
@Anush posting similar questions a bit of time apart, not immediately after is a start
trying to work out the fastest solution to this is the interesting part IMO (although you have to be careful because there are two size parameters not one, the number of distinct factors and the maximum multiplicity of a factor)
@dzaima I'll wait until tomorrow.. still scared from last time :)
15:14
multiplicity shouldn't count here, since we're only concerned about multiplicative partitions with distinct factors
@EriktheOutgolfer multiplicity matters because p² is different from p
maybe you mean something else
say your input is 8, i.e. 2³; the solution is [2¹, 2²]
here, the only distinct factor is 2, with multiplicity 3
are you talking about prime factors?
yes
15:16
that's a different story altogether though, because the challenge is about all factors, not just prime factors
maybe that would matter as an implementation detail
no, the challenge is effectively about grouping the prime factors; that's what a multiplicative partition is
you're dividing the prime factors into groups so that no two groups are identical, and trying to form as many groups as possible
@Anush I'd suggest a bit more, and definitely keep in the sandbox for a bit longer. I'd like to even have a little bit of chance of seeing the question before it's posted :p
@ais523 yep, that would be an implementation detail :P
The ultimate form of madness: Be insane enough to attempt to write a self-hosting JIT VM
atm I suspect that the greedy algorithm is optimal here, but I'm not sure, and it's not clear how efficiently it could be implemented; you probably don't have to form the actual groups
15:19
and then Dennis sweeps in and proves you right... ;) :P
@moonheart08 that's useful due to the eigenratio of 1 if you do it correctly (i.e. each extra layer of VMs gives only a slowdown of a constant amount of time, rather than the constant factor as usual)
@ais523 why layer VMs?
It's JIT. Have the VM just manage itself
not because you have to, but because you can
Of course there will still be 1-2 layers to bootstrap it
Gotta have an interpreter first before i can prototype anything :p
but yea it is useful, hence why i'm doing it
although some self-modifying esolang ideas benefit from having very efficient self-interpreters; the inner ones can be running a slightly different language from the outer ones
15:20
it's just that pulling it off is, uh, crazy
as the VM'd language has to be complex enough to generate native code and interface with the OS
and of course, do it efficiently so the programmer actually writing the VM doesn't go insane
@dzaima :) sounds good
@ais523 you wanna discuss this in a new room? I'd love some advice
Is there a room specifically for discussion of design and development of languages and language infrastructure?
ie Compilers, Interpreters, VMs etc
15:25
Probably the big thing that will cause me difficulty is the fact i'm going to need a full type system, and can't get away with a small one that omits some, say, integer types, early on
also the fact i'm going to have to design a usable language atop the underlying bytecode, and chances are high it'll end up usable to me, and opaque to everyone else
16:26
Question: Is it possible to unmap the executable data from RAM on linux?
i want to try and reclaim the memory used up by ELF data
ngn
ngn
16:40
@moonheart08 wouldn't that cause a segfault on the next instruction?
@ngn All my code will be elsewhere eventually, hence why i want to do it
I just want to free up the ELF data once i stop using it.
Also, I found a decent solution to the type system issue. Just omit what i don't need, and make the language into a fully selfhosted system, with the bootstrap interpreter pretty much only being used to generate the first version into a ELF
because it'll be simple enough early on i can get away with just doing something C like for the initial works
of course being able to generate a ELF file doesn't mean it'll stop being a VM
hence why i want to be able to clean up the unused ELF data once setup completes
 
2 hours later…
18:48
Finally getting some more work done on Clam :D
19:18
ok so i'm trying to make my site to support mobile and I have <meta name="viewport" content="width:device-width, initial-scale:1" /> and in my style i have body, html { width: 100vw; }
but for whatever reason, the body is not as wide as the screen (testing both on my phone and chrome dev console)
it probably has something to do with CSS pixels not being real pixels or whatever because the body says it's the right number of pixels wide but it's too narrow still
any idea why? i can send the link (not posting to SO because it'll take a really long time to copy-paste every relevant thing and I can't just give away a repo link and I don't even know what's relevant to this issue)
 
3 hours later…
22:23
@moonheart08 I'm not an expert on JIT/VMs, most of my language experimentation is in compilers and traditional interpreters
22:45
@HyperNeutrino Should you be using html as the tag? Try body instead
22:59
@HyperNeutrino try setting margins and padding on html and body to 0 to see if that's the issue (note that you'll probably want some margin or padding in the final version of the page, writing right up to the edge is ugly)
23:11
@moonheart08 I believe it's possible to unmap the segments of a running executable, just so long as the code is currently running from some other segment
Anonymous
@HyperNeutrino You want =, not :, in the content key-value pairs
@Mego not in CSS, that uses : between key and value, = is for HTML/XML
Anonymous
@ais523 Viewport tags are not CSS
ah, I see, there's both CSS and non-CSS in the comment
Anonymous
developer.mozilla.org/en-US/docs/Mozilla/Mobile/… has the best docs for viewport tags that I've found
23:22
MDN is my go-to reference for JavaScript (and occasionally HTML/CSS when needed, although I'm not really a frontend dev)

« first day (3015 days earlier)      last day (2126 days later) »