« first day (1651 days earlier)      last day (3209 days later) » 

12:27 AM
Nice tip :)
@Geobits Barring cases where you don't need to do list() as trichoplax points out, the only golfier way I know is to grab 3.5.0 from beta and do [*s] :)
 
 
3 hours later…
3:06 AM
@Sp3000 16 sounds about right
 
3:27 AM
@Dennis I saw the new tip post, thanks. The part with the ^ operator is very creative.
 
3:50 AM
@RetoKoradi Thanks! I think I've used it for the first time in this answer:
0
A: Convert a bytes array to base64

DennisGolfScript, 80 (77) bytes ~.,~)3%:P[0]*+[4]3*\+256base 64base{'+/''A[a{:0'{,^}/=}/{;}P*'='P*]4>76/"\r ":n* The above will fit exactly 76 characters in a line, except for the last line. All lines are terminated by CRLF. Note that RFC 2045 specifies a variable, maximum line length of 76 charact...

GolfScript has no operators that turn to upper- or lowercase, so it's a lot more useful for GS.
 
4:19 AM
@RetoKoradi You don't need a special case for empty input if you use hs-].
 
@Dennis Clearly you're an expert with golfing languages, CJam and GolfScript in particular, but how are you with "regular" languages?
 
Not that good. Bash scripting aside, the only language I'm fairly fluent in is C.
 
Oh right, I had forgotten that you learned Bash from Bashman or whatever his name was.
 
No, no, no. That was Batchman, for DOS batch scripts.
IF ERRORLEVEL 1 GOTO THAT and such. Brrr!
 
:D
 
4:25 AM
@AlexA. Dennis is the guy who uses CJam for challenges that are not golfing challenges!
 
@Dennis Perhaps you should write a book for Bashman, his arch nemesis.
 
@RetoKoradi I am. I keep getting weird looks for that. :P
@AlexA. Writing a book for Linux geeks? Bestseller!
 
:P
 
Also, I couldn't draw if I got paid for it. Which I wouldn't. :P
 
I could do illustrations if you did the writing.
But no, I'm sure no payment of any kind would be involved.
 
4:28 AM
OK, now ye're talkin'.
 
A lot of work and collaboration with a stranger for no money? Where do I sign up??
^ description of all open source projects ever
 
I'm actually amazed how well many open source projects work.
 
0
A: Sandbox for Proposed Challenges

vihanImage to Unicode Today you decide you don't want to use images anymore so you decide to convert all your images into text. Example Input / Output Input: Output: ██ ████ ████ ██ ██ ████████ ██ ...

 
@Dennis hs- ... indeed! How do you even come up with this stuff? ;) Your brain must work in CJam.
 
Granted, wget can't (and couldn't for the last years) handle dropped SSL connections (which shouldn't take longer than 10 seconds to fix), but everything on my PC is open source and most of it works pretty darn well...
 
4:34 AM
@Dennis Oh I'm not bashing open source projects at all. I think they're awesome. I was just making a bad joke. :P
 
@AlexA. I got that. I just seriously surprised. I thought people were greedier.
 
@AlexA. They may be awesome as long as they do exactly what you need, and don't have nasty bugs. Otherwise they may end up causing you more work than they save. Yes, I may have gotten slightly cynical after spending weekends at work trying to fix bugs in horrible open source projects.
 
@Dennis I have so many things to say about The SAS Institute, Inc. and their greed regarding their flagship product, SAS. Too many things.
@RetoKoradi That can also be said of commercial products as well, but in those cases you can't fix all of the horrible bugs.
 
I'm thinking more of open source toolkits/libraries used for software development.
 
@AlexA. A quick look at their web page seems to imply that SAS is free of charge.
Is that not true or are you talking about other aspects?
 
4:45 AM
@Dennis That couldn't be further from the truth. A single user license costs upwards of $10,000 USD.
For the base product.
They have a "university edition" that's free of charge.
 
Ah, yes, it's the Uni edition.
Not really sure what that means. Or what SAS does... :P
 
It sucks. That's what it does.
:P
(I'm a very bitter SAS programmer)
 
It's a statistics package, right?
 
It has extensive statistical capabilities, but it can be used for other things as well.
 
Yet you use it for code golf. ;)
 
4:48 AM
Once or twice. When it's a full moon.
On a completely unrelated note, the only thing I've ever posted on Code Review just got a gold badge. :O
Famous Question -- 100,000 views
 
Isn't it 10,000?
It is. viewed 10001 times and I'm the 10,001th.
 
I'm bad at numbers and stuff and can no longer edit my post.
._.
You are correct, it's 10,000 views.
 
Yeah, the editing windows in chat are cruel.
 
This makes up for it:
49
Q: Do centaurs suckle from horse nipples or human nipples?

Ash SmithThis has been puzzling me, because if the human half needs human nutrients, then suckling from the human nipples makes sense. But the horse half needs different nutrients, so which set of nipples makes most sense?

2
 
Wordbuilding has a lot of questions like that.
I like this one:
38
Q: Dragons and aviation bureaucracy

ShalvenayOnce you do the handwaving needed to explain a modern-day world with flight-capable dragons in it, how would said dragons interact with the bureaucracy surrounding flying in the modern world? What sort of pilot's license would they hold? Would they get certified as an aircraft of some sort (per...

 
5:00 AM
That's incredible.
Not from WorldBuilding, but related (and equally fantastic):
98
A: The Memes of Arqade and its Chat

Raven DreamerMeme: Questions that are absurd without context Originator: Various Cultural Height: As Often as Possible Background: How can I get my wife to stop nagging about a few murders? fable-3 Can I pass out from excessive drinking? bioshock How can I tell if a corpse is safe to eat? nethack How c...

@Dennis, just FYI, if you write for Bashman, I will illustrate. ;)
@Maltysen Going to do a Pyth answer for dosas?
 
5:19 AM
@AlexA. I might do CJar:
 
...?
 
CJar, the CJammer.
 
:)
 
@BassetHound i know it's not exactly what you're looking for but in many cases eval(s) can stand in for s.split(",")
 
5:38 AM
@AlexA. You had to uppercase Salt and Water, didn't you?
 
@Dennis Indeed I had to. It was required.
 
@Dennis awesome, thanks :)
 
@AlexA. So far, the only meaningful reduction of the source code's length I can achieve is to convert the entire thing from base 126 to base 256, which saves 13 bytes. Pretty ugly.
 
@Dennis I think you're the only person even thinking about the challenge at this point, so I'm fairly certain you'll end up getting the bounty and winning, even if only by virtue of being the only answer. :P
 
@aditsu Did you see my latest ticket? I finally know why permalinks are broken in Firefox...
 
5:44 AM
@Dennis yeah, I kinda knew that already, but it's good to have a ticket for it
 
For now, I'm including two permalinks in affected posts. Yuck.
Even unprintable characters work fine in FF if I replace each % with %25.
Please do fix. :)
 
I wish there was a standard and browsers agreed on that :p now I will probably have to do browser sniffing, like in the 90's/early 00's
 
Browser sniffing? What do they smell like?
 
@aditsu If you can live with sending the code to the server, just use ? instead of #. Firefox doesn't mess with window.location.href.
 
@AlexA. they tend to smell like everything these days... e.g. "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36"
mozilla, linux, apple, webkit, khtml, gecko, chrome, safari - everything's in there, except msie :p
 
5:52 AM
Also, since we're already talking about the online interpreter, it would be nice if something else than prompt could be used for copying permalinks. It truncates the permalink after a certain amount of characters and sometimes introduces newlines.
 
^ Sniffing assistance
 
@Dennis I think dealing with the encoding is a much smaller and easier job
and query strings are probably more limited than fragments
@Dennis oh, I was not aware of these problems
btw, patches are welcome :)
 
@aditsu I don't know about limits, but wouldn't replacing window.location.hash with window.location.href be more or less it?
 
oh, you mean still just handling it on the client side?
btw, I think it's location.search
it will still generate new requests to the server though
and the server has to validate and parse the query string
 
@aditsu Yes, that was the intention. location.search is even better. Replace that, a # with a ? and you're done. Not pretty, but no browser sniffing. :P
 
6:00 AM
You should still give the sniffing dog a treat though.
 
yes that's easier, but it has the problems I mentioned
 
Another option would be to Base64 encode the code/input. No sniffing and no molesting the server.
As long as a URL safe alphabet is used (- and _), no browser should mess with the hash.
 
that's a lot more code than sniffing :p
 
How portable are btoa and atob?
 
I think we discussed that, they don't play well with unicode or something
 
6:05 AM
Yes, that would require applying UTF-8 encoding first...
@aditsu Probably a stupid idea, but what if you append &test=%25 to the permalink? A hash containing &test=%25 hasn't been decoded, so decodeURIComponent has to be executed.
Still not ideal, but better than building a database of browsers that do or do not decode the hash by themselves.
 
haha, interesting
maybe it could work with just &% at the end
I hereby call it the andpercent :D
 
That doesn't get modified since it's malformed... &%26 would work, but break old permalinks...
 
6:21 AM
I guess you're right... then &%25
no breakage, old links can be handled in the old way
 
I got backwards compatibility backwards.
 
Aditsu "Andpercent" Jones
I have absolutely nothing constructive to add to this conversation and yet for some reason I feel I must interject randomly.
 
I liked the K-9 unit :)
 
:)
If I ever become a mod, I'm going to change my name and avatar to "FUN POLICE."
 
I can probably add some heuristics to figure out the encoding automatically in some cases
e.g. if there's a % that's not followed by numbers, it must be already decoded
or if some characters are present that would normally need encoding
 
6:29 AM
Just 404 everything and claim the server is down temporarily.
 
I just realized... this problem can mess the parsing of code and input - compare cjam.aditsu.net/#code=%26input=foo in the 2 browsers
 
Yup. Hashes aren't supposed to be used this way...
URL encode, then Base64 encode. Done. :P
 
that will probably get too long; maybe I can define my own encoding
 
Just convert everything to geo bits.
Okay, I have nothing else to add. Good luck with the encodings, gentlemen.
 
I still need to golf my answer :p
@Dennis it seems that I can't get the chars I want with your :,:^ method
 
6:48 AM
This is starting to get painful. The shortest partial fix I can think of adds 15 bytes and still doesn't deal with 1e2e3, which happens to eval to an integer.
@aditsu I've added a last example to the tip. It's not possible without rotating the result.
 
ah right
 
0
A: Sandbox for Proposed Challenges

PyrrhaRed Strings of Fate code-golf (This is the classic "join pairs without any paths crossing" problem. It's probably been asked before, but the problem is it goes under so many different premises that I can't find any duplicate.) Synopsis: Given the positions of pairs of lovers on a non toroid...

 
it doesn't seem to save characters... I'll try a mixed method
 
0
Q: Longest portmanteau

PureferretI've been using a library called Djangular recently, which integrates Django and Angular. After a while I thought 'Wouldn't it be fun to programmatically generate portmanteau?' Here are some examples (e.g. testcases): Django + Angular -> Djangular Camel + Leopard -> Cameleopard Croissant + Don...

 
@aditsu It doesn't. I think A,s'[,_el^+"<=>"+ or "0:?[a{A<":,:^Am> is as short as it gets for this one.
 
6:57 AM
nope, I got 1 shorter :)
 
\o/
 
7:14 AM
@Dennis updated now :)
 
@Dennis you can have A,s for your CJam tip if you want
it fits better with yours than mine
 
huh, Reto's updated {(Kmd)L=\}hs-]W% is now just as short as my La{(Bmd)M=\j\+}j
 
7:36 AM
@aditsu The hs- was suggested by Dennis. You know I never would have come up with that one. ;)
I think the main advantage you solution has now is that you're taking all 3 values as a single input. Clever use of flexible input rules!
 
@RetoKoradi I don't know :) but I think it's interesting, as I also tried a similar loop initially before switching to j
 
hi @Vioz- and @Sp3000
 
@RetoKoradi yeah, and converting to numbers in 1 step, although I also saved 1 more character in building the string of symbols
 
If there's any CJam operator I don't understand, it's j. Well, I did see an example, but it just didn't look like anything I would have a use for anytime soon.
 
I now get 2, 4, 10, 16
 
7:42 AM
@RetoKoradi read this if you want to learn more :)
 
for n = 1,2,3,4
 
@aditsu Actually, I don't think I changed the content of that loop. That should still be original. What Dennis helped me with was getting rid of the special condition for the empty input, by finding a clever way of trimming off the extra 0.
 
@aditsu you should probably link to that from operators page
 
Yeah, I believe that's where I saw the explanation. It seemed like more than I could digest when I first saw it. Which was probably the day I started learning CJam. I should give it another read sometime.
While you're here, what are the release plans for new versions? There were a couple of things I meant to file. Not actual bugs, but ideas for improvements that I think would be helpful.
 
@MartinBüttner I should write more detailed documentation and include it there, but I guess this is a quick temporary solution
 
hahaha :)
@RetoKoradi well, I plan to fix the main bugs and add some new features... no detailed plans, but I should have some time for it in the near future
 
it's funny because it's true. don't get me started on temporary fixes
 
hi @MartinBüttner
 
morning
 
I don't know if mathematica has a max independent set function or a max clique function but would you be able to (please) verify my answers before I post them ?
feel free to say no :)
 
7:52 AM
did you not say you got yourself a Pi? :P
 
I gave it away!
to someone who actually needs mathematica :)
 
there is FindClique which finds the largest clique if not given any additional parameters
 
it saved them about 900 euros :)
that sounds good
 
there's also FindIndependentEdgeSet and FindIndependentVertexSet
 
I plan to implement the "automatic q", but it's a bit tricky to do it well (the debugging option)
 
7:54 AM
mathematica has everything :)
 
@Lembik so what do you need me to do?
@aditsu automatic q? golfscript-style?
 
@Lembik heh, I have two Pis but I want the new quad-core one
 
@MartinBüttner I am about to post a question.. 2 minutes.. then I will send the link
@aditsu there is a quad core one?!
since when?
 
since shortly after I bought my 2nd single-core one ><
 
and shortly after I bought one too !
 
7:57 AM
@MartinBüttner not like golfscript, but every time it tries to pop from empty stack
 
:(
well I guess it's better than nothing at the bottom of the stack
 
why frown? I think it's better than the golfscript way
 
that's true, but I'm not sure it's better than 0 or "" or something configurable at the bottom of the stack
maybe you could make it configurable anyway and it defaults to q?
 
q returns "" after the first time
 
oh
hm okay
 
7:59 AM
if you could verify my answers that I have given that would be really kind
 
0
Q: Finding a maximum size subset where no two answers match

LembikFor a given positive integer n, consider all binary strings of length 2n-1. For a given string S, let L be an array of length n which contains the count of the number of 1s in each substring of length n of S. For example, if S = 01010 then L=[1,2,1]. We call L the counting array of S. We say th...

 
@Lembik did you forget to specify n=3 in the first example?
 
the S = 01010 example?
 
yeah
(it can be inferred, but it might be clearer)
 
done
thanks
I should say I will be impressed already when someone solves n = 5 :)
which I am sure they will.. because ppcg rocks
I also tried to make it so that people can try optimization methods rather than having to find the optimum answer
which hopefully makes it more interesting
I hope to get the prize for the largest number of new and unsolvable puzzles one day :)
 
8:09 AM
@Lembik I get 32 for that
let me check your other inputs
wait
 
I would love to know how you solved n = 5
 
that was for n =3
oh
 
2^5 = 32 so that looks wrong
 
one sec
yeah
the problem with too similar variable names...
 
:)
 
8:12 AM
okay, I've reproduced your results now
 
great!
thanks
is your code clever enough to do n = 5?
 
probably not... running right now
oh it is
 
mine isn't :)
 
oh!
I am very impressed
 
8:13 AM
I'll post that, just for fun :D
 
you should post an answer
exactly :)
not in the OEIS :)
2,4,10,16,31 that is
 
did you make up the match definition or is that a thing?
 
I made it up
I make up stuff :)
well.. people do talk about approximation algorithhms
 
@Lembik I thought you were going for the prize for the largest number of puzzles involving binary matrices and vectors? ;)
 
so it's a bit like those definitions
@RetoKoradi I refute that :) All of programming is about binary numbers and vectors
 
8:19 AM
okay, but then it's not too surprising it's not in OEIS ;)
 
people just sometimes use different words
@MartinBüttner :)
@RetoKoradi and my strings are hardly matrices :)
 
that was the "and vectors" part
 
ah yes :)
 
then again, a vector is just a matrix with one row/column
 
well I still claim all of programming is about strings of binary numbers :)
@MartinBüttner a lovely answer as ever!
 
8:26 AM
@Lembik I'm probably just dense here, but in your question, if "L1[i] <= 2*L2[i] and L2[i] <= 2*L1[i]", doesn't that mean that L1[i] and L2[i] are equal?
 
@RetoKoradi there's a factor of two on one side
 
I assume your code is too slow with n = 6?
 
yes, I saw that. just trying to figure out what the consequences are of meeting both conditions. I guess, in other words it's that one cannot be more than 2 times the other
 
@Lembik I'm already trying ;)
 
:)
 
8:28 AM
@RetoKoradi yes... if one is 4, the other has to be in range [2,8]
 
got it. I should already be sleeping
 
it's the logarithmic equivalent of abs(a-b) <= 2
 
@MartinBüttner is your visualisation for lots of values of n or just for one?
 
@Lembik I'll probably replace the graph with the n=3 or n=4 and also highlight the independent set
@Lembik it's n = 5
 
thanks
another way of doing it is to insert an edge if two strings don't match and then find the max clique
it's exactly equivalent but gives a different visualisation
and may of course take a different amount of time
(possibly slower as it is what I did)
why do you have a != b ?
in a != b && And @@ Thread[a <= 2 b] && And @@ Thread[b <= 2 a]]]
 
8:32 AM
otherwise, you get self-loops
 
ah ok
 
I assumed the match string would be unique. is it not?
 
yes it is
I didn't understand what a was
what is a? Is it a counting array?
(I find mathematica so hard to read!)
 
a and b are two counting arrays
@Lembik to be fair, that is not the most readable Mathematica code
a lot of the golfed Mathematica has found its way into my "normal" Mathematica, because it's faster to type
 
ah :) you have golfing disease
 
8:43 AM
0
Q: Golfing with User Agents

Beta DecayUsually when performing an internet challenge, there's no problem with having to specify a user agent, but when it comes to dealing with Google, it changes. Google blacklists the Urllib user agent, presumably to stop spambots, so you have to specify a user agent. This takes up many bytes, and i...

 
@MartinBüttner so.. let's guess how high the winning answer will be :)
I suppose if someone comes up with an optimization method it could be quite high
 
oh, I just noticed I've got every edge twice...
 
I think I did too!
 
I doubt it'll affect FindIndependentVertexSet much though
I think I'll give up on n = 6 for now
 
how much of space invaders do you think I could ask as a golf challenge? upload.wikimedia.org/wikipedia/en/2/20/…
I could just ask for the sprite you control and the firing action
with nothing else
 
8:55 AM
you could ask for a simplified ASCII art version
 
:)
is that actually any easier?
the main challenge is presumably the control and the detecting of collisions
@MartinBüttner Thanks for your answer and checking my code too
 
9:46 AM
0
A: Sandbox for Proposed Challenges

Beta DecayOne makes all the difference cops-and-robbers Cops Challenge Write a valid program which, when just one character in the program is changed, removed or added, completely changes the output. Formatting Your answer should be in the following format: # <Language name> ## Code <code goes here>...

 
10:01 AM
hi @orlp
 
10:31 AM
Blanked :P
 
@Lembik hi
 
10:59 AM
@orlp thanks for the comments. You are right that matching is not transitive
@orlp however on symmetry, the way we use it means that it is effectively symmetric, right?
 
@Lembik you could argue that matching is also not commutative
however, it is implied that you should switch S1 S2 to see if they match
 
@orlp I think my word symmetric is your word commutative
@orlp the point is " the task is to find the size of the largest set of strings, each of length 2n-1 so that no two strings match."
so they can't match either way
as you say
 
@Lembik yes
if M is the match operation
M(A, B) does not imply M(B, A)
nor the other way around
but because both M(A, B) and M(B, A) must be false, you effectively implicitly construct a commutative 'match' operator
by requiring both orderings to be false
 
 
1 hour later…
12:05 PM
@orlp exactly
@orlp of course the big question is.. can anyone solve n = 6 :)
 
@Lembik undoubtedly
 
@orlp I like your confidence! The brute force method is slow
 
only 2048 strings :)
 
yes but the problem is how do you find the max size subset?
I hope you will be able to post an answer in any case
 
not going to
got other stuff
cooking up a bruteforce method (or a linear speedup of one) isn't really interesting to me
and I don't see a quick algorithm
so not going to bother :)
 
12:10 PM
:(
 
12:55 PM
Hey @Lembik :)
 
hi @Vioz-!
looks like we have converged on the correct answers for small n
and we even have a pretty picture :)
 
Now I just need to tweak mine, because I'm not getting 31 for n=5 :P
 
That 31 really messes up any hopes of finding an existing analagous sequence.
 
yep :p
 
2 4 10 16 looked so promising, too ;)
 
1:11 PM
well, my code might have a bug...
 
Well it was really promising when I had a sequence that followed floor(n^2/2)
 
my code doesn't even terminate for n = 5 :)
so I can't check yet
@Vioz- is yours greater than or less than 31?
 
I'm getting 29 :(
However, I do calculate N=9 in about 10 seconds
which is probably still wrong
 
I have >= 31
 
1:28 PM
How are you going about checking for matches?
Or mismatches, as it were
 
Pick any, keep only mismatches, recursive backtracker
 
I'm just running through a list of all previously-found unmatched strings, zipping the group counts and checking if one is greater than 2 times the other, breaking if that's the case and adding to the mismatch list
This is my output for n=5: pastebin.com/Y0aSqGFx
 
1:48 PM
interesting..
We match for the first 20, then I max out much faster
 
@MartinBüttner Thanks! I'll add that later.
 
@MartinBüttner the independent set code in mathematica seems to be much faster than the code in igraph
I wonder why
 
@aditsu Clever. That means I have to find a new example for the tips question. (I really want one where rotation is the shortest approach.)
 
It's almost like I'm somehow skipping values..
 
@Dennis I don't know if there's any case where rotation is shorter than every other alternative
it is often tied with a different approach, but maybe you can find an example
 
1:56 PM
I'm pretty sure there is. I just have to use less natural character ranges (e.g., 2-9M-Za-h<->).
 
well, tips are supposed to be practical :p
 
I don't think the last example is all that useful as it is. It's intended to show a method, not how to generate this particular string.
 
@Dennis I can edit it in if you don't mind
 
@MartinBüttner Not at all. Thanks!
 
2:16 PM
@orlp 81, nice :)
 
I figured the universal string would be short
not that short :P
 
2:56 PM
@Sp3000 that was actually achieved based on your best result as seed :)
 
@Vioz- do you think 31 is the right answer for n = 5?
 
What a coincidence, I just chucked in your 81 to see what will happen :P
 
@Sp3000 I'm actually doing a different approach now
 
Oh?
 
@Sp3000 starting with an empty string I apply the same algorithm (grow, shrink, etc)
except now with a condition that it will only accept improved results
and the number of mazes solve is the result
 
2:58 PM
So I'm guessing you hit 100+ and then go back down?
 
right now it gets stuck on 18
for some reason
 
That's weird...
 
Anyone else watch the sideshow act that was the debate last night?
 
@Lembik I definitely believe 31 is a valid answer, not 100% sure if it's the max, but it's right. I looked at Sp3000's solution of 31 and unless I missed something, it's right.
 
I did get this result when I seeded it with a seed generated by a different algorithm
93363/97020 45 NENWSWESEWNNWNEESWSESEENNWSWNWSSENENESESWSWNN
(first two numbers is mazes solved / total mazes)
 
2:59 PM
@Vioz- ok cool.. so the next challenge is n = 6 then :)
 

« first day (1651 days earlier)      last day (3209 days later) »