Chat:World/2020-08-06

From CG community
Jump to navigation Jump to search

eulerscheZahl: staff's answer to another complain about vim: What is used is https://github.com/brijeshb42/monaco-vim, feel free to create an issue on their github!

Default avatar.png _-: Thanks. I will report it.

shangcode: Please, someone, tell me, if I can write the funny puzzles which in the clash to my blog? I wonder if there is some clause to forbidden this.

Allis: https://www.codingame.com/playgrounds/40701/contribute---help/licensing

shangcode: Thanks a lot!

Allis: Sure thing.

PoojaUmashankhar: can i view the previous coc I answered?

jrke: goto noftification click on clash result you will be redirected to clash result page

eulerscheZahl: http://eulerschezahl.herokuapp.com/codingame/puzzles/ to search for the clash and try it again without time pressure

Allis: Very cool.

shangcode: Cool

jrke: my pods became dancers

jrke: https://www.codingame.com/replay/480523300


jrke: ;)

Illedan: eulerscheZahl that search text box is hard to see :D

eulerscheZahl: complain to the user who gave me the CSS :P

Illedan: Where is he :eyes:

eulerscheZahl: i even forgot who he is

AntiSquid: #category { height: 300px; width: 600px; }

AntiSquid: something like that

AntiSquid: i didn't give you that css though

eulerscheZahl: not you

eulerscheZahl: someone with lots on unicode characters in the nickname on discord

eulerscheZahl: i can't even read it. who does this?!

AntiSquid: can't read the css file?

eulerscheZahl: the discord nickname

AntiSquid: ah lol

AntiSquid: is it to put them at the top?

AntiSquid: in the user list

eulerscheZahl: https://prnt.sc/tuwq1k that's the one who gave me the stylesheet

AntiSquid: ah from different discord channel eh?

AntiSquid: can't you edit your CSS ?

eulerscheZahl: CG discord. And i can edit it of course. i just don't care enough

AntiSquid: i gave you an example above how to select by ID

Default avatar.png LinhT.Nguyen: hehehehehehehheheheheh

AntiSquid: LinhT.Nguyen how is it going what's with the hehes ?

eulerscheZahl: give me a full CSS or i won't even bother opening my editor :D

Default avatar.png LinhT.Nguyen: spamming obviously heheheh

eulerscheZahl: have to press windows+A to open Atom. So much work

AntiSquid: forgot where to download the css file ... to lazy to find all the classes and ids

AntiSquid: too *

AntiSquid: LinhT.Nguyen no spamming, Automaton2000 will get angry

Automaton2000: no, i was just thinking that

PatrickMcGinnisII: omg, quest map got me a new lvl, but damn

PatrickMcGinnisII: decided to improve Code of the Rings, got the quest xp... but then realized why i stopped doing it in the first place

PatrickMcGinnisII: It's like doing a defrag for a predetermined superfetch...yuck

PatrickMcGinnisII: Brainf*ck, no kidding

PatrickMcGinnisII: [[<]>.] Automaton2000 it's your borther

Automaton2000: and you are on the same cell?

FinnWerner: i have problems with a debug

Tiramon: general advice .. if you have problems and hope for help ... tell us what your problem is and not only that you have a problem

eulerscheZahl: switch your avatar to 1.FCN and I might help you FinnWerner :P

Tiramon: and i thought i was the one working in dortmund ;)

Tiramon: and should have a problem with schalke

eulerscheZahl: i'm just nagging, I don't have anything against Schalke

Tiramon: me neither

Tiramon: i don't care for football

eulerscheZahl: i play myself. that's more fun than watching others play

FinnWerner: Schalke und der Fcn:grin:

FinnWerner: and thanks i have fixed the problem

Dame_Mas_Onii-chan: https://www.codingame.com/clashofcode/clash/132612673ff016fda3cc495efef31c5b5af08b4

Tiramon: Dame_Mas_Onii-chan plz no clash invites in this channel

eulerscheZahl: AntiSquid already kicked him yesterday for this

eulerscheZahl: go to #clash for those links

Dame_Mas_Onii-chan: ok

Andriamanitra: i don't understand how three people thought merging partially overlapping strings is a good clash problem

Andriamanitra: takes average programmer more like an hour than 5-10 minutes lol

Default avatar.png JBM: elitist bunch

eulerscheZahl: https://www.codingame.com/contribute/view/50633c3cbd3a763444ff46065cdeb90b02cc this one?

eulerscheZahl: "Good idea, not too easy, not too hard"

Andriamanitra: yup that's the one

aquire: I see lot of skilled people use Ruby, especially for code golf. Is it worthwhile to learn it? I started doing path_to_elightenment.rb. Please tell your opinions.

Default avatar.png JBM: it's worthwhile to learn most any language

Andriamanitra: depends on what your goals are

Uljahn: ^

Andriamanitra: i use ruby because it's fun and has an absolute ton of stuff already built in

aquire: My goal is to become #1 on CoC

Default avatar.png JBM: you must know ruby

Default avatar.png JBM: and perl and bash

Andriamanitra: yeah in that case you probably need ruby for golf :grinning:

aquire: I'm originally a pythoner

Default avatar.png JBM: too bad

aquire: Did python all my life

aquire: Yeah

Default avatar.png JBM: yeah i don't know if *you*'re worth it

eulerscheZahl: and just should know most of the clashes by heart

Default avatar.png JBM: but you can try

aquire: > and just should know most of the clashes by heart wdym?

Default avatar.png JBM: you won't get to #1 by playing each clash just once

aquire: Oh that's the secre?t

Default avatar.png JBM: one of them

aquire: Then it's too boring

Default avatar.png JBM: it is

Default avatar.png JBM: but hey, you picked the goal

aquire: Yes Didn't know that

aquire: Anyway I'll learn ruby

aquire: seems interesting

Default avatar.png JBM: never a bad idea

Andriamanitra: it might not be the most useful language for general programming these days but it never hurts to know more

Default avatar.png JBM: ruby is general-purpose enough

Andriamanitra: yeah but if you already know python there is rarely a reason to use ruby instead, they fit many of the same use cases well

aquire: Python swallowed most scripting languages, lol

aquire: along with js

elderlybeginner: how to simplify it in python: not (A and B or C and D)

DomiKo: hi ;)

jacek: good afternoon

aquire: A,B,C,D are booleans?

Default avatar.png amammamamam: pls join

jacek: well duh

eulerscheZahl: A and B => A*B

Default avatar.png amammamamam: my clash

eulerscheZahl: no amammamamam

elderlybeginner: a,b,c,d booleans, yes

aquire: there's not imply operator in python ifaik

eulerscheZahl: use math elderlybeginner A and B => A*B

eulerscheZahl: with => I mean replace it

eulerscheZahl: not(A*B+C*D)

aquire: ah ok

elderlybeginner: "A and B => A*B" - no, * has higher precedence then and

eulerscheZahl: i don't get what you are saying

aquire: nice!

elderlybeginner: A, B, C, D are tests, I will have to take it in ()

eulerscheZahl: and the not part can be shortened further: A*B+C*D<1

aquire: yep

eulerscheZahl: you only get a good answer if you ask the right question. how should we know that A and B are not just variables?

aquire: pretty neat

elderlybeginner: @eulerscheZahl: thank you

elderlybeginner: it regards to that:

['R' in d and z

p] eulerscheZahl: don't panic? Astrobytes: looks like it eulerscheZahl: i had the feeling for the last couple minutes elderlybeginner: and switched 1 with 0; yes, of course don't panic :) eulerscheZahl: 'L' in d d<'M' elderlybeginner: nice :) dbdr: global pandemic, eulerscheZahl doing golf; 2020 is a weird year indeed Default avatar.png JayBeAl: hey guys elderlybeginner: is pythonic replacement of A and B or C and D with any()/all() Default avatar.png JayBeAl: i´ve just ranked up to gold in coders strike back. Is 'angle' in gold the same like 'nextCheckpointAngle' in silver? Default avatar.png Memo12334: guys im stuck Default avatar.png Memo12334: in codingame Maxlaxs: You are missing the most important part: Stuck with what? Default avatar.png Memo12334: rock paper scissors lizard spock Default avatar.png Memo12334: idk why my code prints a specific thing , oh I am joining the discord Andriamanitra: @elderlybeginner when you only have two conditions using any() doesn't make much sense, i think just writing "A and B or C and D" is more readable LeBaoHoang8A4: Hello, how to print all the moves of all pacs in wood1? I tried what they said but it didn't work. jrke: do it like command for pac 1|command for pac 2| and so on....... jrke: like if you have 2 pacs then Default avatar.png JayBeAl: i´ve just ranked up to gold in coders strike back. Is 'angle' in gold the same like 'nextCheckpointAngle' in silver? jrke: MOVE pac_1_id target_x target_y|MOVE pac_2_id target_x target_y LeBaoHoang8A4: thanks jrke: nope its absolute angle in gold of csb Default avatar.png JayBeAl: meh but why did it change? LeBaoHoang8A4: and we need to find the shortest rout, right? Default avatar.png LOMLOM: hi, anyone knows why sometimes float to int cast turns 54.0 to 53 or 90.0 to 89? Andriamanitra: floats are approximate, 54.0 might actually be 53.9999999999998 or something and casting to int usually rounds down jrke: yeah and int round downs the no Andriamanitra: most languages have rounding function that you can use Default avatar.png LOMLOM: ye even if i use round() i get wrong values Default avatar.png LOMLOM: floor() * jrke: I think all lang has round func Andriamanitra: well yeah floor rounds down Default avatar.png LOMLOM: but the value is exactly 54.0 LeBaoHoang8A4: minus by 1? Andriamanitra: there is no such thing as exact float my friend, it's an illusion that will bite you in the ass sooner or later Default avatar.png LOMLOM: im using c++ jrke: lemme then if c++ jrke: its working jrke: cerr<<int(54.0)<<endl; jrke: gave me 54 Default avatar.png LOMLOM: its not always the case for me jrke: thi gave 53 cerr<<int(53.99)<<endl; jrke: this* Default avatar.png Galaxy_001: https://www.geeksforgeeks.org/round-in-cpp/ jrke: maybe its not exact 54.0 SPDene: where are you getting the value from? it's probably 53.99999999999 Default avatar.png LOMLOM: when i print the value as a float i get 54 Andriamanitra: never trust floats jrke: and always trust toads ;) Default avatar.png LOMLOM: toads ?? SPDene: even hypnotoads? Default avatar.png Galaxy_001: no doubles Andriamanitra: even a+b == b+a is not always true when using floating point arithmetic :wink: jrke: does rand() in cpp also gives negatives? Andriamanitra: no SPDene: "Returns a pseudo-random integral number in the range between 0 and RAND_MAX." - so no, not unless you do something else with the value Default avatar.png LOMLOM: this is so wierd jrke: can i do like rand()%-100 to get negatives Astrobytes: Try std::uniform_real_distribution Default avatar.png Galaxy_001: not abs() Default avatar.png Galaxy_001: abs() gives positive values SPDene: absolutely :) Default avatar.png Galaxy_001: abs:joy: jrke: :) SPDene: hey, my jokes might be bad, but at least here, I have confidence that people know WHY they're bad :) Andriamanitra: someone share the code for this ridiculous polygon problem please Andriamanitra: i'm sure i couldn't get it done even if i was given all day eulerscheZahl: the polygon problem i think we all instantly know which one that is, don't we? eulerscheZahl: (sarcasm) Maxlaxs: Think he was talking to the coc team Andriamanitra: ^ yeah sorry Andriamanitra: i dont know if there's a way to see the problem after submitting i cant remember what it was called any more eulerscheZahl: http://eulerschezahl.herokuapp.com/codingame/puzzles/?q=polygon&category=CLASHOFCODE is it here? Andriamanitra: yeah it's the area of polygon Andriamanitra: that's an useful site huh eulerscheZahl: sounds like a google question eulerscheZahl: https://www.mathopenref.com/coordpolygonarea.html Andriamanitra: i did basically that (after googling lol) but it only works for convex polygons i think Andriamanitra: which is why i only got 25% eulerscheZahl: did others score 100%? Andriamanitra: 2 people out of 8 did jrke: euler nice website eulerscheZahl: thanks jrke :) Andriamanitra: hmm, that does claim it works for concave polygons too, i wonder what i did wrong then jrke: what you used to make it euler js/html/php or any other thing eulerscheZahl: python (Django) eulerscheZahl: with free hosting on heroku jrke: ok eulerscheZahl: backend looks horrible :D eulerscheZahl: puzzle DB has 3 columns: link to the contribution, puzzle, comments eulerscheZahl: the puzzle is a json, so each time you search, i deserialize it and check for the keywords in the json object (the statement, testcases, ...) eulerscheZahl: and give different score depending on where I find it (title is more relevant than body or comments) Allis: Hm... it doesn't seem to handle numbers well? eulerscheZahl: could you give an example? just tested "123" Allis: There's a really annoying puzzle that seems to be reverse-only where you need to figure out how to get from 583 to 440. Allis: I searched those numbers to confirm/deny the reverse-only hypothesis, but it was all false positives. eulerscheZahl: and a rather long list aquire: nice website euler aquire: is it opensource aquire: I'd like to see it eulerscheZahl: https://www.codingame.com/contribute/view/143765bb4be8ad4a3b98b684ddbd0ed971e9 eulerscheZahl: this seems to be it Allison eulerscheZahl: srong ping :/ eulerscheZahl: wrong* eulerscheZahl: not open source aquire i'm ashamed of my own mess aquire: ok no problemo aquire: don't be lol aquire: I like mess actually aquire: (In a positive sense) eulerscheZahl: doing a cleanup (aka full rewrite) is on my list for a while Allis: That's definitely the one, thanks. Allis: I guess it makes sense to not show all the test cases in your interface. eulerscheZahl: i do it that way because it's easier actually :P eulerscheZahl: CG has an API that gives the puzzles in a formatted way eulerscheZahl: one field is testcases/validators Allis: Right, makes sense. eulerscheZahl: another one is the statement as HTML eulerscheZahl: so all i do is print the html formatted statement and the testcases are just not part of it aquire: have you guys seen this!https://www.youtube.com/watch?v=BxV14h0kFs0 CHARLITOTI: cc aquire: (related) :) Q12: http://chat.codingame.com/pastebin/45e04d64-a588-4207-9fc3-46501230bf65 Q12: Hi, I'm trying to solve the game Guessing n Cheating and I passed all the tests but when I got to the Validators I was able to pass them all except Validator 2. I tried for over half an hour already to find the problem but failed. Can someone look at my code and tell me why it does not work, please? (UP) Maxlaxs: You shouldn't paste full code :/ eulerscheZahl: you could use my website too Q12 eulerscheZahl: locate the puzzle, open the demo IDE and play the validator eulerscheZahl: Found: No evidence of cheating Expected: Alice cheated in round 3 Q12: What the url of your website? Q12: *is eulerscheZahl: http://eulerschezahl.herokuapp.com/codingame/puzzles/?q=guessing&category=ANY Q12: Thanks a lot :grinning: Q12: I really appreciate :slight_smile: Andriamanitra: chat shouldn't steal focus when clash begins T_T Andriamanitra: it costs a precious second every time eulerscheZahl: add ?disableChat to the URL Andriamanitra: i like seeing chat i just don't like it taking focus _-: hey Ruby people it's not fair! Andriamanitra: i agree! it's completely unfair that you only need 5 characters to convert string to int in python while it takes 6 in ruby _-: Ah lol Andriamanitra: oh wait actually .to_i is only 5 characters, it just looks longer than int() Andriamanitra: at least you have map(int,x) i guess :grinning: Default avatar.png GInnjo: What in the hell? I just submitted my result that failed one step but got 100% and gave me that same which failed to be successful Allis: You got lucky and your implementation worked on all the validators (hidden test cases). Allis: Python's biggest golf win over Ruby is `[::-2]`. Default avatar.png GInnjo: I know it was something about search speed from table. Dunno what could have been faster than hashtable based on string length and first letter. Still timed out, making me not to press "submit" button. :/ cjzw: someone check out my latest contribution Astrobytes: You don't need to keep asking people to check it out every day cjzw. It's in Contributions, people will check it out. Have patience. _-: That's a winning mentality right here Andriamanintra _-: Wait for me to finish path_to_enlightenment.rb. I'll finish y'all Allis: Are you enjoying the Koans? Default avatar.png Qwerty_1331: hey guys _-: yes _-: still on objects _-: problem with object_ids _-: How can I paste things here? _-: I saw someone use a kinda pastebin Allis: I think it auto-pastebins long messages? _-: ah ok _-: I have a problem with this _-: http://chat.codingame.com/pastebin/e66db934-b0e9-4e8e-acab-fe6ed9c26b88 Allis: You don't expect #clone to create a new object? _-: It says small numbers have fixed ids. So if I do something like _-: obj=1 _-: copy=obj.clone _-: then this is a contradiction right? _-: (To what I pasted ) Allis: It is, and you just kinda have to be aware of the fact that small-enough integers are secretly just tagged pointers under the hood. Allis: They're a special case that the Koans don't really bother to go over. _-: Ok thanks Allis: Sure thing. Be advised that Symbols also contradict the rule. _-: And to your earlier question, python behaves the same way so I expected that more or less Allis: That's good. _-: I'll gloss over this anyway. Don't think I'll need the under the hood stuff _-: Right? Allis: Not unless you catch a mood and decide to get your hands dirty. Allis: p ObjectSpace.each_object.select { |o| o.__id__ == o.clone.__id__ rescue nil } Allis: You can run that to see which objects that exist when you start the interpreter don't actually make a new object when cloned. Allis: it's all Symbols, Integers, and—on my machine—a Float and a Complex. Allis: Yes, Ruby lets you just iterate over every single living Object if that tickles your fancy. :sweat_smile: _-: python has it too __globals__ and __locals__ I think _-: rather globals() and locals(). I wonder we both are talking about the same thing tho _-: By Symbols you meant things starting with : I suppose _-: http://chat.codingame.com/pastebin/41523e67-cc32-42e6-ad1a-95803021f9f3 Allis: Yeah, those are Symbols; they're effectively "efficient strings", and are generally used accordingly. Allis: They're immutable (unless you get your hands dirty with something like Fiddle, but ignore that) and references to a particular Symbol always refer to the same object in memory; great for things like Hash keys, method names, things of that nature. _-: Nice. I'm now in about_hashes.rb. Now I know why hash keys are Symbols _-: Makes sense Default avatar.png SneakyDoodle: Man python3 is popular on this site. Default avatar.png Memo12334: so there is this easy challenge but it's extremely hard, nice jacek: hm? eulerscheZahl: a hard easy problem? like this? https://thinkzone.wlonk.com/MathFun/Triangle.htm MaliciouslyCrypticUsername: UwU MaliciouslyCrypticUsername: I figured out what's wrong with my code vs zombies MaliciouslyCrypticUsername: I was forgetting to clear my lists of humans every turn lol eulerscheZahl: you have dead code eulerscheZahl: ba dum ts MaliciouslyCrypticUsername: ??? eulerscheZahl: zombies, dead code... a joke isn't fun when you have to explain it MaliciouslyCrypticUsername: Oh MaliciouslyCrypticUsername: I see MaliciouslyCrypticUsername: Ha ha ha? eulerscheZahl: thanks for being polite about that nonsense :D MaliciouslyCrypticUsername: You're welcome? MaliciouslyCrypticUsername: I keep failing on split second reflex MaliciouslyCrypticUsername: Going for the closer zombie every time Astrobytes: You're being outgunned in the humour stakes by a German MaliciouslyCrypticUsername. Must try harder :D eulerscheZahl: thanks for breaking the awkward silence Default avatar.png mingmingrr: got a zombie problem? try picking your brain for ideas MaliciouslyCrypticUsername: ... MaliciouslyCrypticUsername: ... eulerscheZahl: so.. you don't save the humans in some testcases? dbdr: https://www.youtube.com/watch?v=FBWr1KtnRcI MaliciouslyCrypticUsername: In that one testcase specifically. My code makes ash move towards the closest human, but in this case the closest human is a turn away from getting eaten Astrobytes: lol dbdr Default avatar.png BeardedBrocolli_4577: anybody? im stuck with the validator phase Default avatar.png BeardedBrocolli_4577: in the murder in the village puzzle Default avatar.png BeardedBrocolli_4577: Im not supposed to know whats that to avoid hardcoding I get it Default avatar.png BeardedBrocolli_4577: but also no idea whats wrong Default avatar.png BeardedBrocolli_4577: failed 1 of 6 Default avatar.png JBM: you solve all tests but 1/6 validators? Default avatar.png BeardedBrocolli_4577: yeah LOL Default avatar.png BeardedBrocolli_4577: wait nvm im gonna try somethin Default avatar.png JBM: sounds like a bad puzzle then Default avatar.png BeardedBrocolli_4577: nah its my fault I see the wrong now Default avatar.png Juunas: hi jacek: ohai Default avatar.png Qwerty_1331: eyo MSmits: hi Default avatar.png Meowsuke: hiii Default avatar.png mateusedival: hi jacek: c-c-c-combo breaker MSmits: wha? MSmits: is that from killer instinct? Putnam3145: yes MSmits: N64? Putnam3145: i was about to call it old-school but--okay nevermind it is jacek: :nerd: OddBitKid: after every Clash of Code session we asked about test case relevancy. What exactly does it mean? MSmits: it means do the test case test the problem well Putnam3145: i've been basing it on whether the test cases properly test edge cases Putnam3145: and, also, like Putnam3145: if I 100% the test cases with a non-hardcoded solution but don't get a 100% on scoring, I guess? Putnam3145: but that's never actually happened Putnam3145: (i don't do hardcoded solutions) Putnam3145: (who even has TIME for that) OddBitKid: Hmm Astrobytes: Sometimes only the validators test the edge cases MSmits: which is undesirable Astrobytes: Think it's less the case with newer ones Astrobytes: hi MSmits btw OddBitKid: I assumed that it was on the relevancy for the challenge for testing programmers skill MSmits: hi Astrobytes Astrobytes: It's about how relevant the test cases are to the problem being solved OddBitKid: I assummed that test case covery was easily tested by the engine and som simple stats OddBitKid: maybe they should put at tiny explainer to the ratings - I might not bee the only one to get i wrong initally Astrobytes: Coc's are user-created, sometimes users don't have the best test cases (or indeed validators) Astrobytes: I guess it was supposed to be meaningful in that regard OddBitKid: Thanks OddBitKid: I got it. Putnam3145: i think the rating criteria are good Putnam3145: occasionally I get a CoC whose *entire* difficulty is ignoring all the chaff in the word problem Putnam3145: like, to the point that I feel it was written specifically to confuse the reader Putnam3145: but there's a rating criterion for that Astrobytes: I'm guessing some things are perhaps gonna change a little with the recent updates and whatnot, but rating systems are always affected by subjective bias I guess MSmits: yeah i hate that kind of description Putnam3145: hmm Putnam3145: why do I want to write everything in a functional way these days MSmits: cuz that's so you Default avatar.png JBM: cuz that's how it should be Default avatar.png tssw: ups Astrobytes: cuz (reduced) Putnam3145: trying code of the rings and deciding to program in a completely different way than i normally do Putnam3145: to be exact i'm constantly thinking of, like, whether I can make my code look less "special case"-y, but here i'm just sorta like Putnam3145: nah Allis: Hm... what sort of special cases are you running into? Putnam3145: everything's a special case if you turn off your brain hard enough Allis: Well, sure, but you're better than that. :P Putnam3145: just in code of the rings, there's the fact that the state of each individual part of the tape is correlated to but not equal to a proper char, to which my original solution was to make some manner of general lookup table for this but then i realized that i could just do a switch statement for the special case of 0 == \32 rather than the rest, which are 1 == \65 and 2 == \66 and so on Putnam3145: i could've also general-cased this with x+(sgn(x)*32)+32, i think but that's somehow even worse Allis: Hm... I just did `alphabet=[' ',*?A..?Z]` and then mapped the characters of the message to their indices. Putnam3145: yes, well. Allis: A lookup table, I guess, but that doesn't feel special-casey. Putnam3145: sudden realization that i have to use the lookup table anyway Putnam3145: cause it's on a cycle Allis: Well, there's always modular arithmetic. Default avatar.png Gingsy: plz share code! Putnam3145: please do Putnam3145: it's the spirit of the thing Putnam3145: i'm sure it helps people lots _-: Allis Allis go away _-: Come again another day! _-: Allis, Please, choose stronger opponents pleaaaaaase! Nicky1812: guys Nicky1812: how to input 2 string on 1 one line by python? Nicky1812: im a newbie :(( Allis: Seems like you're looking for str.split()? Default avatar.png zile151: ^, or input().split() if im understanding ur question correctly Nicky1812: hmm TwT: http://chat.codingame.com/pastebin/8a4831d3-2ef2-4eea-8292-45035187f8f5 TwT: if it is -->Hello TwT: -->World then you might be talking about [input() for x in range(2)] Nicky1812: ok thanks guys Nicky1812: but how about input "hello/word" TwT: input().split("/") Nicky1812: we can get "hello" and "word" Nicky1812: okok thanks i have got it TwT: look into split() online Nicky1812: :grin: _-: or help(str) on python interpreter Putnam3145: am i allowed to get mad at how C and descendants define modulo Putnam3145: let's take the simple example of (n%4) Putnam3145: waitin Putnam3145: wait wait Putnam3145: lemme look up how C in particular does it Putnam3145: I may be making the grave mistake of assuming C++ is a superset of C _-: they are the same _-: should be _-: c++=c with classes Allis: Thankfully, a lot of newer languages define it more sensibly, such that -1 % 4 == 3. Putnam3145: yeah okay Putnam3145: yes, I'm complaining about the definition that -1 % 4 == -1 Putnam3145: instead of 3 Putnam3145: also, they aren't the same Putnam3145: haven't been since 1999 _-: Oh Putnam3145: it *was* originally "C with classes" Putnam3145: in the '80s Putnam3145: then it evolved, a lot, and so did C, somewhat Putnam3145: they diverged by C99 Putnam3145: ...though not significantly Allis: You can use something like `(n+d-1)%d` to get the wraparound in languages that don't support it natively. Putnam3145: obviously you can still use a lot of C headers in C++ Putnam3145: most, even Putnam3145: or rather Putnam3145: idiomatic C/C++ is such that if your file is a .h file, it should be readable by both C and C++ Putnam3145: that's just idiomatic though Putnam3145: i deal with all this by not using C or C++ unless I can help it Putnam3145: it doesn't help that I have to spin up a linux VM or computer to make working with either's toolchain tolerable Nicky1812: how to change "helL" to "HELL" in python guys? Putnam3145: the general term for that is "to upper" Putnam3145: i don't know what it is in python Putnam3145: to upper, or to capital Default avatar.png Sajori: 'hell'.upper() Putnam3145: googling either will work, but to upper usually gets better results Putnam3145: when did i start doing bracketless ifs Putnam3145: what has happened to me Default avatar.png zile151: isn't bracketless ifs the "correct" python style Putnam3145: yes Putnam3145: I'm talking in D, which uses C-like if syntax Putnam3145: actually I think it's specifically because I've been working on a project in C++ for a while? Putnam3145: one that happens to use bracketless ifs hither and tither Putnam3145: so I probably picked it up as part of the "project style" Putnam3145: too bad Putnam3145: the funny part is that bracketless ifs are actually WORSE in C/C++ than D Putnam3145: on account of the C preprocessor allowing for some really horrible monkey business to happen with them Putnam3145: if(c) return TRUEMODULO(a,b) Putnam3145: whoops TRUEMODULO's got multiple statements so now you've got a bizarre error! Default avatar.png zile151: i dont use C much but i usually/luckily get syntax errors when i miss brackets from my experience Putnam3145: sure, but Putnam3145: if(b) dostuff() Putnam3145: is perfectly valid syntax in C Putnam3145: uh, if you Putnam3145: add the semicolon I fatfingered away Allis: Multi-statement macros should be wrapped in a `do { ... } while (0)` to avoid that particular brand of surprise. Putnam3145: thank nearly 5 decades of continuing development for compilers that generate identical code when you do that Allis: I'm not sure I follow. That's a purely lexical thing that compilation doesn't really enter into. Allis: It works as long as the compiler correctly executes the body of a do loop at least once and doesn't interpret 0 as truthy. Putnam3145: yes Putnam3145: i'm saying that a modern compiler won't even generate a jump for that Putnam3145: it'll figure out that the inner block runs once Putnam3145: so any premature worries about "optimization" can be ignored Allis: I see. _-: How to disable editor tooltips. It's really annoying sometimes. Allis: There's no native option, but you can be rid of them with a user stylesheet. Allis: I personally use the Stylus extension. _-: Tell Me Default avatar.png zile151: hey Allis, for the clash where you output the first 3 digits of a to the power of b, does ruby somehow optimize the calculation? Default avatar.png zile151: for python if you do like str(a**b)[:3] it times out Allis: That's interesting. I just did `(a**b).to_s[0, 3]` and didn't even realize I was getting away with anything. Allis: You're quite sure your inputs were correct? Default avatar.png zile151: well it passes all the test cases except the last one which is like 109^900000 Default avatar.png zile151: i mean i still got 100% but i had to do this: http://chat.codingame.com/pastebin/b43486e8-51e8-4977-a3ec-b8a9651e7b61 Allis: I can confirm that that operation is a heck of a lot faster in Ruby. Allis: So yes, the interpreter must be doing something clever under the hood. Default avatar.png zile151: yep, thanks for replying! Allis: No problem. _-: Allis can you please share your settings. I dunno what to do Putnam3145: oh dear Putnam3145: i've made a working thing for code of the rings Putnam3145: I thought I'd coded it so that it'd properly go - or +, whichever's faster Putnam3145: and yet Putnam3145: the working version, for AZ, is Putnam3145: `+.+++++++++++++++++++++++++.` Putnam3145: it works, but it's, uh, not ideal Allis: Oh, that's no good. Allis: @_- If you've got a way to use custom CSS, you just need: `.editor-widget { display: none; }` Putnam3145: speaking of being unable to google things Putnam3145: what the hell is the proper term for "modular distance" _-: Are you in a "vow of ungoogling" or something? Putnam3145: the function such that f(26,1,27) == 2 Putnam3145: no Putnam3145: opposite Putnam3145: I can't figure out what to google to get a proper way to do that Putnam3145: every attempt at writing it myself has failed despite it being seemingly simple math _-: manhatton distance? _-: what is it you are attemting? _-: attempting* jrke: attempting what? Allis: @Putnam3145 That's just `(b-a)%c`, no? Allis: Since it doesn't make much sense to speak of negative distance, probably there's no clear-cut definition of "modular distance" either. Allis: The wraparound is kind of implicit. Putnam3145: it makes sense to speak of negative distance in the case where direction matters Putnam3145: and this is that case Allis: You gonna print -8 minus signs? Putnam3145: I am going to print 8 minus signs if the distance is -8 Putnam3145: and if it's 8, I'm going to print 8 + signs Allis: No sense getting caught up in linguistic rigmarole, so I'll just point out that you're definitely on the right track. Allis: If your language has something like min_by where you can calculate the minimum based on some predicate, you're golden. Putnam3145: turns put my closestToZero function was just hilariously wrong Putnam3145: there, now it outputs +.--. Putnam3145: yay Putnam3145: in fact it passes all tests Putnam3145: now, to make it Better