« first day (2089 days earlier)      last day (2747 days later) » 

10:03 PM
0
Q: Find the Centroid of a Polygon

mbomb007From Wikipedia: The centroid of a non-self-intersecting closed polygon defined by n vertices (x0,y0), (x1,y1), ..., (xn−1,yn−1) is the point (Cx, Cy), where and where A is the polygon's signed area, In these formulas, the vertices are assumed to be numbered ...

 
@ASCII-only whoa
 
@ConorO'Brien Had to add a command just for this
 
and it's still 6 bytes
 
Well, if an ASCII-art language can't draw lines in ~6 bytes you know something is wrong
 
well
yeah
(' #'{~=@:|@i:)@<:
J
 
10:17 PM
@El'endiaStarman that's pretty cool!
BTW, that's a cool blag article. I've read it a couple times.
 
@EᴀsᴛᴇʀʟʏIʀᴋ :D Was it clear and understandable? Anything that could've been better?
 
@EᴀsᴛᴇʀʟʏIʀᴋ blag?
 
@ASCII-only Blag ~= blog.
 
Short for weblag? :P
 
10:19 PM
@El'endiaStarman hm
@ASCII-only no
short for interblag
 
@Dennis Sorry, --repl
 
Blagoblag
 
Pattern recognition CMC: 1, 7, 21, 56, ... (Alternatively, 1, 3, 8, ...) I'm counting the number of heptagons in "concentric" rings in a triheptagonal tiling.
I guess that's not really enough data, is it?
 
Ha! I actually guessed the formula!
It's a(n+1) = 3*a(n) - a(n-1), for anyone wondering.
 
10:31 PM
Hmm, a couple of days ago I posted an answer (the only one) to a new question and still have 0 votes.
I think that's the first time that's happened (to me).
Not even the challenge author can be bothered apparently :P
 
@ASCII-only Oh, OK. So if the code comes from a file and the input from STDIN, how would I invoke it?
 
@Dennis ./charcoal.py foo -p
You may want to disable prompt mode (-p and --prompt) for TIO as well
 
Not really sure how to disable them.
 
10:37 PM
Right, I'll need to do that later, I guess
 
I may be switching KoTHComm to Eclipse collections
 
@ASCII-only What problems could they cause?
 
@Dennis They use prompts, meaning they wouldn't work on TIO
@Dennis It doesn't accept the entire input from STDIN yet, do you want an option for that?
@MartinEnder Conor and Tux are probably the only ones that will be able to finish a language over a weekend :P
 
@ASCII-only If that's the only option, input from a file is fine.
Not at my computer right now, but I'll finish it in a few hours.
 
I usually just use -i <input>
 
10:45 PM
That won't work with null bytes.
 
How would I read from STDIN - just a sys.stdin.read at the start?
 
Anonymous
11:03 PM
@Dennis oh god your avatar
 
Anonymous
@ASCII-only sys.stdin.read() will read all bytes from STDIN.
 
That would work with null bytes, right?
 
Anonymous
(well, on Python 3, it would be characters, not bytes, since it depends on your locale)
 
Anonymous
Yeah, it will work fine
 
Anonymous
$ echo -e \\x00 | python3 -c 'import sys;print(sys.stdin.read().encode())'
b'\x00\n'
 
11:13 PM
Why can't null bytes be passed via commandline arguments?
 
generally terminals strip them iirc
 
Oh wait
 
Anonymous
You can't really type them
 
Input via pipe will always be there before the process starts, right? Will there be any race conditions?
 
Anonymous
@ASCII-only Nope. When two processes are piped together, they run at the same time. The output of the first is piped to the input of the second.
 
Anonymous
11:16 PM
(nope to the first question, that is)
 
Anonymous
If you just use echo or cat (on a relatively small input), it will probably terminate before Python even gets to the reading input step
 
Wait, can I just accept input as an escaped string?
 
Anonymous
Sure
 
Anonymous
ast.literal_eval is your friend
 
Anonymous
@NathanMerrill I agree. Dennis for mod! (oh, wait...)
 
11:22 PM
Ahh, I remember when I said "Oh it's just seg-faulting when pushing to the vector, probably a really simple mistake. Who would have expected the simplest part to be the problem?" 8 hours ago. Yeah....
This is what I get for trying to use a deprecated part of POSIX
 
@Mego Wait codecs.decode(string, "unicode_escape") doesn't work as well as ast.literal_eval does?
 
Any C++ gurus around?
 
@ASCII-only Because they are null-terminated. Bash is written in C.
 
@quartata define "guru"
 
Knows every goddamn nook and cranny because this bug is super weird and spooky
 
11:24 PM
A C++ guru doesn't necessarily know anything about setcontext.
 
@ASCII-only Please don't. There should be some consistency among interpreters on TIO. Either STDIN or file is filne.
 
Yeah, fair...
 
Anonymous
@ASCII-only ast.literal_eval takes a string and outputs a Python object. It's basically the opposite of repr.
 
Anonymous
@quartata Halloween is just around the corner
 
@Dennis Okay, but I'm not entirely sure how STDIN input would work
 
11:25 PM
@Mego Definitely in flavor
 
Anonymous
@ASCII-only Don't use null bytes?
 
I might use a thread that blocks instead for this; it'll probably be faster anyways
 
@ASCII-only In Python 3? open(0).read().
@Mego Can't help wondering what it looks like on your end.
 
Anonymous
@Dennis Frightening. Children are running away screaming. Actually that might just be because of me.
 
:D
 
Anonymous
11:30 PM
@Dennis Oh please no. sys.stdin.read() exists for a reason. Need bytes instead of Unicode text? .encode(). Also, leaving dangling file references and assuming they'll get cleaned up is bad - that behavior is not consistent across implementations (PyPy doesn't automatically close file handles at the end of execution, for example).
 
dang I need to get spooky
completely forgot about that
 
Anonymous
Maybe I should make a Halloween challenge
 
@Mego But it's so golfy...
 
Anonymous
Something fun and not terribly difficult, like (n)spooky(n+2)me
 
(n)spooky(three of helka's challenges combined(n))me
 
Anonymous
11:32 PM
Dec 2 '15 at 5:37, by Mego
Don't golf your interpreter
 
@ETHproductions ;)
 
Well, I learnt Python by golfing. It's the only way I know.
 
Anonymous
There are hundreds of resources for learning how to write good Python code :P
 
like this site? :D
 
Anonymous
No, like that other site that we don't talk about
 
11:34 PM
oh, right
 
@ConorO'Brien i.e. CR SO
@Mego Hasn't that been done before?
Also what do I do with compression if I don't have a full codepage yet
SO is definitely the best place to go to learn good code style
 
Anonymous
@ASCII-only Nope, never
 
@Dennis File input wasn't intended for taking in whole input, you'd need to convert it into JSON array until I push a new commit
Also oops it doesn't work at all
 
Anonymous
@ASCII-only Story of my life
 
Y'know, you might want to have a little respect for Dennis' voluntary hosting and make sure an interpreter works before trying to put it up rather than adding 100 last-minute fixes.
 
11:45 PM
It works fine, just Dennis wants to input from file, which is 1. a recent feature, 2. untested, and 3. was intended solely for running testcases
 
Anonymous
@ASCII-only He definitely never said that
 
> untested
 
Anonymous
22 mins ago, by Dennis
@ASCII-only Please don't. There should be some consistency among interpreters on TIO. Either STDIN or file is filne.
 
STDIN isn't going to work, I think
 
Anonymous
It can. I showed you exactly how to make it work.
 
11:47 PM
Real court case: United States v. Approximately 64,695 Pounds of Shark Fins
United States v. $124,700 in U.S. Currency
 
I'm switching all my libraries to use Eclipse collections. The collections have huge names (like ImmutableMultimap), but have tons more functions to use. Not sure if my code size will be smaller or larger :)
 
Anonymous
@NathanMerrill Yes. One of those.
 
How do you know it won't be exactly the same?
 
11:51 PM
Help, what do I do if both the code and the input may contain null bytes?
 
@feersum .size() on an empty vector isn't undefined behavior, is it? I'm getting garbage data
 
No, not undefined.
 
@feersum you willing to put money on it?
:)
 
What on earth is going on
 
Anonymous
@feersum The absolute value of the difference of the sizes is a number in Z_0+. The probability that abs(new-old) == 0 is 0.
 
11:52 PM
Stack corruption?
 
Anonymous
@quartata Share the code?
 
@Mego I don't follow. what if new == old?
 
@ConorO'Brien hides head in shame
 

« first day (2089 days earlier)      last day (2747 days later) »