« first day (1603 days earlier)      last day (3282 days later) » 

5:02 AM
Doesn't the current xkcd have a mistake? Shouldn't there be a </blink> instead of a <blink>?
I think that's part of the joke :)
<A>: Like </a>this.&nbsp;
(thanks for the onebox - not sure what I was missing)
@Sp3000 https doesn't onebox
5:04 AM
5:40 AM
@Sp3000: I'd love to see an explanation of how your Spintax answer works.
k, will do - just trying to iron out bugs
Vioz didn't really specify which chars we should expect in the input
People keep complaining about CJam's readability, but I've stared at your code for five minutes and I still don't where to begin.
Must be some sort of magic. :P
@Sp3000 Yeah, I briefly thought about doing some replacements like } -> "][", but that's going to be trouble if the input contains double quotes or backslashes...
Hence my last few updates :P
So all that backslash voodoo is just to escape quotes?
Yeah :/
It's still shorter than the other Python one though, surprisingly
5:47 AM
@Sp3000 I looked at your first revision and I think I got it now. Every {a|b|c} is replaced by choice("a","b","c"), then evaluated.
If I understood correctly.
Something like that :)
Hm... escaping the quotes and backslashes packs on 18 bytes :(
Yeah, this is definitely not a method that would save anything in CJam/Pyth
@Sp3000 Even without dealing with the quotes, it's still 39 bytes.
Ahaha far too long :P
I posted because I thought it'd be an interesting approach, until I realised about quotes and backslashes :/
6:02 AM
Still the shortest approach so far in Python.
I'll take a look at splitting if I get bothered :P
Trying to do some %r voodoo but this is really messy :/
6:24 AM
Nope, regex splitting still shorter :P
@Sp3000 I don't think I've ever seen %r. What does that do?
String representation
It gets a little funky when you have quotes though, I think the priority is 1) If the string contains no ', wrap string with '' 2) If the string contains ' and no ", wrap string in "" 3) If the string contains ' AND ", escape quotes and wrap in ''
(all the while escaping backslashes)
@Sp3000 Sounds interesting (albeit complicated). Is that a Python thing? C printf doesn't seems to have it.
According to the man pages, at least.
Yeah it is - it seems to have been added in Python 2.0
It basically does what ` (backtick) does in CJam
(posted the regex splitting answer :/)
@Sp3000 Well, CJam has only one type of quotes, so there a lot less to worry about. Inspect in GolfScript is a pain though. Escapes all non-ASCII and ASCII control characters...
6:34 AM
Yeah, in many aspects, CJam is GolfScript done right. For example, popping an element of a string pushes its code point, so if you add it back to the string, you obtain "aa65" instead of "aaa"...
And you really can't have a function named print in a golfing language...
base is the one I'm more annoyed about :P
There goes all of Kolmogorov
The worst one in converting a string into the array of its code points. [{}/]
5 bytes for such a trivial task...
:) yeah I think CJam is much better in terms of design, so I like it. Still a few quirks, but much better.
Hasn't been a match for Pyth lately, but I really like the stack-based approach. I've even been using it in some code challenges.
I can't imagine writing 300 byte Pyth code. All those arities get confusing after a while.
6:43 AM
I was okay with Pyth at first, but I'm starting to not like it as much, mainly because things are a lot harder to remember
The documentation is a little sparse as well. I'd probably understand it better if I knew more Python...
Yeah, knowing Python definitely helps. You can check here for docs though, isaac did that a while back
My hat goes off to Jakube for this answer. That must have been a pain. Or fun, depending on how you're wired.
Ooh, that's nice. I've only been reading the doc.txt.
:P maybe if Jakube posted the equivalent Python it'd be easier to understand
He always posts an explanation. I'm looking forward to it.
Well, I really should go get some sleep. Have to work tomorrow.
6:48 AM
Ahaha k, have fun :)
7:11 AM
Wow, how did he manage to take so many bytes to implement gcd with a language designed for golf?
Ahaha 122, nice :P
btw if you have parens for 0**(c%g), why not do (c%g<1)?
it can be negative
... oh k
A: Sandbox for Proposed Challenges

jimmy23013Rotate a Chinese checkerboard (or diamond tiling) Your task is to rotate a Chinese checkerboard or a diamond tiling by a multiple of 60 degrees. The input is an integer and a board / tiling, Your program should rotate it by the integer * 60 degrees. You decide whether to rotate clockwise or coun...

@feersum Does a ZeroDivisionError occur for every case where there is no solution?
7:21 AM
g = gcd(a,b) so yes
Hmm I don't seem to be getting that...
(I'm trying to input 3x+4y=17, which I believe should be input as 4,3,17?)
x =-17, y = 17
what's wrong with that?
3*3 + 4*2 = 17
You need a solution in nonnegatives
why nonnegatives?
"Write a program or function that accepts the coefficients a, b and c as input and returns an arbitrary pair of natural numbers (i.e., non-negative integers) x and y that verify the equation ax + by = c, if such a pair exists." (emphasis mine)
7:27 AM
Example 2 has Output: (2, -1)
That's because example 2 has no solution, and "Your code may behave however you want if no solution can be found, as long as it complies with the time limit and its output cannot be confused with a valid solution."
Why would someone post a trick question like that?
You didn't think it was weird that [] and -1 were also valid outputs for example 2?
Might drop a comment though
8:22 AM
How could I divide in Python, rounding away from 0 regardless of sign?
What's rounding away from 0? 1/2 -> 1 and -1/2 -> -1?
8:40 AM
I can't think of anything better than x/y+(x*y<0) :/
that doesn't work
Integer results need to stay as they are
In python 2, / is integer division, right? Same as // in python 3?
Oh, right... (also I got it the wrong way around anyway, oops)
Oh - it's not as simple as I thought in python 2: "/ is floor division when both args are int, but is true division when either or both of the args are float"
Why does opening the 9th revision here in [inline] or [side-byside] not show the "show code snippet" button?
8:53 AM
@feersum Are both numerator and denominator potentially either positive or negative, or do you have a sign constraint on one of them?
It only appears when swithcing to markdown and then, switching to [inline] or [side-by-side]
@CoolGuy Revision 8: "Expanded on minimum reqs, minimised stack snippet"
@PeterTaylor No constraint
Oh hang on - that means reduced the code, not hid the buttons
I'll create a gif now so you get a better understanding
8:55 AM
@CoolGuy Just had another look - the snippet is hidden (it's a tick box option when making a snippet). This means you'll need to click on "Show snippet" before you'll see the button. It's the same in the question, not just the edit, and it's how it's meant to be.
It just saves a bit of vertical space
No I wasn't talking about that buttons
Oh sorry - start again... :)
I was telling that the "Show snippet" disappears
But now, the bug seems to have disappeared
Never mind. Cannot reproduce it anymore :/
@feersum (a+-a%b*(a*b>0))/b maybe?
@CoolGuy I get the opposite. If I open the page with it set to show inline it shows no "show snippet" link. If I then switch to a different view and then back to inline, the "show snippet" link appears
8:59 AM
I've reproduced that
I wonder why....
@Sp3000 nice, that appears to work, although I can't understand what it does lol
@feersum (n+(n^d>0)*(2*(n>0)-1)*(abs(d)-1))/d
I guess it's not too important in this case as the snippet wasn't one of the things edited, so there's no reason for it to show. If it affects edits that did involve the snippet then it would be worth raising it as a bug
Ah, Sp3000's is shorter.
Peter, is the ^ in your one xor or exponentiation?
9:05 AM
n^d>0 would test if they are both positive
@feersum If it's negative, Python's round down is correct. If it's positive, add enough to reach the next multiple of b (i.e. (-a)%b)
Hmm if it's xor then I think it works except when n is 0 (writing test cases over here)
Ooh, I don't have n=0 in my test cases
You're right: it breaks for n=0, d>0
Because of the (2*(n>0)-1), where I wanted signum but that didn't work
Python 2 has cmp for that
cmp(x,0) to be precise
9:09 AM
And (n+(n^d>0)*cmp(n,0)*(abs(d)-1))/d works
what are you guys trying to do?
55 mins ago, by feersum
How could I divide in Python, rounding away from 0 regardless of sign?
Too bad round() rounds towards zero, although floats would probably be a problem anyway
can either number be negative?
My earlier 'problem statement' said yes, but now in my program I'm thinking the denominator is guaranteed to be negative
I've got x/abs(a)*cmp(a,0)
You can drop my previous one to (a+-a%b*(b<0))/b, but with the restriction there might be shorter
9:23 AM
Excuse me, I meant the numerator is negative
Can the numerator be zero? Or strictly negative?
I can use a/b+(b<0>a%b) in this case
You can even do (0>a%b) instead, negative mod only happens when b is negative
I got x/y+(x*(x%y)>0)
9:33 AM
is this in the general case?
you can remove the parens on x%y
ok :)
Nice :)
9:44 AM
@aditsu, I've started a side project of making an Android wrapper for the CJam interpreter, taking advantage of it being in Java. It's currently in a barebones alpha form. Would you object to me putting it on GitHub when I think it's ready for other people to try using?
Hello all
@PeterTaylor no problem, although I'm not sure how useful it is to have an android version (since you can run stuff in the browser)
Could some Windows user test my Hex-challenge controller? The link is in the sandbox post: meta.codegolf.stackexchange.com/a/5445/32014
The full-featured end goal is that it allows you to set up test cases, run them all, load and save to a zip file which wraps the test cases and the script...
10:21 AM
@feersum I'm curious about your sandbox comment on the invisible target
When you say "moving to the center of the arena" do you mean Nathan Merrill's strategy of minimising the maximum path length? The arena wraps so doesn't have a conventional centre. And is your hint at a better strategy something you'd share, or something to save until it is posted to main...?
@trichoplax if there is a bottleneck leading to an enclosed region with no other players, then you shourld block the etnrance to it
even if the empty area is just 1 square, it will give you better winning chances than being in the middle of a pack
@feersum :) interesting. I guess how many squares you need to make the decision depends on how many other players are in the arena.
of course if there aren't a lot of others in the middle of a connected region, things could be different
(and how many squares are in the area you aren't guarding - which will change over time)
I'm hoping that with bottlenecks appearing and then being closed off the players should all be constantly changing their minds and scrambling around each other for the best places.
10:38 AM
I doubt the region will remain toroidal
@feersum Of course, but the centre could end up being anywhere, including on one of the edges, so it only has meaning part way into the game
As well as Nathan Merrill's centre, I guess you could also think of the mean position, or halfway between the extreme horizontal and vertical cells. There are probably lots of possible centres.
how many players are there again?
I'm leaving it open to as many players as enter - I'm hoping 1024 cells will be enough to accommodate them with plenty of room left for an interesting game.
I'd be surprised if I get enough players to make that a problem, but I suppose ideally I should specify a maximum number of players and run separate games if there are too many for one
I could say 16 or 32 is the maximum number of players in any given game
I'd be shocked if I got 32 answers though
11:25 AM
@trichoplax Does your controller keep all the programs running for the duration of the game?
Q: Format the given number of bytes to a human readable format

Rolf ツChallenge and origin On Stack Overflow a popular question is: How to convert byte size into human readable format in java? The most up voted answer has a quite nice method for doing this, but this is codegolf and we can do better, can't we? Your challenge is to write a method or program that...

@feersum It isn't written yet, but if it uses STDIN/STDOUT then yes it will (for speed)
This is one thing that makes me lean towards a language specific contest - then we could have the speed of calling a function without the overhead of running potentially a dozen programs
It would be more work but if you could run all the entries from the same language in one instance, then there wouldn't be so much memory overhead
Not sure that there would be enough to even be a problem though
@feersum I was thinking more if all the answers try to store huge arrays to help them plan. I'm not really expecting that but I'm considering functions with no memory or limited memory.
A bunch of restrictions don't seem necessary..1024 isn't very big.
11:37 AM
True. I may just reserve the right to exclude answers with requirements I judge to be absurd
12:17 PM
hi @feersum
@feersum is j =3+ looking plausible still?
12:33 PM
Hi @MitchSchwartz
1:02 PM
@Lembik It's plausible to do, though it looks less plausible that I will not be too bored with this problem
1:25 PM
Anyone want an oldie but a goodie? Here's a read from Security SE :D
Q: Is it possible the person sitting across from me at Starbucks was trying to hack my laptop?

MurvinI was using my laptop at a Starbucks on a table, and a person was using a laptop on the same table across from me, a couple seats to my side. He flicked some plastic thing across the table towards my laptop. What really freaked me out was he then actually flicked it again further to get it right ...

1:53 PM
@feersum I wanted to illustrate that it is allowed to return an integer solution if no natural solution exists. I guess I should have put more emphasis on the details. Sorry for the confusion.
2:05 PM
@Dennis Yeah, should be good. I think it was fine before, but it doesn't hurt to be a bit more cautious
2:36 PM
@aditsu Is there a way of splitting into equal sized chunks from the right? Like "abcdefg" -> ["a" "bcd" "efg"]
(3/ gives ["abc" "def" "g"])
@Geobits you like Linken right? Try Transmission. The basic principle is similar, but it's more challenging because there is no fixed grid and you can create feedback loops. Also the stars are given out for interesting objectives instead of pointless time runs.
2:56 PM
@Sp3000 not really... you could reverse, split, reverse results
or pad first, split, then cut the first chunk
Yeah, I had W%3/W%Wf% and was wondering...
maybe -3/ could be implemented to do that
I think we had such a discussion... not sure if it was about /
I tried that initially :) I'd make a ticket but SourceForge account :P
oh, I have this in my notes: "abcde"-2/ -> ["ed" "cb" "a"]
not quite the same thing
... oh backwards hmm
Which one would be more useful I wonder... my current use case is splitting a long number's digits into groups of thousands
3:01 PM
ah, the above is what golfscript does
Ah, right. I thought they wanted it for a specific challenge
he (@MartinBüttner) probably did
I'm also trying e%, but not having much luck so far :p
"%'d" doesn't seem to work
@Sp3000: rW%3/)W%\_{'.\_sW=\,"GkM"=}&'B only reverses twice.
I guess, with the W= :P But yeah that was what I was trying to do, nice :)
I guess the only problem is that there's no rounding though, for the 160581 case
3:26 PM
Q: Read 3 lines from STDIN, pass 2 of them as HTTP GET args, print the result on STDOUT

uacnixI'm looking for the shortest code, which will read 3 lines from STDIN: A number (>=0) line that can be skipped, but it will be there. A string (if that would change anything) Then take the values from 1. and 3. and do a HTTP request, using these as arguments, like somepage.com/?a=(1.)-(3.) ...

That question appears to be asking for programming help for a real world problem, but it is golf, and therefore on topic...
@Sp3000 @MartinBüttner I think ["a" "bc" "de"] is indeed more useful than ["ed" "cb" "a"]; you can get the latter easily: W%2/ and I think it's rarely needed
4:08 PM
@Sp3000 Didn't think about that.
@trichoplax It may be on topic, but I can't say I like the language restriction.
@feersum oh dear! What I can I do to make it less boring?? :)
@feersum or if you really are tempted to give up... I would be very grateful if you could leave some notes so I can take it over please
or someone else of course
@Dennis I didn't look at the language list - no golfing languages there. I guess you'll have to port your CJam code to assembly...
@trichoplax It's not just golfing languages. There's no Bash, which would be my first choice for this task.
Also, HTTP requests in Assembly. Haha.
5:05 PM
@aditsu: I sense there's a bug somewhere. 1d0d/i says NumberFormatException: Infinite or NaN, but 1d0d/i pushes 0.
both code are same, no ?
Nope. 1d0d/ gives Infinity, 0d0d/ gives NaN.
@Dennis you wrote 1d0d twice
you wrote the exact same code
5:08 PM
Calling in for mod powers
anyway, let me check that..
I like int(NaN) returning 0. Don't take that away from me. :P
Just fix the error message or implement int(Infinity) and int(-Infinity). :D
looks like that's what java does - NaN.longValue() == 0
oh interesting, since Infinity is really big, it tries to parse it as a BigDecimal
but it does that by converting to string first - "Infinity"
Infinity is really big [citation needed]
I think -1d0d/i should push 0, if only to make the logarithm "work" for 0.
except sometimes you may want -1 or something else instead
the long value of infinity is 9223372036854775807
5:23 PM
Just implement it as Graham's number. Would be nice for those "prints the largest integer in 10 bytes" challenges. :P
@aditsu that's small
Thought you were referring to Graham's number for a moment...
to be fair, that's the biggest long value
well, any particular number is small, relative to all the numbers :p
u all r giving wrong responses...
5:43 PM
@aditsu It's also pretty big, relative to the other numbers
almost all numbers are small
I think its an even distribution
The even numbers are all slightly bigger
The odds are even bigger
Oddly, that does seem to make it even
5:48 PM
@Sp3000 not if we're talking about positive integers
What are the odds of evens being bigger than odds ?
About even
Treacherous stars. I'm meant to be getting on with things
6:25 PM
A: Sandbox for Proposed Challenges

DennisMore is Less code-golf source-layout Anybody can make the output of a program bigger by adding characters, so let's do the exact opposite. Write a full program, an inner function or a snippet for a REPL environment in a language of your choice that satisfies the following criteria: Running t...

is it possible to change an edit comment? that 5 minute grouping thing is tripping me up sometimes
I tried editing the edit reason yesterday and it let me but then showed up as the old reason :(
looks like I can modify it within 5 min by making a change and reverting it
but once 5 min are up, it seems to be fixed
the problem appears when I make a change, then I make another change almost 5 min later and don't realize it's grouping it with the first one; by the time I realize, it's too late
Is that a problem because you want to two edits to have separate edit reasons?
I can see that being annoying, especially if both edits were substantial
well, in this case, the 2nd edit was fixing a problem with the first one, and also had a problem itself
so that's a bad version with a meaningless comment :p
6:36 PM
Q: Should the Sandbox be a featured meta post?

trichoplaxIt always was, and I'm assuming it has just dropped off, so this is just to draw attention to that...

I always thought about the edit comment as a way to notify somebody else why I'm editing his code.
I rarely edit other people's stuff
On PPCG, neither do I. I've edited quite a few questions on SuperUser though.
294, according to the stats.
I was quite active over there before code golf sucked me in... :P
@Jakube: Did you ever find a counterexample for your submission? I've tried lots of different inputs and all looks good so far. But since I don't understand the code, I don't really know what edge cases to test...
6:53 PM
@Dennis No, I haven't found any. But I'm pretty sure there are some.
I'm working on a better version without counterexamples. But first I have to understand the code from yesterday.
Btw the edge case is the following: the difference between -b/x and a/y has to be greater than 20, and the signs of a,b,x,y have to be in a weird way. Not sure if this is possible or not.
All of this is problematic for step 3, I assume?
20 is a really big number...that will probably never happen.
x and y are the initial solution returned by the Extended Euclidean Algorithm?
But don't bother finding counter examples. I'll change my code soon.
7:04 PM
2 hours later…
8:41 PM
@Dennis So, now I have a version without exceptions (by using 2 more bytes). And I added quite a detailed explanation.
@Jakube Looking good. I'll read it this evening.
I am very glad to report that the sandbox does not, in fact, have a tag this time. /cc @MartinBüttner :)
hi guys. Just posted a new proposal: http://meta.codegolf.stackexchange.com/a/5458/24877

Let me know what you think=)
Could any of you JS gurus tell me what I'm doing wrong here?
do i have to know the challenge?
8:55 PM
@Dennis change $('div') to $('div:not(#moves)') in the very first line?
Basically, the m should have reached the right side before the next letter moves.
At least it looks wrong to me. $('div[id^="line"]') would also work.
That makes sense, but my intuitive understanding of animate and delay is still off.
The letters move way to early. Or the animations take too long.
animate is "non-blocking"; that is, the loop continues immediately after .animate() is called.
Asynchronous, if you prefer.
You're going to have to use a bunch of nested callbacks (if you want to keep it at least nice-ish looking). Hang on, let me edit the fiddle...
I know. I thought if I specify an animation speed of 100ms and set a delay of i * 100 ms for the ith animation, I should get the correct order.
8:59 PM
A: Sandbox for Proposed Challenges

flawrBlack and White Morphing popularity-contest graphical-output Given two black and white images, the goal is creating a animated black and white gif that transforms one image into the other and back. The catch is, that for all frames the number of black pixels (as well as the number of white pix...

@Doorknob Awesome. Thank you!
Made me realize I actually made a mistake when explaining my code.
@Dennis .delay(foo).animate(bar) is basically the same as setTimeout(bar, foo) (except with a bit more stuff with the event queue and such). That is, it will delay bar for fooms, but it will still immediately proceed to the next line of code (because otherwise the browser would freeze/crash).
@Doorknob OK, got it. Those callbacks are really neat.
It's for this challenge, in case anyone's interested.
Something like .delay(i1 * 100).animate(o1, 100).delay(i2 * 100).animate(o2, 100).delay(i3 * 100).animate(o3, 100)... would work, but obviously you don't want to do that :)
9:05 PM
@Doorknob That doesn't look pleasant, no.
can anyone think of a snappy title for "Re-root a tree" that's at least 15 chars?
@xnor How to find your roots?
that's witty, but it's not really finding the root
more changing it
@xnor Uprooting and rerooting?
i like uproot
it could replace "re-root" actually
9:09 PM
Don't flip out when you uproot ? :)
is that a reference to something?
don't you have a flip in your question?
" Your goal is to flip the tree"
oh, i thought it was like a line from a song
it was meant to sound like one :)
Tree transplant?
9:11 PM
How to keep your ancestors but change your roots?
(these may not be technically accurate as I haven't really read the question :) )
@xnor by the way.. I like the question
"Turn over a new leaf"!
it's a shame it is code-golf :)
"Whose your daddy?" :)
(I think I should get some points for that.. if only for silliness :) )
@xnor that's the best one
ok, i'll go with that
thanks for the advice
do you really want exponential time solutions in cjam?
I know I am controversial on this topic
there should be a tag for polynomial time code-golf solutions :)
9:26 PM
codegolf.stackexchange.com/questions/51948/… please let me know if it needs improving
minor thing, I'd rather the strings be restricted to all caps for simplicity
and to be consistent
@xnor consistent with the other question you mean?
oh, it's not code golf
well it is sort of
it is a variant of speed-golf :)
a tag I hope will exist one day
i don't know how on earth one can do this in linear time
for substrings, one can do a rolling hash
9:30 PM
it's not at all hard as the alphabet size is constant
but I don't want to give too much away immediately :)
also, a minor thing, but i'd prefer if one could output a falsy input instead of "No!"
i always feel like my golfed code is gunky when I need to make a fixed string
Q: Turn over a new leaf

xnorYou're given a tree, which in computer science tradition, has the root at the top and leaves at the bottom. The leaf nodes are labelled with numbers. Your goal is to take the special leaf marked -1 and move it up to be the new root. [3, [[16], -1], [[4]]] --> [[[[[4]], 3], [16]]] You can im...

Q: Check if there is an isomorph substring

LembikThis question is an extension of Check if words are isomorphs and copies the first part of it to give the definition of an isomorph. Two words are isomorphs if they have the same pattern of letter repetitions. For example, both ESTATE and DUELED have pattern abcdca ESTATE DUELED abcdca beca...

i'm still not seeing how to do an update on the rolling window in constant time...
maybe i'm missing some amortization
this seems like one of those problems where making any solution is a challenge, which i'm a fan of
you're probably going to get a lot of incorrect submissions, unfortunately
oh, that's so cheap, with the constant alphabet size!
9:52 PM
you got it?
it's really not a challenge to make any solution.. you just have to think about it the right way
2 hours later…
11:49 PM
190 reputation today and 10 minutes to midnight. Stupid badges...

« first day (1603 days earlier)      last day (3282 days later) »