« first day (1 day earlier)      last day (17 days later) » 

01:48
Picking a next problem...
Current problem: codeforces.com/problemset/problem/6/A Rule changes: Function or full program okay.
02:32
from itertools import*
s=map(int,input().split())
d=x=0
for a,b,c in combinations(s,3):
 a,b,c=sorted([a,b,c]);d=max(d,a+b==c)
 if a+b>c:x="TRIANGLE";break
else:x=["IMPOSSIBLE","SEGMENT"][d]
print(x)
grc
grc
I have a 115 char method, but I'm not sure if it always works
Ahaha how come?
grc
grc
it's similar to yours, but only tests 2 combinations
Hmm come to think of it, there's only 4 possible combinations so I probably don't need itertools...
grc
grc
if a,b,c,d are the sticks in ascending order, then I believe you only need to compare d with b+c and c with a+b
02:39
Oooh I see
grc
grc
do you think that would work?
all the time
I think so, I mean d with a+c is covered since b >= a and such
a,b,c,d=sorted(map(int,input().split()))
x=min(d-b-c,c-a-b)
print(["SEGMENT","IMPOSSIBLE","TRIANGLE"][(x>0)-(x<0)])
This just passed Codeforce's tests :)
And that's 115, so it'd be shorter as a function
(and shorter in Python 2 now that we know about cmp :P
grc
grc
a,b,c,d=sorted(map(int,raw_input().split()))
print['SEGMENT','TRIANGLE','IMPOSSIBLE'][cmp(max(b+c-d,a+b-c),0)]
110
Maybe I shouldn't allow functions? It'd make things easier to test but I'm not sure
Hmm too bad the strings aren't the same length ;D
Current problem: codeforces.com/problemset/problem/6/A
You know, I think you nailed a good solution so fast I think I might need to pick another one XD
grc
grc
02:59
haha I'm sure it can be improved :P
it's just a pity reading space-separated input is so hard
Yeah :/ damnit Python - it's about the only reason I'm sure to put "function input okay" on everything
Just so Python doesn't have to deal with parsing the input
grc
grc
'4, 2, 1, 3' would be so much easier
eval yeah :P
Comma separated input doesn't look as nice for some reason though
Hmm I wonder how you'd do this in CJam...
[/goes to learn CJam]
I have l~ for reading input but I don't get how to use $ to sort XD
grc
grc
03:14
argh
I had an 8x8 python3 solution but I didn't realise space only rows weren't allowed
D: add filler? XD
grc
grc
then you get IndentationErrors :/
Ah :/
Yeah I found Python interesting to work in because of 1) indents 2) to split over lines you need to be in the middle of a pair of brackets or use `\` or something
grc
grc
s,n='''
''';s;n
p='p';p
print(p
*8,*[s*
7+p]*7,
sep=n);
so close...
spaces were on top row and right column
Ahaha I see
Maybe if the top left was a bracket and you printed down the left column and top row?
Because something like this works:
(
 print(1)
         )
grc
grc
03:19
:o
(that's practically what I did)
(just in an ugly way :P )
Ahaha I don't think I'm CJam'ing right lS/{i}%$~ :P (I'm not sure how to sort descending)
 
6 hours later…
08:57
@Sp3000 what are you trying to do?
do you have a space separated list of integers?
l~] collects them into an array of integers. $ sorts them. W% reverses them.
I was trying to do triangles question using grc's method, but in CJam :P
So basically read space-separated list of integers from input, and sort descending
yeah that's l~]$W%
10:00
k thanks :) Let's see if I can figure out how to do the rest :D
[/learning]
10:11
@Sp3000 let me know if you have any questions
10:44
Thanks :) trying to figure out how to do things is pretty interesting
11:14
l~]$W%_~+-\;\~;+-e<_0>\0<-["SEGMENT" "IMPOSSIBLE" "TRIANGLE"]\=
Ahaha this is pretty terrible but I think it works :D
For some reason CJam didn't like me putting the array first though
I get a "Can't compare ArrayList with Long" at the $
Oh CJam already has a sign function
l~]$W%_~+-\;\~;+-e<g["SEGMENT" "IMPOSSIBLE" "TRIANGLE"]\= 57 :o
11:42
(btw if you guys have problems you think would be fun to try golfing in chat, feel free to post them. Just saying :P )
grc
grc
nice, maybe I should learn CJam someday
I haven't looked at them yet, but there are more code golf missions here and here
Oooh hmmm
The logistics one sounds hard (but fun)
350 - 235 = ... 115. Short.
grc
grc
there's a chance it's fitted to the test cases again though :/
Subchallenge: checkio.org/mission/logistic-golf Target: Python, 115 bytes
We'll see...
There aren't many solutions for this challenge at all though
So it's hard to get a feel for what the best "legit" solution is
grc
grc
12:35
DFS takes a long time for some of their test cases...
Oh, so naive implementations get timed out? D:
grc
grc
there doesn't seem to be a time limit so far
yay it passed
now to golf it
:o nice
grc
grc
what do you think is the best way to find the minimum that's greater than zero
i.e. min(filter(bool,[]))
You mean minimum out of all numbers greater than zero, i.e. [2, -5, 4, 7, -1] -> 2? Or...
grc
grc
12:42
no negatives
just minimum excluding zero
because zero is used when there isn't a path
What are you currently using? First thing that comes to my mind is min(set(x)-{0})
grc
grc
min(filter(bool,[list comprehension])or[0]) is what I have
sets!
that's awesome thanks
I can use a set comprehension too
Ahaha yeah I'm finding sets very useful for all sorts of things now XD
@Sp3000 I'll have a look at this later. which challenge is it?
This one on Codeforces: codeforces.com/problemset/problem/6/A
grc made the observation that if the sides are a,b,c,d in ascending order, then you only need to compare d with b+c and c with a+b
12:54
okay, for starters, you don't need the last \
Oh... if the top two are an array and an int it just indexes irregardless of which one's on top? :o
Neat
yes
you also don't need the spaces between the strings
although it might be shorter to just do "A B C"S/
Ahaha I had commas there before but then I realised that was wrong :P
arrays aren't literals in CJam
[ and ] are just operations like any others
[ remembers the current stack depth as the start of the array, and ] puts everything since the last [ (or the beginning of the code) in an array
l~]$W%_~+-\;\~;+-e<g"SEGMENT IMPOSSIBLE TRIANGLE"S/= 52
I see...
13:01
hmmm, one sec...
meh, I was thinking about leaving the first number in the first array on the stack, because it won't affect the result (since it's positive), but it amounts to the same number of characters, because finding min takes two more then:
l~]$W%_~+-@~;+-]$0=g"SEGMENT IMPOSSIBLE TRIANGLE"S/=
:(
still the same:
l~]$W%_);]{~+-}%$0=g"SEGMENT IMPOSSIBLE TRIANGLE"S/=
Hmm I wonder if it's any shorter if I sort ascending, saving on W%
I'm just trying that
I think with your original code it is
just swap the + and - and use max and reorder the strings
l~]$_~-+\;\~;-+e>"SEGMENT TRIANGLE IMPOSSIBLE"S/=
in that case you can't leave that additional number in there though, because that will always result in IMPOSSIBLE
The backwards logic hurts my head a little, but I think that works
13:09
wait, how did you save another character
...
Oh I forgot a g
right
but still
that's 50
I saved on the W%, right?
yes
I mean "still, even with the g, that's better"
Oh right
Thought the "still" was at saving another char oops :P
Well that's... two times shorter than Python (and that's considering half the code is the text string) :D I think I see why you guys like CJam so much
13:13
heh
honestly, I mostly like it, because it's completely different programming paradigm
Pyth beats CJam 80% of the time, but I don't think I'd enjoy using it
Maybe you should learn Grass ;)
:P
next up on my list is J
I'm not sure I'd want to learn Pyth any time soon though, maybe when isaac patches any more weird bugs
How good does J do?
pretty well
well, like APL
From wiki: quicksort=: (($:@(<#[), (=#[), $:@(>#[)) ({~ ?@#)) ^: (1<#)
...
13:16
I'm surprised how well my source layout challenge is going... my last attempt was less of a success ^^
Oh, which one was that again?
@Sp3000 looks lovely, doesn't it? :D
@Sp3000 what, my last one? Choose-your-own-language-code
13
Q: Choose-Your-Own-Language Code

Martin BüttnerLet's take a grid of 16x16 printable ASCII characters (code points 0x20 to 0x7E). There are 30-choose-15 paths from the top left to the bottom right corner, making only orthogonal moves, like the following example: ##.............. .#.............. .######......... ......##........ .......##.......

And the source layout looks visually interesting, so I think that's why people like it
Oh that's right
Maybe people got bored of trying to find new languages to fit into their code?
yeah, very likely
Oh, negative's at the top of HNQ
Nice
grc
grc
13:26
do you know if J can be run outside of the REPL environment?
(Installing J)
@grc I don't know
@Sp3000 yeah, it got quite lot of answers, and some of them have quite a lot of upvotes
although I'm a bit baffled how many upvotes the Perl answer got :D ... I mean, it's nice, but it isn't exactly mindblowing
Maybe everyone likes the diagonal :P
I just thought the challenge was interesting because, unlike normal quines, the information you have to output easily has less entropy than the code used to write it
Since you just need to know space/non-space
jqt looks like REPL to me, and I can't see a save button anyway... does J have an associated file extension?
3
Q: What's the preferred J source code file extension?

mcandreFor the J programming language, I'd guess .j, but I've also seen .ijs and .ijt. Is it one of these, or even something else?

grc
grc
.ijs is the normal one I think
Hmm there seems to be a jconsole.exe in here...
grc
grc
13:36
jconsole is what I use, but it seems to only work as a REPL
you could ping algorithmshark in the nineteenth byte, I think he knows his J
Seems like it...
Hmm... I think I'll go get Ruby while I'm in the mood
grc
grc
jconsole < program still uses a REPL and messes up the output with indentation
Oh, that's annoying :/

« first day (1 day earlier)      last day (17 days later) »