« first day (1405 days earlier)      last day (3455 days later) » 

12:08 AM
@Sp3000 is that Python 3?
 
12:20 AM
okay it is
and I've got the plotting script
 
1:00 AM
0
A: Sandbox for Proposed Challenges

Martin BüttnerForming Polyominoes with a Chain of Rods code-golfcombinatorics Consider a (closed) chain of rods, each of which has integer length. How many distinct hole-free polyominoes can you form with a given chain? Or in other words, how many different non-self-intersecting polygons with axis-aligned si...

 
@Sp3000 @PeterTaylor what do you think about code golf vs fastest code for the chain-of-rods challenge? I'm usually not a big fan of code golf for NP-complete problems, because there's little incentive in finding interesting ways to truncate the search space. At the same time, the necessary data structures probably do make a not-too-bad golf even with a naive algorithm.
How about posting separate challenges? One code golf, which only needs to handle small test cases, and a fastest-code challenge where answers are scored on large random inputs?
(And if I can find a 3rd scoring criterion that makes sense for this challenge, I might finally be able to do my triathlon :D)
 
 
3 hours later…
3:39 AM
@MartinBüttner So how do you like being an example for all the icy avatar image answers? :P
(Also, sorry to everyone for being decidedly less active on PPCG recently. It's been really crazy on Puzzling.SE and there's just been a lot of stuff IRL going on in general; I promise I'll be entirely back soon. :) )
 
4:24 AM
Hope Puzzling goes okay :/
 
5:18 AM
@MartinBüttner Just realised I still count two angle-strings as equal if they're cyclically equal after you swap As with Cs. Not that it changes any results though, because you're requiring them to be anticlockwise :P
By the looks of it I'd say either fastest code (I feel the same way about NP-complete). Either that or code-golf with some sort of time limit to prevent purely brute force solutions
 
5:46 AM
@Calvin'sHobbies For the 95 movie quotes challenge, I know a language prints the quote to stdout and exits abnormally, and prints an error message to stderr. Can I use it? I think better not. But if I post other answers, it will be likely no more usable...
 
 
3 hours later…
8:58 AM
@Doorknob冰 ...honoured?
 
If someone asks me, I feel offended!
hmph
 
Code golf and fastest code in parallel? Hmm have we ever had any challenges with two winning criteria out of curiosity?
 
which one ?
 
@Sp3000 well, I'd probably actually post two questions to keep the answers tidy
 
Oh... hm...
Well that'll be an interesting first :P
 
9:16 AM
well, some people don't like golfing, and some people aren't interested in fastest code, so with two questions, everyone could pick their preference or compete in both of them
we've had some discussion on meta about whether the same question with different winning criterion is a duplicate, but I think in this case it isn't... you can certainly always improve the fastest code answer by pruning the search space, which will inevitably cost you characters.
I wonder if you can actually speed things up by solving subset sum first
I mean, all valid configurations need an even total horizontal and even total vertical length, each of which can be split in half
@Sp3000 btw, that's the reason there was no solution for [1,2,3,4,5,6,7,8,9].
 
Makes sense
Well I did mention subset sum before, but once you fixed the rod order I wasn't sure how to use it any more...
 
well you can still solve subset sum to assign UDLR to the rods
well, I've gotta go... ttyl
 
9:37 AM
(Actually yes, subset sum is faster. The naive search space is 2^n, whereas the total search space for the rods is 3^n. However the latter might be easier to prune.)
 
Hm k...
 
9:52 AM
@MartinBüttner I don't think it has much by way of data structure requirements. If I did a golfed implementation in GS I would just want to track the points visited (to detect self-intersection) and then I'd do a normalisation procedure to identify duplicates.
 
10:35 AM
@Peter yes, data structures was the wrong word. I still think identifying the duplicates and checking counterclockwise traversal are interesting to golf.
 
11:23 AM
Must.... beat... Haskell! (Not that I'll ever get close to Peter)
 
I used to think like that with JS initially
then , I simply used the old saying
if you can't beat them, join'em
 
Ahaha well if I Python 2 now, I've got it :P (but backticks are ugly :/)
 
grc
@Sp3000 can n be negative in your solution?
 
In my latest one...yes
In the case where the binary of the previous n ends in 11
The idea I'm currently onto is if the binary ends in 1, the last digit must be 1. If it's 0, then it could be 0 or 2
Then divide and recurse
 
grc
'n>0 and' can be 'n>0and'
 
11:33 AM
Oh, right. That. :P
Does that work in Py2?
 
grc
both
 
Neat
...maybe I just use Py 2, I like Py 3 though :(
(Originally had exec and what not)
k, 76 in Py2
 
If n>0and(n%2<1) then n is positive and even, so you could as well have n>1and(n%2<1). Am I correct in understanding that in Python that can be (n%2<1<n) ?
 
The parsing is <n>0> and <(n%2<1)*S(n/2-1,"2"+B)> + <S(n/2,n&1+B)> or [] so I can't quite collapse them
 
grc
also, the 'and' is needed for short-circuiting
 
11:40 AM
@Sp3000 That doesn't have enough brackets to disambiguate it for me
 
(but on its own, then yes chaining comparisons would be quite nice :P)
 
what are you guys golfing?
 
Is it n>0 ? (case1 + case2) : []?
 
Erm... think of it as (n%2<1)*S(n/2-1,"2"+B) + S(n/2,n&1+B) if n>0 else []
Yeah ternary
 
should i be looking at the answer you posted, sp3000?
 
11:42 AM
Oh erm...
 
or is obsoleted by stuff in the chat?
 
Well you can always try golfing it yourself :D
That's another option :D
(but the answer's up to date, fyi)
 
well, i haven't thought about the problem, but let be do a golf "editing pass" on your code
[B]*(n==0) can be [B][n:] assuming n<=0
 
The way it currently is, n could be -1 though :/
 
oh, awkward
 
11:45 AM
Maybe it'd be worth ensuring n is nonnegative...
 
ok, i'll give this a stab myself
 
S=lambda n,B="":n<1and[B]or((n%2<1)*S(n//2-1,"2"+B)+S(n//2,str(n&1)+B))
n can't be -1
 
Oh, n<1and[B] nice :o
Losing the outer parens after the or and converting to Py2 makes that... 64 :o
Question: Does ~n%2 in place of n%2<1?
 
If that's acceptable as a Boolean, yes
 
grc
Nice! I think you can drop the parens around ~n%2 as well
 
11:55 AM
Oh, is precedence a%b*c -> (a%b)*c?
 
grc
yeah I think so
I'll check
% has same precedence as * and /
 
But left to right, I see :P
 
grc
-n*[B]or might work
 
No, -0 is 0
 
grc
oh right
 
12:03 PM
yeesh, 61!
 
Beat Haskell [/mission accomplished] :D
That went surprisingly better than I thought - for a while I was expecting a ~100 solution
 
what you have looks totally different than my attempt right now
f=lambda n:[''][n:]or[x+str(i)for i in[0,1,2][n%2::2]for x in f(n-i>>1)]
pretend that str is instead python 2
oh, you're building the string forward
don't i feel silly
 
Ahaha if you look through my history, you'll see my first submission was
def S(n,i=0,B=[],O=[]):
 O+=["".join(map(str,B))]*(n==0);2**i<=n>0 and[S(n-j*2**i,i+1,[j]+B)for j in(0,1,2)]
 if i==0:P=O[:];del O[:];return P
:P
Hmm what's with the ['']?
 
don't i need it for the base case?
 
[0,1,2][n%2::2] <-- neat
 
grc
12:08 PM
what about [B][n:]or
 
Oh... that seems to work now :o
Oh right I see what you're doing xnor
nvm
 
@Sp3000 {n%2,2-n%2} is better
 
Ahaha sets
I hope OP doesn't add 0 as a test case
I think we'd all fail that ;D
 
honestly, i think the number 0 should just be the empty string
our written convention is just wrong :-P
 
:P
Hmm are you trying to build your string the other way now?
(I'm assuming you're trying to save on for loops)
 
12:19 PM
i am
it's annoying hard to concatenate the lists though
the double for was doing that before
i think i'm going to have to add them explicitly
...which is converging more and more towards what you have
 
Ahaha the double for loop was neat
But yeah, convergence :/
 
12:38 PM
I wonder if it's any shorter to do what you guys are doing with the ternary strings...
 
@MartinBüttner we should totally discuss about CJam golfing.
too much python golfing discussions
 
:P I'd be all up for FRACTRAN golfing
But nobody ever seems to want to discuss that :(
 
what about Whitespace golfing ?
 
@Optimizer, you usually seem too busy trying to beat me to be interested in collaborative golfing :P
And I would totally fix that typo if I wasn't on mobile.
 
:P
I helped you with the semo... one !
 
12:46 PM
*reads Whitespace spec*
*backs away*
 
@MartinBüttner What typo? :P
 
1:03 PM
yingluck
 
Ahahaha :D
 
1:19 PM
I wish, for the sake of golfing, that sum(["a"], [1], [], ["xyz"]) worked :/
 
For the sake of golfing ^that is "a"a1aR"xyz"a] in CJam
 
Well I meant something that concatenated arrays together, but I assume CJam has that anyway
 
]:+
 
Yeah :/
Damnit Python sum
 
 
1 hour later…
2:26 PM
@MartinBüttner the negative quine question got me over 50 votes! my highest yet
 
my pleasure ;)
I think it's also my most successful question in terms of rep generated for others
 
I almost said Unscramble but that wasn't you :P
The regex CNR and regex golf have done a lot for me though
 
@Sp3000 unfortunately not ;)
 
2:48 PM
@Optimizer I just tried the maximum cost path grid thing, and got.... 71 bytes...
 
Different solution? :P
I mean method
 
I didn't look at his code
 
Ahaha k
 
@MartinBüttner and @Optimizer, are you both making the same assumption that I mention in my comment on the question? If so, I'm inclined to edit the question. If not, I'll vote to close it as unclear.
 
@PeterTaylor I do, because otherwise his example outputs don't match.
(well, we don't know about the first cell, but the last)
 
2:58 PM
Well comment's here
 
oh, nifty
I just noticed I need a few more characters to deal with the case that no result exists, but being able to assume that the top left corner is 0 saves some
 
@MartinBüttner His example outputs leave the first cell completely in the air, which is why I asked the question rather than edit back then.
 
damn, 73
69!
 
3:27 PM
first and last cell both are non empty
as far as I can see
@MartinBüttner your code assumes first cell to be always 0 ?
 
OP replied to my comment almost immediately after I asked the question in chat.
I'm not sure whether that was coincidence.
 
Ah okay
I so have to think of a new way to get all combinations ..
 
3:53 PM
@PeterTaylor WTF !!!
/cc @MartinBüttner
 
I was pleasantly surprised by how short it turned out to be.
 
/cc @MartinBüttner
@PeterTaylor better submit a cjam too
also, how did u figure it out that way ?
 
Maybe I should write a GS->CJam source-source compiler.
Not sure what you mean by that question. It's the obvious way.
 
can you explain your code ?
 
CJam doesn't have big integers, does it? I think I saw in the source that it uses Long
So a straight port wouldn't meet spec.
 
3:59 PM
oh. at least explanation for GS one ?
 
@Optimizer dude, relax :D
and yes, I assume that, because that's what the OP said
@PeterTaylor it does (have bigints)
@PeterTaylor "obvious"... :D
the "obvious" way is to generate all permutations of [(N-1)*right, (N-1)*down], find the paths, sum them up, remove negative paths and take the minimum ;)
 
which we did
hmph
 
@MartinBüttner, maybe that's because you studied Schrödinger wave functions instead of dynamic programming in the first year at uni.
 
Wait, so you guys aren't DPing that question? ... oh right, code golf
 
@PeterTaylor :P ... I did indeed study dynamic programming in the first year at uni... but that was a while ago, and I never actually had to use dynamic programming until joining PPCG ;)
 
4:12 PM
man, I should have taken CS courses bit more. Still don't understand that algo ...
 
A while ago? You're still a student!
 
Maybe someone should post a max flow so that I can see someone actually use Ford-Fulkerson :P
[/things you learn but never use]
 
(also Schrödinger wave functions are 2nd year material for physicists :P)
@PeterTaylor doing my second degree
my first year at uni was 2008... not using something for 6 years makes it a while ago, I'd say
 
(Yeah, ok. I did a slightly odd degree which required me to do as much physics as physicists in the first year, and we barely touched QM)
 
@PeterTaylor I think I would have loved doing that degree... would have saved me a lot of time :D
 
4:17 PM
As a side-effect, I was a student member of the IoP for three years. Apparently I remained on the list after the first year as an unrequested favour from the president of the student physics society, whom I knew vaguely and who knew that my dad taught his sister physics.
 
heh
that does explain how you know so much about CS, maths and physics though ;)
 
4:33 PM
(Hmm is 5/6 days too early to accept an answer?)
 
I tend to wait 7
I personally wouldn't mind accepting earlier, because I change the accepted answer if something better comes along, but some people seem to take offence...
 
Hm...
 
I added some more test cases to the polyominoes thing
at least two of them ensure that holes aren't counted
 
Woah that's a lot
(now I really hope my program's correct ;D anyone else fancy trying?)
Speaking of sandbox I should post my followup RNA question...
 
I also need to write up a draft for "What language is this written in?"
although the hard part will be collecting data for that
 
4:45 PM
Need help?
 
possibly, once I've sorted out where to collect it from and how to collect it... but I think 3 "levels" would be nice... a simple set from Rosetta Code... an advanced set from SO... and the Super Hexagon set right from PPCG
speaking of which...
 
(I'd post a reverse-complement Rosetta stone question...but we still haven't figured out how to count two languages as different...)
(Damnit Python 2/3, C/C++/C# and all the Lisps)
 
5:24 PM
0
Q: Does anyone know why there's a weird symbol in place of the 1 in this comment?

Not that CharlesThe comment at Sum of strings without converting displays strangely on Firefox 33.1 on OSX 10.9.5. Look at the numeral 1 inside the parens in each_cons(10). Any idea why? What is that character that got in there?

 
@Sp3000 ugh, I keep surviving Rain and dying on some really simple wave right after it...
 
did u all purchase vvvvvv?
 
Ah... ouch
 
also, the girlfriend keeps pestering me that I should defeat some boss for her in Super Panda Adventures (which is a really decent game btw)
@Optimizer I did
@Optimizer but I'm talking about Super Hexagon
 
"Super Panda Adventures" is a decent game.
Super Hexagon is free ?
 
5:29 PM
no
 
these are all indie games, right ?
 
I was going to say Super Hexagon's on sale on Steam
But I think that's over
(not that it's much anyway)
 
Does anyone remember when I said there was a guy who trips over himself all the time at my office?
I found out why he trips. He sits with his legs in a weird position, and his foot goes to sleep.
 
0
A: Sandbox for Proposed Challenges

Sp3000Longest reverse palindromic DNA substring As you may know, in DNA there are four bases — adenine (A), cytosine (C), guanine (G) and thymine (T). Typically A bonds with T and C bonds with G, forming the "rungs" of the DNA double helix structure. We define the complement of a base to be the base ...

 
@Doorknob冰 You changed your name to Doorknob "Ice"? What's that about?
 
5:43 PM
I assume it means that winter is coming.
(Summer here though)
 
I thought it meant the door was stuck. Have you ever tried opening a door where even the knob is icy?
 
@Geobits I hadn't thought about that. "Doorknob Stuck". What a great name!
 
Not as good as Snowbolt :P
 
ThunderBolt
?
 
5:54 PM
I should think of one for myself this year. Last time it was 'Generic Holiday Name'.
 
'Cooler'
SubOptimizer
 
I'm cleaning up our CSS, and one of our styles is named k1bbbb3bb
.k1bbbb3bb {color:#0072bc; font-weight:bold;}
 
isn't that a company secret ?
 
I would've guessed it was really bold.
 
Pretty sure that my Oath of Silence doesn't forbid me from extracting single lines of code.
 
5:58 PM
standard loopholes forbidden ?
 
We abuse loopholes like crazy here. If the customer says to print "5", we print "5".
 
Does it stand for, er, Keyframe 1 Big Bold Blue Banner 3 Background Backdrop or something?
 
That's an excellent guess. Totally wrong.
 
:( but it's even blue!
 
Read my profile "about me" @Rainbolt. :P
@hichris123 don't you dare
 
6:01 PM
@Doorknob冰 I refuse to believe that you are 13. Same with @cjfaure. I only did immature things when I was 13, therefore so did everyone else.
 
Huh. I was pretty mature at 13, iirc. It wasn't until 14-15 that I turned bad ;)
 
Wow at 13 I was what... screwing around with Actionscript. D:
 
@Geobits I like the idea of a serious of t-shirts on theme "the day I turned bad"
 
6:15 PM
@PeterTaylor What do you think about the restricted source part of the threes challenge? Is it different enough?
 
hell tough
and to break the code on insertion of space
give me a break
 
My first thought was "well there goes Python"
And you need something where space isn't a NOP
I'm assuming that was to rule out CJam or something
 
@Optimizer that shouldn't be too hard in a "real" language...
@Sp3000 I think it should be possible in CJam
 
Really? Even with the space thing?
 
yeah
just do some funny base conversion stuff before running the code
then you only need to bulletproof the base conversion
 
6:23 PM
Oh I know what else you can do it in... Ook! :P
 
@Sp3000 no, that has groups of 4
actually no
you're right
 
I guess it depends on whether the implementation requires spaces between each Ook!
(this one doesn't seem to gc.de/gc/ook)
 
hm okay, no it's pretty tough in CJam as well...
and in "real" languages it's hard because keywords and builtins...
hmmm... Marbelous? :D
inserting spaces will definitely break it, but satisfying the layout in the first place is tough... and the problem itself is way too difficult for marbelous
 
No, ok, the crazy source restriction makes it different.
 
Woop I take that back, Ook! doesn't work because you can insert spaces without breaking anything
This works :P
 
6:32 PM
Whitespace
 
That too :P
Nice
Oh wait... tabs?
 
what about tabs?
oh
he's asking for printable ASCII
bloody hell
 
"the words are each separated by one non-alphanumeric printable ASCII character or newline"
Yeah
 
so Lenguage...
okay... different topic... how would I score fastest code for the polyomino challenge? I'm thinking I could provide random test sets for N = 10, 11, 12, ... (say 20 to 50 for each N). your primary score is the highest N for which your code runs within 5 or 10 minutes, say. tie breaker is actual time taken on that test set.
 
That sounds pretty reasonable.
 
6:37 PM
my main issue is that the amount of solutions (and therefore probably also the relevant part of the search space) depends a lot on the actual rod lengths... if they are very uniform, you get a lot more solutions than if they aren't.
 
I think random numbers would have 0 solutions in most cases
 
so on the one hand, using random sets will probably not include this worst case. on the other hand, the single case of [1]*N might actually outweigh several other test cases, so if I did include, scores could be largely dominated by the performance on this set
 
So... yeah dependent on rod lengths
 
@Sp3000 let's say, random solutions with an even sum
 
Well even sum already rules out half
Oh right
Hmm quite the range from looking at only even sum
{0: 30, 2: 29, 1: 18, 3: 13, 5: 4, 4: 3, 7: 2, 8: 1}
That's 100 runs of 8 rods lengths 1-4
 
6:49 PM
interesting
 
Hmm weird, I got 89 and 113 for your last two cases
Oh I had the A<->C section commented out
... so it does affect the code, man now I have to think
 
can you have a look at the revised spec?
@Sp3000 wait, I have it commented out as well
lines 37 to 44?
 
Yeah
Actually that doesn't seem to be the problem
 
that's.... odd...
 
Maybe I have a mutabl default argument somewhere, cos rerunning it multiple times is what causes problems
(Might just be my modification to return all solutions rather than printing them that's wrong)
 

« first day (1405 days earlier)      last day (3455 days later) »