« first day (1650 days earlier)      last day (3210 days later) » 
00:00 - 15:0015:00 - 00:00

12:03 AM
I have a feeling it won't happen, unfortunately.
 
12:42 AM
You know, @Dennis, you could post a Chef answer. ;)
 
1:25 AM
hey, I'm looking for API advice for this challenge:
2
A: Sandbox for Proposed Challenges

Nathan MerrillIronclad Tactics KoTH This KoTH is inspired by the Ironclad Tactics paper version from Zachtronics. The game is played on a 9x4 grid split into three areas: the North, the South, and No-Man's-Land (the center). To make things easier for you, it will always appear that you are the North (the le...

how would you prefer the tank be organized?
3 different types, and a list of Attacking square offsets?
 
 
1 hour later…
2:36 AM
0
Q: Pow of natural numbers

Todd LehmanThe challenge Implement the C equivalent of the pow() function (exponentiation) for natural numbers, in a language of your choosing, without using any library functions or operators for exponentiation, multiplication, or division. You may use addition, subtraction, bit-shifting, and any boolean ...

0
Q: Yarr! A map to the hidden treasure!

PyrrhaIntroduction "Yarr!! We had a laddie who called himself a "programmer" make a map t' our hidden treasure! But 'tis written wit' weird numbers 'n letters! "E5, N2, E3"... what does it even mean? Madness! Can't even scribe a proper treasure map, t' useless cretin. Fix it fer us! We'll gift ye a sh...

 
2:50 AM
@Pyrrha Yarr!
 
@NewMainPosts It's a do basic X without obvious Y :(
 
^
 
I did it in Java, not BASIC. Is that ok?
 
Nope
 
Well damn.
 
2:57 AM
I still can't believe that people used languages other than Python to solve the "kissing snakes" challenge recently
 
Other languages can kiss snakes too, you know.
Who are we to deny them their snake love?
 
@Sp3000 I was hoping to find one of the CJam gurus. I guess it's you. :) Do you know a good way to strip leading spaces off a string? So far the best I found is 9 bytes, which seems awful
 
I tried to be smart but it didn't work
 
My first idea would be something like {S=!}#> assuming there is a nonspace char
(can't test atm)
 
What's the ! do in that case?
 
3:09 AM
It yells
 
Seems legit
 
Trust me, I "know" CJam.
 
It's Boolean NOT
 
0
A: Sandbox for Proposed Challenges

PyrrhaQuestion about generating pseudo Lisp code (title tbd) Synopsis: Given a list in the Lisp style and a letter in that list, return the appropriate car and cdr statements to return that letter, given that the list is stored in a variable l. In Lisp style languages, a list looks something like...

 
(for some loose interpretation of the word "know")
 
3:10 AM
@Sp3000 Let me try. I don't think I had ever noticed that you can use a block with #.
 
Boolean not?
 
Try checking the remove leading spaces question
 
@BassetHound Not True == False.
 
In logic, negation, also called logical complement, is an operation that takes a proposition p to another proposition "not p", written ¬p, which is interpreted intuitively as being true when p is false and false when p is true. Negation is thus a unary (single-argument) logical connective. It may be applied as an operation on propositions, truth values, or semantic values more generally. In classical logic, negation is normally identified with the truth function that takes truth to falsity and vice versa. In intuitionistic logic, according to the Brouwer–Heyting–Kolmogorov interpretation, t...
 
3:15 AM
@Sp3000 {S=!}# gives an error. I tried {S-!}#, which does not give an error, but does not give the desired result. I'll play with it some more
 
@Sp3000 S is a string, not a character, so = will raise an error. _{S^}#> will work though.
@RetoKoradi It should be {S-}#, without the negation.
 
@BassetHound What's your background with programming like?
Programming and/or computer science
 
@Dennis Right. I was playing with loops to try and solve it so long that I got used to negating it.
 
If everything else is separated by 1 space then you can use S%S*
(Not sure what question this is for)
 
(Could be for general furthering of knowledge)
 
3:18 AM
@Sp3000 There can be sequences of multiple spaces in the rest of the string. I was thinking of splitting at spaces, but that's where it broke down.
@Dennis Is _{S-}#> the shortest you can think of for stripping leading spaces? It's 2 bytes less than the 9 byte solution I had, so that's progress.
Well, I think I hadn't counted the _, so it's 3 bytes less.
 
@RetoKoradi There's also __S-c#>, but it's just as long. CJam needs a trim operator...
 
Is there a way to get the first two characters of a string in Python?
@AlexA. Not all great.
 
@BassetHound s[:2]
 
3:33 AM
Alright, cool
 
@Pyrrha Could you use integers?
So rather than a b c you'd use 1 2 3?
 
integers could work
 
It'd make output testable
 
although you'd still need the (list 1 2 3...) construction
 
No, you can use a leading apostrophe
(car '(1 2 3))
 
3:35 AM
Hmm okay
 
repl.it supports Scheme, which supports the same car and cdr syntax as regular Lisp.
So that'd be a way to test submissions.
 
So it converts to a string, then what? @Doorknob Getting an error
 
@BassetHound s has to be a string
 
Yes, it is
 
What error?
 
3:37 AM
@BassetHound Then what's converting?
 
llama@llama:~$ python -c 'print "foo bar baz"[:2]'
fo
 
@Pyrrha Are you going to come play Minecraft again sometime?
 
Oh, I see the problem
I'm an idiot. I meant CJam xD
 
@AlexA. Yes. Don't know when though.
 
@Pyrrha Fair enough. Haven't seen you around in a while. Hope things are going well.
@BassetHound You're not an idiot. But getting the language right does come in handy. ;)
@Doorknob llama@llama -- Is Optimizer in your computer?
 
3:41 AM
Yes, that is truth.
 
:)
 
@BassetHound In CJam, 2< gives the first two characters of a string. While the documentation is kind of... concise, there is a list of operators here: sourceforge.net/p/cjam/wiki/Operators
< is the "slice left" operator for arrays/strings (strings are just arrays of characters)
 
@PhiNotPi I can't not read your starred post as saying "when the starboard is filled with feces." :(
 
@Dennis The OP on the "power" question posted clarification. And yes, a trim operator would be handy. A "find not" would also have helped somewhat in this case. Which starts going in the direction of regular expressions.
 
@RetoKoradi Regular expressions for exponentiation?
 
3:53 AM
@RetoKoradi Alright, thanks. Most of the explanations there aren't enough for me.
 
I'm bored and don't want to do the things I should be doing. :|
 
@BassetHound I started writing my own notes when learning CJam. I just tried each operator with various kinds of arguments, and tried to make sense of the result. For most of them it was fairly straightforward. There are a couple that I initially had trouble understanding, like the various uses of : and f. Looking at solutions from some of the regular posters, with their explanations, is also highly instructive.
@AlexA. Nah, completely unrelated. I was just mixing two topics in one message. It's called efficiency. :)
 
Efficiency? I'm not familiar with this concept. :P
 
@BassetHound BTW, if you haven't seen it, the ed operator is highly useful during learning and debugging. It shows the current content of the stack.
 
4:12 AM
Thanks for the help @RetoKoradi ^.^
 
I'll try and get the part 2 (arrays) of the tutorial done tonight - just took it back down to add Dennis' suggestions
@AlexA. Close enough? (input a^b as an a*b grid)
 
@Sp3000 ಠ_ಠ
Surely this is a sign of the end times.
(And by that I of course mean awesome, nice work :D)
 
Retina could probably do it in a more legit way :P
 
Still great.
 
@RetoKoradi Fixed.
 
4:31 AM
@Dennis Looks good. I was almost tempted to try a nested loop of additions, but then I decided to try another challenge.
 
Yarr?
 
Dosas, perhaps?
 
No, not one of the most recent. @AlexA. Not that one either. I tried to read it, but it confused the hell out of me.
 
@RetoKoradi Oh no! Is there anything I can do to make it clearer?
 
@AlexA. It's probably clear if somebody really wants to get into it. It started going beyond my attention span once it began talking about waiters carrying around different sizes. I'm sure it's a fine challenge, just not my cup of tea... or rice...
 
4:39 AM
Fair enough. :)
 
Sometimes first impressions can be wrong. Dennis almost lost me the first time I read that bijective bases thing. It first looked like a challenge for mathematicians. But it wasn't nearly as complicated as it looked, and really fun.
 
Oh hey, to my surprise, somebody upvoted pow().
 
There's bound to be
 
4:57 AM
I finally figured out why some CJam permalinks don't work in Firefox while others do.
 
Why?
 
Firefox requires escaping a % as %2525, which gets replaced by %25, then %.
That ought to be a bug somewhere.
 
!?
 
That's... huh.
 
Yup, that's it.
As far as I can tell, the hash of the URL is automatically decoded in Firefox.
But the CJam interpreter attempts to decode it a second time, which results in an error.
Just visit google.com/#%25 in both browsers and execute window.location.hash in the console.
 
5:15 AM
@Optimizer /人 ◕‿‿◕ 人\ Make a contract with me and become a w magical girl!
 
@Sp3000 Uh what
 
...
 
5:28 AM
(ºnº)
 
ξ(✿ >◡❛)ξ▄︻▇▇〓〓
 
∂.∂
 
5:54 AM
@Sp3000 ξ(✿ ❛◡❛)ξ▄︻▇▇〓〓 aim with both eyes open, it's twice as accurate
 
6:13 AM
@Sp3000 soo mesmerizing and enchanting.. Digimon ? or what..?
@PhiNotPi no its not. You should see professional shooters shoot
 
Puella Magi Madoka Magica, which should be where that emote's from :)
 
@Sp3000 Here is where I needed the string trimming: codegolf.stackexchange.com/a/54307/32852. It turned out to be a slightly more complicated case, because I needed to trim 2 characters. Ended up with a nested #, which is kind of cool. I'm fairly happy with that part. Putting the whole thing back together was slightly more painful, I should take another look at that later. I did use Martin's string combination trick with .e<
 
It's a lot easier for that question because you can do '_#>
 
For the sorting, I need to trim leading spaces, the _, and then more leading spaces to get to the text.
 
Oh right, the sorting
 
6:24 AM
{" _"#W=}#> seems quite reasonable for that.
To pack two strings into an array, there's no way around applying an a to both of them first, and then concatenate, right? Otherwise it adds the string to the array character by character. Which is logical, since the string is an array.
 
Yeah
[\] is shorter depending on what order you need them
 
@RetoKoradi {_{" _"#W=}#>}$ should work.
 
@Sp3000 oh, right, I keep forgetting that I can put the [ and ] anywhere in the code. Even though I've used it before.
@Dennis Wow. I think it does. What exactly is it? Can $ take a block as an argument?
 
6:41 AM
$ takes a block as well, yeah
 
Cool, I guess I learned something new today. I had never seen that. So this means that it applies the block to each array element, and then sorts based on the result of evaluating the block for each element?
 
Yep, and should probably mention that order is preserved on ties
(I think?)
 
Seems likely that it uses a stable sort algorithm.
 
I checked the docs yesterday and Java uses stable sort, so I'd assume so
btw same number of bytes, but 1> is a bit nicer than (;.
 
0
Q: checking for palindrome

animeshWrite a Program to take and INPUT STRING and identify whether it is a PALINDROME or NOT. The output should be generated as 'Y' or 'N'. The program should take input both from command line as well as console(STDIN)

 
6:56 AM
^ possibly dupe if code-golf, otherwise off-topic for having no criteria
 
Pow is up to -1
 
Pow Pow
Pow Pow Pow
 
7:08 AM
@vihan I think I saw you check in just a little earlier. Just wanted to say that the textbook challenge was great, IMHO. Definitely one of my favorites from the last few weeks. Not overly complicated, but tricky enough to require some thinking and exploration of various options to find an elegant and (somewhat) short solution.
 
Now I feel like porting my Python and seeing what that gets :P
 
form a smaller cage to a bigger?
 
@Sp3000 Hey, at least I was leading for a little while. :)
The overall logic does not look that different, as far as I can tell.
 
I wouldn't expect it to
 
Now that I think about it more, I should probably carry along the height of the previous book, instead of the whole string, while constructing the separating lines.
Transposing the whole thing was very obvious. After I really started thinking about a solution, it also seemed easier to simply drop the separating lines from the input, and reconstructing them at the end. Looks like you went the same way there.
 
7:24 AM
Hm... I don't have that much better
 
I should be able to save a few bytes on the final loop. But it's time to go to sleep. I'll try another round of improvements tomorrow.
Thanks for all the tips.
 
0
Q: Balance a set of weights on a seesaw

samgakBalancing Act Overview Given an input of 3 single-digit integers representing a set of weights, output an ASCII representation of a seesaw with the weights placed on it so that it is in balance around a central pivot. Each number has a weight equal to its value. The torque of each number is th...

 
Posted. .\ is surprisingly more useful that I initialially joked it wouldn't be
For some reason [LL] [1 2 3]* doesn't do what I want it to do
... oh right, nvm
@samgak Nice challenge!
 
7:47 AM
thanks
 
I initially also tried the final part with forming pairs using 2ew, and then looping over the pairs. But it got kind of messy. Particularly the combination of the result. Looks like that's what .\ solves for you. I tried with z, but then I got a nested list that would have need additional unpacking.
 
 
2 hours later…
9:37 AM
hi all
how are the coding geniuses?
 
coding .. who?
2
ಠ_ಠ
 
how do you think they provide the linux login at tutorialspoint.com/compile_c_online.php ?
is it easy to set up this service ?
I mean using free tools
@Optimizer :)
 
 
2 hours later…
11:58 AM
thanks, opengl
 
12:36 PM
0
Q: More is still less and less is still more

Stewie GriffinSo, this question is obviously inspired by this question posted this June by Dennis. The main task is the same, and the main criteria are similar: Your code must be at least 1 character long. Running the original code produces x characters of output to STDOUT (or closest alternative), where 0 ...

 
1:08 PM
This is part of the reason why I don't want to play DnD: rpg.stackexchange.com/q/65738
Every decision is like a mini election
I watched some guys play once and it took them an hour to get through a dark alleyway
 
here's another reason not to play DnD :) chick.com/reading/tracts/0046/0046_01.ASP
 
I've read a lot of tracts, but that one was too bizarre to even take seriously
 
1:23 PM
anyway, I know almost nothing about DnD, but what little I heard about it seems boring to a painful degree :p
 
I've never played it, but its basically collaborative storymaking
 
1:41 PM
With random tossed in. I'm sure most storywriters don't typically roll a d20 to decide the fate of their protagonists.
"Ah, damn. Bilbo got a bad roll. I guess I have to change the name from The Hobbit now that he's out."
 
how do we deal with this answer: codegolf.stackexchange.com/a/54321/20198
it technically works
 
Does it? The output I'm seeing looks like it repeates the input instead of terminating.
 
I downloaded it, opened it in excel, and pressed the button, and it drew a path
and only 1
also, can you flag a duplicate answer?
 
Bah, ninja'd.
You should be able to flag dupe answers.
 
I know
I'm going very low quality
because it is
 
1:55 PM
Oh, right. For straight dupes, it might be better to custom-flag. That way mods can instantly see the problem instead of trying to figure out if it's low quality enough. Of course, if it's also VLQ...
 
also, is in-cell programming possible with excel?
(not macros)
and, if so, how do we judge it?
 
I try to stay as far away from Excel as possible, so I'm not the guy to ask that :D
 
if 20 cells all contain the exact same formula (simply referencing different cells), do we still count it 20 times?
 
Dunno. Can't you write a function and just call it from each cell or something?
 
maybe, but then you still are going to have 20 function calls
 
1:57 PM
I really don't know much about Excel programming. Clearly.
 
oh, custom functions are defined as macros
 
2:11 PM
@Geobits there's a proposed edit by an anon user that technically improves the answer by adding the code
but 1. It adds code and 2. It doesn't explain it
 
If it's the same code, that sounds better I guess (I haven't downloaded it to compare). Still not great, yea, but -probably- not delete-worthy.
 
I can go through and explain it if that'll make the answer better.
 
hi all
I have yet another impossibly difficult counting puzzle up my sleeve :)
if anyone is interested
 
I'm interested :D
 
hooray!
ok ..before I put it in the sandbox.. let me try out a version here
consider binary strings of length 2n
 
2:23 PM
Famous last words...
 
for a given string S we output the number of 1s in every window of length n
so we give n+1 outputs (hmm.. maybe S should be of length 2n-1)
 
So a string S is converted to a binary string, split into sections of length 2n, count ones in each and print?
 
sorry so
given two strings S1 and S2, we say they match if all the counts match
and we look at all n substrings of length n of it
there are n of these
for each substring we count the number of ones in it
 
So far this sounds O(n)
 
I hear a "but then <super hard task>" coming
 
2:26 PM
oops
given two strings S1 and S2, we say they match if all the counts match
two counts match if one is within a multiplicative factor of 2 of the other
is that clear so far?
@Sp3000 it's coming..patience :)
 
Is this matching in order, or in terms of, say, a multiset?
 
in order
for a given string you get an array of n numbers as the output
for two strings S1 and S2 we compare their two arrays in order
 
Are S1, S2 the same length? (just for input purposes)
 
clear?
they are both of length 2n-1
 
n is given, or we math it out?
 
2:28 PM
it will be given.. well... patience :)
but let's say it is given
everything ok up to now?
 
Yep
 
ok. so the question is this.. given an n, how large a set of strings of length 2n-1 can one make so that no pair of strings matches
that's it :)
so the input is n
and the output is an integer
everything in the middle is up to you :)
 
I'm assuming outputting the actual set would be good as well :P
 
well yes but that might not be the best way :)
I think the sets can get very large
 
No, I just mean for verification purposes
 
2:32 PM
but for small n that is a great idea
 
Otherwise, how are you going to check the answers?
 
yes
I think this makes both a nice golf and fastest-code question
my preference is always fastest-code of course :)
 
Sounds more like code-challenge than fastest-code to me
 
oh right.. I suppose the winning criteria could just be the highest n you can compute
or the highest you can compute in 1 minute on my machine
depending on what people prefer
I am open to suggestions
both have disadvantages and advantages
 
I'd prefer the former because the latter has problems like picking good random seeds
 
2:35 PM
why do we need randomness?
 
Pick a starting value for the set to compare the rest to, I think
 
I am a little lost. Why is this a problem? I mean any code you write that uses randomness will work just as well on my machine as on yours
of course the first challenge is to get the right answers for n = 1..5 :)
I also prefer the former as it allows people to use mathematica
but it does mean that people with slow computers are screwed
unless they are also much cleverer of course :)
@Sp3000 does it seem suitably super hard? :)
 
Do you know the optimal for 1 ... 5?
 
no! I have code :)
but I never like to bet my code is right
 
I was assuming you had at least some brute force way of checking for small n
 
2:40 PM
yes absolutely
 
@MartinBüttner {}s also is useful sometimes.
 
brute force is not so hard
 
@Dennis ah, right, thanks
 
May I ask what they are? Or are you keeping that a secret?
 
@Sp3000 you can just try all possible strings, compute all the arrays then solve max independent set using your favourite library
I used igraph
each node is an array and two nodes are connected if the arrays "match"
 
2:43 PM
I think I have something figured out.
 
@Vioz- cool!
 
Do you have any numbers I can check against for small n?
 
^^ that was what I was asking but I think Lembik misunderstood
 
@MartinBüttner Any suggestion to shorten [UU] or [-2X]?
 
Also re randomness, I can pick a pseudorandom seed at will and know that my program will perform better with this seed than any other that I tested with, assuming I used randomness in the program
 
2:45 PM
Could use it for this answer. :D
 
But something makes me think there should be a deterministic way that's a lot simpler...
 
@Vioz- this is bad but my coding computer is not here sorry.. I should have emailed the numbers to myself
I will get them to you as soon as I am back at the other computer
 
I think so, just from the first few small n it looks like there's an easy way to calculate this
 
really??
@Vioz- that would be very clever!
 
(assuming the sets I can find are the actual maximum sets)
 
2:47 PM
how are you finding the maxima?
or is that secret? :)
 
I'm just doing a naive approach, starting the set from a string of zeroes of length 2n-1 and just iterating through all the binary strings possible at that length, checking them against what's already there
 
oh I see
I am not sure that is guaranteed to be optimal
 
For small n it seems it might be, not sure about larger n
 
what do you get for n = 5
?
 
270, which seems really big, so I may be approaching this wrong
as in the number of items in the set
 
2:51 PM
2^9 is only 512
that seems like a big number
 
Yup
but the output doesn't seem to have duplicates
in terms of matching by order
 
Did you do the multiplicative factor of 2 part?
 
Ah, I don't believe I did
 
aha :)
 
00:00 - 15:0015:00 - 00:00

« first day (1650 days earlier)      last day (3210 days later) »