last day (100 days later) » 

10:48
@Mr.Xcoder Any golfs for this? :)
nvm, just realised the input format is unacceptable
11:16
@FlipTack will take a look soon
Yeah, I have -1
:P
ooh, I think I just got -7
I am analysing it rn :D
@FlipTack +1 from me I think it is close to optimal
Actually...
Yup the same... I though that would give us 89
also, that wouldn't work if a pipe was in the top row...
Which I should probably suggest as a test case
11:30
The second version?
@FlipTack I will solve it on my own now, let's see if I can get any shorter
Go for it
@FlipTack I think your fails for:
=====
   |
It returns 1 instead of -1?
It seems to be failing for everything now...
Maybe you made a mistake while editing...
Oh, you have to pad the bottom line with spaces
11:34
Ah right
And the top line
Yeah, forgot
I assumed that's allowed as Trailing whitespace is permitted, leading whitespace is not. (although that may be talking about output)
It's a challenge, my favourite subject, so how in the world didn't I compete?
Ok, my very first ungolfed attempt in 112
11:51
Using a while and an exec both got me to 102
@FlipTack 100 (while)
100 (exec)
The while can probably be golfed by putting in a literal byte instead of \n for the comparison
Ok I now have 101 using my approach
Please don't suggest any golfs yet
There's one strikingly obvious one :)
That was the solution I had originally
I got it...
97 ...
11:59
@Mr.Xcoder I originally had this (98), then you suggested the print instead of return
Yeah but I really did it completely on my own. Python minds think alike
I didn't doubt you :)
def f(s):l=len(s)/3;print cmp(sum((ord(v)-31)*(s[-~l*2:].find('|')-i)for i,v in enumerate(s[:l])),0)
That's what I get now
And switching to range like you did...
93 bytes
90 bytes now
I just got the while method down to 94
I have an alternate 91-byter: Try it online!
12:06
I believe that can be 90
switch -2*-~c-i to +~c*2-i
Just changed that
My current one: Try it online!
Hang on, writing to arguments might be possible
As it's a list
Tried s[:]=[...] as the output format, but it's a byte longer :(
Oh wait, it's a string
I thought it was a list of lines, my bad
:c proton doesn't have cmp
because it's Python 3 based
12:11
You could use the (a>0)+(a<0) trick for calculating the sign
Yeah ik
Mind if I list your alternative in my answer? (With credits, obviously)
@FlipTack Go ahead
@FlipTack Actually (a>0)-(a<0) I think
I will not do it in Proton, though
I'll try Pyth instead
@FlipTack Do you want me to create a Python golfing chatroom?
I believe there is one, I used to use it with xnor
But it might be frozen now
12:15
Hm, I can't seem to find it
Go ahead, I've just realised how much we've spammed TNB :P
Public or Gallery? I'd say Public
brb
Public
Welcome to the Python golfing chatroom!
2
Exciting
12:19
I added you as a RO
@Mr.Xcoder Answers we've worked on together: 1, 2, 3, 4
Ok, so let's see what we can do to that 90-byter
Good reference
@FlipTack I think we should solve some old challenges together sometime, but I think I'll have to go now.
Alright, I'll keep cracking at the 90-byter (although I doubt there's much, if anything, to shave)
But I'll most likely be back after lunch, see you
You also helped me with this BTW
I may have a golf!
Hardly, haha, I noticed a small golf but it's not there anymore anyway
@Mr.Xcoder Just realised, your solution would break if there's a pipe in the top line, you'd need to use rfind
12:29
Ah yeah
13:18
78 messages moved from The Nineteenth Byte
Do you want some feeds?
@wizzwizz4 Such as?
The feed.
Ah yeah
wizzwizz4 has made a change to the feeds posted into this room
@Mr.Xcoder Done.
Hopefully it won't explode this time.
13:28
Danke
I can remove it if needed @wizzwizz4
@Mr.Xcoder You're on clean-up duty if it spams the entire room when the cron job runs. :-)
You can use shift+click to select a range of messages.
@wizzwizz4 Yeah I know. Thanks anyway!
@Mr.Xcoder Yeah.
Ok thanks
5 messages moved to trash
14:10
CMC: Write the shortest snippet that performs the following mapping: [(1 -> 1), (2 -> 0), (3 -> 0), (4 -> 1), (5 -> 0), (6 -> 0), (7 -> 0), (8 -> 0), (9 -> 1)]. In a better format, [(1, 1), (2, 0), (3, 0), (4, 1), (5, 0), (6, 0), (7, 0), (8, 0), (9, 1)].
So lambda x:<your expression here> (don't include lambda x: in your byte count)
cc @FlipTack
21 bytes: int(int(x**.5)**2==x)
@wizzwizz4 Oh lol I didn't even notice I had a mapping with truthy values so perfect squares :P
I chose them completely randomly
@Mr.Xcoder In which case:
15 bytes: 0+(x in(1,4,9))
@wizzwizz4 Drop the 0
@Mr.Xcoder 10 bytes.
With yours, abusing bool == int equivalence, 11 bytes (mine doesn't abuse it :D)
@Mr.Xcoder How did you manage that?
16 bytes: +(str(x)in"149")
xnor's tips are amazing
@wizzwizz4 +(`x`in"149") in Python 2
spoiler to my 10-byter
@Mr.Xcoder Is `x` like f"{x}"?
In Python 2, `x` is the equivalent of repr(x), so like str(x) in any version or f'{x}' in Python 3 (for standard integers).
 
4 hours later…
17:57
@Mr.Xcoder Regarding this answer, Lynn just suggested o-i+2-i%2*3 - you may want to update your Proton answer too
Will do when I get home
19:06
@FlipTack Thank you. Updated
19:26
hello @DLosc
Hi! I saw that Python golfing was going on and so I came. ^_^
Nice :)
Feel free to join the fun :)
... when the fun happens :P
I feel like there is a big community of Python golfers here on PPCG, and a dedicated chat room seems appropriate
Agreed. I also like the idea because I haven't really golfed in Python in a while--somebody usually FGITWs me, so I make a solution in QBasic or one of my esolangs instead. This seems like a way to participate even if one isn't the first to post an answer.
@DLosc Yeah. I promote the idea of not being reluctant to post your own solution anyway, even if someone FGITW's / outgolfs you.
I do when I have a different approach that's better than what's previously been posted. That was the case with my last Python answer (over a month ago!): the previous Python submission used itertools, and as we know, itertools is never the answer. ;)
19:37
@DLosc That answer is really cool :)
Thanks!
@DLosc itertools is never the answer--- Then please outgolf me here. :P
Anyway, gtg for now
20:23
@Mr.Xcoder Hm. Well, here's 89 bytes... Okay, how about never hardly ever?
(Immutable strings are really annoying sometimes. That would be 72 bytes if you could use random.shuffle on strings.)
Agreeeeeed.
20:38
Ooh, 87 bytes with a different approach.
 
2 hours later…
22:20
@Mr.Xcoder you can shave 2 bytes with 530>>x&1
@xnor Yeah I brute-forced one hour later and got that too, thanks anyway. BTW, hi and welcome to the Python golfing chat room. It’s nice to have such a great Python master around :-)
@Mr.Xcoder :)
do you have code to generate expressions?
No, not really
But I created a list compeehension and filered those which had <variable here> >> x & 1 equal to the mapping values :-)
@Mr.Xcoder 7 bytes for python 2: 9%-~x/x
this one I got by code
sometime i'll optimize and clean up my brute forcer and post it
How did you get that wizardry?
@xnor Link please? If you prefer to keep it for your personal code-golf use, then No problem :D
22:25
i wrote it and am still kind-of embarrassed about the state of it
it's one of those things that I wrote to solve one problem and then added more and more without thinking ahead
It seems quite effective, though. Nevermind then
I must go to sleep now (12:30 AM here). See you o/
@xnor I feel ya :D
good night!
Thanks

  last day (100 days later) »