Chat:World/2022-03-30
jacek: :upside_down:
TimothyAlexisVass: Meaning of life = * ?
PatrickMcGinnisII: Life is what you make of it
TimothyAlexisVass: bs
TimothyAlexisVass: bananasauce?
PatrickMcGinnisII: That's what Douglas Adams was saying... google it
drnobody: 42
drnobody: Answer to the ultimate question...
PatrickMcGinnisII: Why do I have the desire to make some tea
drnobody: *looks around for towel*
**PatrickMcGinnisII laughs
drnobody: *finds book with "Don't Panic" written in a calming font on the cover...*
PatrickMcGinnisII: was deepthought a GA or a NN?
**PatrickMcGinnisII lost his mind years ago
Synergyforge: My stupid pathfinding function doesn't work! :rage::rage::rage:
PatrickMcGinnisII: working on the new optim?
Uljahn: guess it's the Labyrinth puzzle
drnobody: you know, I don't know ... I would imagine an NN
LimitMax: hi hi world
PatrickMcGinnisII: drnobody either way I feel the wait time
Synergyforge: wait maybe it is working... :thinking:
drnobody: heheh
derjack: :upside_down:
PatrickMcGinnisII: Finally: https://www.codingame.com/replay/616481223
derjack: :tada:
Uljahn: why not to start cutting (5, 17)?
PatrickMcGinnisII: it's not perfected, and doesn't save trees - just houses (if able)
Uljahn: ah, indeed
PatrickMcGinnisII: it's kinda like the coid cut algoithms
PatrickMcGinnisII: er COIF
Luca_Crivellari_Balice: porco dio
derjack: :no_mouth:
tantheman: buy schmeagle coin guys
PauliV: become millionaire today
tantheman: :point_right_tone2::ok_hand:
VizGhar: where is 5DNL when we need him... Automaton2000 get them
Automaton2000: so i could try to find an answer by googling
derjack: nyoro~n
Uljahn: mods can't ban offline users, it's one of xmpp restrictions :(
derjack: what a nice idea... :thinking:
Tryst: take :taco:
antiwonto: [auto] aww, there are no tacos to take
Wontonimo: does someone need banning?
Cdude: the quest map os to big
Uljahn: what's the resolution of your device?
Uljahn: can't you zoom out?
Cdude: is on my mobile the quest map and the other ting too
Uljahn: use desktop mode on mobile
derjack: codingame isnt good for mobile
Cdude: ok
Cdude: but is a website
Uljahn: not just a regular website but a coding platform
derjack: clash of code webstie
Cdude: ok
PainEXE: Im beating the boss but its not putting me in the next league
PainEXE: do I just have to wait in the arena for a while?
eulerscheZahl: oh, a new optim. when did that happen?
eulerscheZahl: should have checked the forum instead of bothering you. 6 days ago
MrAnderson: @PainEXE you need to rank higher than the boss after all of the rounds are done. Beating the boss is a good indicator that you are close, but beating him one time isn't enough.
MrAnderson: Well, sometimes beating him once is enough, but the criteria is your final rank.
coddednight: ok can someone help me
Uljahn: it depends on your problem
coddednight: i need help with java
Uljahn: do you have the slightest idea how little that narrows the problem down?
empties: example: http://chat.codingame.com/pastebin/8ee3541b-3e96-4206-a5d5-e75a4cd4666a
empties: example: http://chat.codingame.com/pastebin/006c6272-4ea7-410f-b8b2-3084fdfb1599
-.-'
eulerscheZahl: too much boilerplate for a question, just get straight to the point
VizGhar: So... I wrote a bot, that always looses in UTTT :D
VizGhar: funny to look at, but I can't make him do opossite
empties: where can I see your bot?
VizGhar: I obviously havent posted it :D
empties: great, still patent pending, I suppose
NewCoder09: hey
antiwonto: [auto] Hey NewCoder09, here is a :taco: for loggin in today while it is quiet. You now have 2 tacos
Synergyforge: gimme a taco, immediately!
NewCoder09: you have to say something when the chat is really quite
Synergyforge: I was thinkin' it, just not sayin' it. :)
visva: wassss up
Wontonimo: anyone working on mad pod racing and would like a hand?
Wontonimo: or any other multi for that matter
Wontonimo: nope
coddednight: does anyone know how to do mad pod racing in java
AdemDj12: :taco: ademdj12
AdemDj12: i am waiting to tackle mars lander 3
.[-.-].: Hi peeps!
.[-.-].: Any way I can check what the threshold is to get into top 2% of the bot programming category?
.[-.-].: Trying to do the achievment .D
ScifiSpirit: I think the games say how many people have bots there, take 2%, then you get a number, try to look at their score?
ScifiSpirit: Unless they say that outright, but i assume you have looked.
ScifiSpirit: Also i'm assuming it's per game, but those formulas used are actually published here somewhere.
ScifiSpirit: And you can track your own progress in your profile.
Wontonimo: hey coddednight , yeah I can help
Wontonimo: if you want to get into the top 2%, focus on getting a high rank in 1 or 2 bot games instead of low rank in many
Wontonimo: you need about 6,200cp in bot programming specifically ScifiSpirit
EToTheIPi: :taco:
EToTheIPi: :taco:
EToTheIPi: :taco:
antiwonto: [auto] ':taco:' was defined as ' A currency to some, sustenance for others '
antiwonto: [auto] ':taco:' was defined as ' A currency to some, sustenance for others '
ScifiSpirit: Or try to get high rank in every bot game, you might be better in one of them :)
antiwonto: [auto] ':taco:' was defined as ' A currency to some, sustenance for others '
EToTheIPi: :taco::taco:
EToTheIPi: :taco:
EToTheIPi: :taco:
antiwonto: [auto] ':taco:' was defined as ' A currency to some, sustenance for others '
antiwonto: [auto] ':taco:' was defined as ' A currency to some, sustenance for others '
Wontonimo: key EToTheIPi, you have been kicked for spamming
Wontonimo: you are welcome to come back in about 5 min if you behave
Lambert_W_Function: :taco: tuesday
Lambert_W_Function: oh wait its wednesday
Wontonimo: .[-.-]. you need about 6200cp in bot programming to reach 2%
Synergyforge: I can't even get my stupid maze code to work. It works on two of the tests. :(
ScifiSpirit: I have 3426, so i'm pretty far :)
ThePurpleOne1: why is there no one in the event
ScifiSpirit: It's alright though, i'm not very competitive person :)
Wontonimo: what event ThePurpleOne1 ?
Wontonimo: which maze code ScifiSpirit ?
Wontonimo: The Labyrinth ?
ScifiSpirit: I wasn't the one talking about maze code.
Wontonimo: oh, sorry
ThePurpleOne1: the python shortest code
Lambert_W_Function: ok
Wontonimo: Synergyforge, (the other S... name), how's the maze thing
Synergyforge: Other S name? :O
ScifiSpirit: Synergyforge, he was talking about me, ScifiSpirit :)
Synergyforge: I got tests 1 and 3 working. :(
ScifiSpirit: See, s + tab turns into my name :)
ScifiSpirit: Because of my 'c' ;)
ScifiSpirit: Which puzzle are you doing?
Wontonimo: did you implement A* search Synergyforge ?
eulerscheZahl: that's not how tab completion works. depends on the users already active when you log in and such.
Synergyforge: Been messing with this dumb labyrinth one for two days
ScifiSpirit: Oh. I thought it was alphabetical.
eulerscheZahl: i get Synergyforge on s[tab]
Wontonimo: keep at it. it's difficult
Wontonimo: yes
ScifiSpirit: It says a breath first search would work too. I just looked at it.
Wontonimo: do you know how to implement BFS or A* ?
ScifiSpirit: But i think i'm going to implement A* first before i'm going to attempt that one, since i'm already doing it, and i've kind of done it already in another language.
eulerscheZahl: within codingame A* is usually overkill, as maps are small enough
Wontonimo: Synergyforge , are you implementing A* or BFS ?
eulerscheZahl: "breath first search" you forgot a letter
ScifiSpirit: Well, i'm going to do A* anyway for projects outside Codingame, so i can just use it as a "library" then.
ScifiSpirit: Right :D Not breathing :D
ScifiSpirit: But don't forget to breathe while doing breadths ;)
eulerscheZahl: so far i never forgot to breath, lucky me
.[-.-].: Thanks Wontonimo :)
Wontonimo: A* is the same as floodfill, except do a sort on math.sqrt(dx*dx + dy*dy) before picking the next element to expand
Wontonimo: but like eulerscheZahl said, these maps are so small a floodfill will also work just fine
eulerscheZahl: and c# has no built-in priority queue :(
eulerscheZahl: i noticed that years ago and still hate whoever made that decision
Wontonimo: .[-.-]. , would you like some help getting to Silver in Mad Pod Racing ? It will gather about 2000 points for you
eulerscheZahl: oh, you would do that for me Wontonimo? sure, go ahead
Wontonimo: you are currently in bronze using Kotlin in position 68,000 overall. I can help you get to at least 25,000 overall
eulerscheZahl: i don't even remember the Kotlin part. what do i have to do?
Wontonimo: no, i'm talking to the other guy who's name is .[-.-].
eulerscheZahl: oh, that's a nickname
Wontonimo: yeah ... difficult to type
Wontonimo: :taco: eulerscheZahl
antiwonto: [auto] Wontonimo has awarded eulerscheZahl 10 tacos. eulerscheZahl now has 38 taco. Wontonimo now has 28 taco
eulerscheZahl: :taco: Wontonimo
antiwonto: [auto] eulerscheZahl has awarded Wontonimo 10 tacos. Wontonimo now has 38 taco. eulerscheZahl now has 39 taco
ScifiSpirit: Aren't you already in like gold league or something?
Westicles: I have made the greatest clash ever
ScifiSpirit: Or actually, probably legend leagure.
eulerscheZahl: there's no legend league without me
Wontonimo: Euler is uber league, above legend
eulerscheZahl: so, what's the fuzz about that clash?
Westicles: Touching Balls?
antiwonto: [auto] Westicles be respectful and watch your language https://www.codingame.com/playgrounds/40701/help-center/code-of-conduct
eulerscheZahl: touching
eulerscheZahl: balls?
antiwonto: [auto] eulerscheZahl be respectful and watch your language https://www.codingame.com/playgrounds/40701/help-center/code-of-conduct
eulerscheZahl: but i'm a sports enthusiast
eulerscheZahl: fine, i'll say soccer spheres
Westicles: that's nuts
Wontonimo: i guess antiwonto is really specific about geometry and food
Westicles: :taco: Automaton2000
antiwonto: [auto] sorry Westicles but you can only award tacos once per day
Automaton2000: i would just have to get to the next league
fabio-dev: :heart_eyes: Automaton2000
Automaton2000: i thought that would be useful
ScifiSpirit: Is it possible to make Automaton2000 say :taco: <nick>? :D
Automaton2000: i don't think you can use it in other ways
Wontonimo: I suspect nicknames are filtered out of its vocabulary
ScifiSpirit: What would the chances be anyway...heh.
antiwonto: [auto] aww, there are no tacos to take
Wontonimo: gtg , later
jacek: :upside_down:
antiwonto: [auto] ':upside_down:' was defined as ' ɥǝllo '
jacek: :taco: Automaton2000
antiwonto: [auto] jacek has awarded Automaton2000 10 tacos. Automaton2000 now has 51 taco. jacek now has 39 taco
Automaton2000: i guess there is a way to go
Automaton2000: is the best way to be sure
Westicles: shakedown Automaton2000
antiwonto: [auto] Using your superior Intelligence of 6 you shake 10 :taco:s off of Automaton2000. 9 fall on the floor, 1 got crushed, and you lost 1
Westicles: take taco
Automaton2000: and why do you need to focus on a single line
antiwonto: [auto] Westicles has taken 5 :taco:s off the floor and now has 14. There are 4 left
Automaton2000: because i dont understand how to use them
eulerscheZahl: take taco
antiwonto: [auto] eulerscheZahl has taken 2 :taco:s off the floor and now has 41. There are 2 left
eulerscheZahl: eat taco
antiwonto: [auto] eulerscheZahl has eaten 10 :taco: and your Dexterity is now 1. You have 31 left
Westicles: take taco
antiwonto: [auto] Westicles has taken 2 :taco:s off the floor and now has 16. There are 0 left
Synergyforge: And here I've been typing people's names. :grimacing::sweat_smile:
MACKEYTH: C++ question: I'm looking for a method that will return System time as a millisecond-resolution primitive value representing units since start of epoch.
MACKEYTH: Kinda in the weeds with the documentation. Seems like everything returns a string or a specialized time object.
MACKEYTH: Something equivalent to System.currentTimeMillis() from Java
MACKEYTH: would be ideal.
MACKEYTH: Trying to minimize performance/memory load for controlling timed loops.
Synergyforge: ctime library doesn't fill that need?
Westicles: I think people use chrono mostly
ScifiSpirit: ctime's clock() is pretty much the smallest overhead that i know of
MACKEYTH: I figured it would be someting from ctime or chrono
ScifiSpirit: But that doesn't mean that it's a good idea to time things with it with repeated clock() calls.
Ayza: pretty sure this should help https://stackoverflow.com/questions/19555121/how-to-get-current-timestamp-in-milliseconds-since-1970-just-the-way-java-gets
Ayza: it uses chrono
ScifiSpirit: If that's what you mean. All system time calls have overhead, and are definitely not millisecond-resolution, since the operating system scheduler rarely even reaches such resolution
ScifiSpirit: But for controlling timed loops, there really isn't anything else.
ScifiSpirit: For main loops and events and such i guess either of chrono or clock is fine.
ScifiSpirit: I once investigated the fluctuations in timing of the scheduler, and i think i once came close to 100ms pause in my testing process.
ScifiSpirit: Scheduler tries to maintain 10ms slices, but apparently can reach 10 times longer, or maybe even more.
ScifiSpirit: At least in Windows.
ScifiSpirit: Probably was in Windows 10 that i tested.
MACKEYTH: It seems like all the methods I've found so far return an object that contains a count of system-specific time units plus methods for translating that into s/ms,etc.
ScifiSpirit: Oh, right. Clock indeed returns a system specific value, which you convert with TICKS_PER_SEC macro, if i remember correctly.
MACKEYTH: If that's how it has to be I can deal, but I was hoping to avoid the performance hit of creating a object and calling its translation method(s).
ScifiSpirit: Oh no, it was CLOCKS_PER_SEC.
ScifiSpirit: Does it have to be cross-platform?
Notgoodatcoding5: Hello, how are you guys?
MACKEYTH: Hiya! Good, trying to learn some c++
Notgoodatcoding5: Oh fun!
MACKEYTH: So, C++ programmers: what is your preferred method of exiting a sim loop based time elapsed?
MACKEYTH: Have been happy to discover that C++ shares a lot of language syntax w/Java
MACKEYTH: switch, for, for each, and if are identical.
ScifiSpirit: clock() is what i've been using because i like the simplicity.
MACKEYTH: C++ doesn't seem to like storing arrays in containers, though, which is a bit disappointing
ScifiSpirit: Yeah, that can be a bit... clumsy.
MACKEYTH: Buuut, it does let you store primitives in containers, which is a good thing.
ScifiSpirit: But you can use something else rather than raw arrays.
ScifiSpirit: Care to paste an example?
MACKEYTH: I hate not being to store primitives in Java collections objects.
PainEXE: Am I allowed to promote my puzzle here? or nah
MACKEYTH: I was experimenting last night with trying to make a vector of int[], but c++ wasn't having it. Kept spitting out incredibly verbose compiler errors.
MACKEYTH: Finally went with vectors of vectors
ScifiSpirit: PainEXE: CodinGame puzzle? I'm pretty sure you are allowed to promote stuff on CodinGame.
PainEXE: https://www.codingame.com/contribute/view/11533e190b55b63be956c0a928a28afdbe6fe Can someone gimme some feedback on this?
MACKEYTH: Doesn't seem to be a way to create/pass array literals, either, which I do all them time in Java.
ScifiSpirit: MACKEYTH: yeah, that's usually the solution. Arrays are just pointers in C++ just like in C, but if you use the array object, that is another story.
ScifiSpirit: Same with literals, you can use objects instead, and then use initializer lists.
MACKEYTH: Doesn't seem like c++ is cool with triangular multidimensional arrays, either.
ScifiSpirit: I guess the old stuff that C++ inherits from C is what surprises someone learning it.
ScifiSpirit: Same thing with those, they are pointers, or multidimensional pointers.
ScifiSpirit: In C++, you basically have 2 languages in one.
ScifiSpirit: Although not the entirety of C.
MACKEYTH: Java's array functionality seems to be a lot more robust than c++
CoolandonRS: Is there any way to just get a blank project to test in? I want to make a challenge but need to make my solution, and would rather do it in codingame itself if possible
ScifiSpirit: Yes, C and C++ stuff doesn't mesh together as nicely as it does in some other languages.
ScifiSpirit: However, most of the time i haven't really had much problems.
ScifiSpirit: It can be done, just requires some knowledge.
ScifiSpirit: You can for example wrap the arrays (or pointers rather) in smart pointer objects.
ScifiSpirit: When using dynamic memory though.
Synergyforge: I'm not cut out for this. :( Guess I'll just go flip burgers.
ScifiSpirit: It's not always easy.
ScifiSpirit: But you don't really even need the raw arrays in C++ anymore i think.
ScifiSpirit: Or often. Sometimes maybe.
ScifiSpirit: Although if the native types is exactly what you like about C++, well, it comes with its own problems :D
MACKEYTH: Wait, yikes, c++ will let you just keep writing past the end of a pointer array? That seems really dangerous.
Westicles: PainEXE, there are bunches of clashes like this where eval solves it
ScifiSpirit: MACKEYTH: yes, there is no memory protections in C++, it's like C.
ScifiSpirit: It's right down there on the metal.
MACKEYTH: Oh, I can already sense that's going to bite me in the butt. I manage to produce array index out of bounds errors in Java all the time.
ScifiSpirit: Heh. Yep, and what's worse, it doesn't tell you about those bugs. Silent crashes, or worse, no crashes.
ScifiSpirit: And then long time of bug hunting :)
ScifiSpirit: However, debugger helps a lot with that.
ScifiSpirit: However, some container objects do also have bounds checked indexing functions.
MACKEYTH: Does it at least set off limits the memory the array is declared to use?
ScifiSpirit: C++ is like this combination of really old and modern kind of programming, however, you get to choose which you use. Everything is possible there, you just have to constrain yourself according to your wishes.
Synergyforge: Some of us don't have that kind of willpower. :D
ScifiSpirit: MACKEYTH: What do you mean?
MACKEYTH: So if I create a pointer array like int myarr[10];, there will be 10 int-sized continguous blocks of memory that c++ won't allocate to any other variables?
ScifiSpirit: MACKEYTH: yes, that's right.
MACKEYTH: Until myarr falls out of scope, presumeably.
ScifiSpirit: Synergyforge: heh, perhaps, but there are many languages out there suitable for those persons as well i think :)
ScifiSpirit: Yes, until it falls out of scope, then the memory is usable again. Everything in C++ is allocated on stack, except objects like vector and such use dynamic memory from the heap.
ScifiSpirit: Well, that is not entirely true. A more accurate way to put it is that the vector object itself is allocated on the stack, but the storage that the object uses to store things inserted into it use dynamic memory.
MACKEYTH: Hm, does that mean you can create a vector that allocates space for pointer arrays? And instead of trying add arrays to the vecotr, you add pointers?
ScifiSpirit: C++ also has manual memory management is you want to use it, but i would recommend not to, and you can put the vector object on the heap if you want to.
ScifiSpirit: if you want to use that*
ScifiSpirit: Yes, that is also possible.
ScifiSpirit: And that's how it works for plain arrays.
ScifiSpirit: However, if you use plain arrays, you will almost inevitably enter the manual memory management area.
ScifiSpirit: Because if you want 100 arrays, you probably aren't going to declare each of those manually.
MACKEYTH: Cool to know, but now I'm so terrified of plain arrays that I never want to used them.
ScifiSpirit: Not to mention the memory usage.
ScifiSpirit: Yeah, like, i do encourage you to learn everything, but also i encourage to keep the C and C++ sides somewhat separated.
ScifiSpirit: I use a lot of primitives, there's nothing wrong with those, but i avoid plain arrays in C++ these days.
ScifiSpirit: If i wanted to use only C-like stuff, than i would likely use C instead of C++.
ScifiSpirit: The whole point of C++ is objects.
ScifiSpirit: But int, float etc. play nice with everything.
ScifiSpirit: You can't go wrong with any primitive, except pointers and arrays.
ScifiSpirit: Although, there is one additional trap in C++ stuff.
ScifiSpirit: Or maybe several actually :P
ScifiSpirit: You should be aware that the modern iterators actually do use pointers underneath, and offer pretty much direct interface to the pointer.
MACKEYTH: That seems wise. You'd almost have to check your array indices for inboundness every time you access the array to avoid accidentally garbaging up your program in devilish to identify ways.
Justin_Lowry: i cant remember how we get to the cert tests
ScifiSpirit: So what that means, is that the same kind of pointer errors are possible with iterators, going out of bounds, accessing memory that is no longer there, etc.
Justin_Lowry: nvm figured it out
MACKEYTH: Justin_Lowry from your home page, IIRC
ScifiSpirit: Another trap is using "new". You are probably quite accustomed to using that in Java?
MACKEYTH: Not 100% on what c++ iterators are yet
ScifiSpirit: The latest and probably best advice in modern C++: "don't use new" :)
MACKEYTH: ScifiSpirit very much so
ScifiSpirit: new is pretty much the last thing in C++ left, which can lead to memory leaks.
MACKEYTH: IDK new /was/ a keyword in c++
ScifiSpirit: If you don't use "new" or "malloc", you pretty much can't have a memory leak, i think.
MACKEYTH: How do array objects compare with vectors?
ScifiSpirit: And another advantage is that you now have a fully automatic memory management in a language that uses manual memory management. So not bad.
ScifiSpirit: Array objects try to mimic the plain arrays, whereas Vectors are dynamically resizable.
ScifiSpirit: So Array objects don't resize, just like plain arrays.
MACKEYTH: A little reading suggests that that the read/write performance of container arrays is about the same as pointer arrays
MACKEYTH: While being much more memory safe
ScifiSpirit: Right, but there's the object overhead.
ScifiSpirit: Memory safety probably depends on how it is used though :)
MACKEYTH: So they take up more space and take longer to create?
ScifiSpirit: But probably not by much.
ScifiSpirit: You can check the memory usage with the "sizeof" operator.
ScifiSpirit: array<int ,10> a; cout << sizeof(a) << '\n';
MACKEYTH: Hm, using the []operator to read/write to/from a container array out of bounds seems to fail silently
ScifiSpirit: Yes, use the bounds checked "at()" method instead for that.
ScifiSpirit: I think that is most handy for debugging versions, but i would not use it in production code probably.
ScifiSpirit: Or maybe i would, depends of course on the performance impact.
ScifiSpirit: I've barely ever used it, because i have learned how to code safely even in C, so memory errors don't bite me all that often.
MACKEYTH: No, wait, just tested. It does the same thing as a pointer array?
MACKEYTH: container arrays don't do bounds checking?
ScifiSpirit: Normally they don't, unless you use "at()".
ScifiSpirit: That's where the performance comes from in C++.
ScifiSpirit: C++ doesn't do anything extra.
ScifiSpirit: But the option for safety is there.
ScifiSpirit: It's just not a toggle option for the compiler or anything.
MACKEYTH: Sigh, so I'm back to using pointer arrays with manual bounds checking.
MACKEYTH: At least container arrays will tell you how big they're /supposed/ to be
ScifiSpirit: Usually you are probably going to use them in loops, and they require a condition anyway, so if you can make it trivial and obvious, that's enough for bounds checking usually.
ScifiSpirit: Or if you use "for(int i : myvector)", compiler does it for you, and it's safe.
MACKEYTH: Ok, so at() is safe with container arrays, []operator is dangerous
ScifiSpirit: Use operator in tight loops which you can guarantee are going to be safe anyway.
ScifiSpirit: Like the range-for (which is the "for(int i : myvector)" syntax.
MACKEYTH: And bonus, you can foreach over container arrays.
ScifiSpirit: Iterators also make it pretty easy to judge the safety of a for-loop.
ScifiSpirit: So no "int myarray[20]; for(int i=0; i<20; i++){}" and then requiring changing both pieces of code when you make the array declaration smaller :D
ScifiSpirit: Although C isn't quite that error prone either, in C you would likely use the "sizeof" operator to make it safer.
MACKEYTH: Are there any other common c++ pointer/memory pitfialls beginners should be aware of?
ScifiSpirit: Iterators is probably one, you can go out of bounds with it just as easily.
MACKEYTH: I'm assuming the []operator is dangerous for all containers?
ScifiSpirit: Another pitfall is that since C++ doesn't have garbage collection, doing multiple dynamic allocations with "new" in the same function call can lead to memory leaks despite using "safe" smart pointers.
MACKEYTH: But not strings, apparently. :) Looks like oob indices wrap around instead of walking onto adjacent memory.
ScifiSpirit: So that's why avoiding new basically also avoids memory leaks.
ScifiSpirit: That's surprising. I'll try, i thought i saw them going OB also.
MACKEYTH: Looks like negative indices will walk out of strings, though.
ScifiSpirit: Went out of bounds with positive indices for me at least.
ScifiSpirit: string s("mystring"); for(int i=0; i<20; i++){cout << s[i];}; cout << endl;
ScifiSpirit: string s("mystring"); for(int i=0; i<20; i++){cout << s.at(i);}; cout << endl;
MACKEYTH: for me, string s="test string"; for(int i=0;i<20;i++) cerr<<s[i]; cerr<<endl; produced
MACKEYTH: test string test string test string test string test string test string test string test string test string test string test string test string test string test string test string test string test string test string test string test string
ScifiSpirit: mystringterminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::at: __n (which is 8) >= this->size() (which is 8)
ScifiSpirit: Which is nice, i actually used to get silent exceptions before.
MACKEYTH: Which is way more than 20 chars. 😕
MACKEYTH: And seems to produce " " for s[s.length()]
ScifiSpirit: That's weird. For me it printed just one "test string" and then garbage.
ScifiSpirit: Are you use you didn't have another loop or something there?
ScifiSpirit: Seems like it printed the entire string rather than the letters.
MACKEYTH: Don't think so...
MACKEYTH: http://chat.codingame.com/pastebin/ed2174b7-caf2-46bf-939c-81dd3c7da9cc
ScifiSpirit: Well, that's not the same code.
MACKEYTH: D'oh. I see it.
MACKEYTH: Fixing
MACKEYTH: Yeah, you're right. Yields trash starting with s[s.length()]
MACKEYTH: <facepalm>
MACKEYTH: The CG IDE gives excessively long compiler error messages. To the point that they get clipped. Any remedy for that?
ScifiSpirit: If you ever find yourself needing to use dynamic memory directly, "make_shared" or "make_unique" helps a lot. That way, you don't need to use "new" directly, which guarantees there will not be any memory leaks.
ScifiSpirit: Yeah, i've noticed the same thing with CG IDE. Unfortunately it's not their fault, C++ has really long compiler error messages especially when templates are involved.
MACKEYTH: I wasn't planning to learn dynamic memory use, just on principle.
ScifiSpirit: Only remedy is to run them on your machine i guess, so you get the whole message.
ScifiSpirit: Or perhaps run with less code, if the long error message is caused by multiple lines (as it usually is).
MACKEYTH: C++ error messages are noticeably worse than Java ones.
MACKEYTH: Longer and less legible.
ScifiSpirit: Yeah, i believe that even without seeing Java error messages :D
Synergyforge: Moral of the story: Don't use C++. :)
MACKEYTH: But ah craves tha speeeed!
Westicles: that's why we need fortran, it is as fast as c++
MACKEYTH: Java chews up sooo much time doing garbage collection.
ScifiSpirit: I've been quite happy with C++ actually :)
ScifiSpirit: But yes, i have also shot myself in the foot in C++ (but who hasn't ;) )
ScifiSpirit: You'll learn eventually ;) :D
MACKEYTH: Especially when creating lots of objects for a MCTS
ScifiSpirit: But if we get easier and safer language with same speed, and same library support and same interoperability with C, i might switch.
ScifiSpirit: But all of that is already too much to ask.
ScifiSpirit: We will never get such language.
Westicles: rust?
Westicles: oh, no interop with c
ScifiSpirit: I've done Rust already, it's even more complicated, though safer. But not quite as simple interoperability with C as C++ has i think.
MACKEYTH: I bounced off Rust the last time I messed with it. Less in common with Java.
ScifiSpirit: I don't think any languages even attempt C interoperability anymore.
ScifiSpirit: It's all about bindings these days.
MACKEYTH: And I've made next to no progress with Haskell. Thinking functionally is hard.
ScifiSpirit: Yeah, same here, though not Haskell, but others.
ScifiSpirit: I'm stuck with C++ ;)
MACKEYTH: Does CG have any third party c++ libraries?
jacek: :no_mouth:
ScifiSpirit: https://www.codingame.com/playgrounds/40701/help-center/languages-versions
Westicles: no, but you can get to gmp if you are desperate
ScifiSpirit: Libraries: ‑lm, ‑lpthread, ‑ldl, ‑lcrypt
MACKEYTH: No idea what those are, but it's nice they're there. :)
ScifiSpirit: Linux standard libraries. Math, pthreads...
MACKEYTH: Also, thought CG didn't support multi-threading?
ScifiSpirit: I guess not exactly what you meant by third party libraries.
ScifiSpirit: I'm not sure if you can run on multiple cores.
Westicles: you can dig around the file system and see if what you need is there, and use it like this
Westicles: https://www.codingame.com/contribute/view/57289ec74b1437929376813753dcee321467
ScifiSpirit: You can use multithreading, but it's another matter if they run parallel.
MACKEYTH: Ah, so we have full access to the disadvantages of multithreading, but none of the advantages? CG hard mode unlocked ;)
ScifiSpirit: I don't know, you may get 2 cores or something.
ScifiSpirit: There is probably a way to tell somehow.
jacek: its 1-core, you can do multithreading but it will do no good
dannyward630: I just got 92% on python3 cert test
jacek: :tada:
MACKEYTH: 'Gratz!
dannyward630: I've been practicing for 3 yeaers
dannyward630: years, i mean
Westicles: since you were 9yo?
Synergyforge: How much did you google tho? :D
FrancoRoura: Congrats
MACKEYTH: I passed the last test in the Java cert with a very ugly brute force solution
jacek: :rage:
MACKEYTH: Ok, assume you allocate an object with a named var declaration, then add pointers to that object to containers or higher scope vars. Does c++ still delete the object when the original declaration goes out of scope?
antiwonto: [auto] Hey MACKEYTH, here is a :taco: for loggin in today while it is quiet. You now have 4 tacos
ImAmCoder: this is kind of hard for me i'm new
MACKEYTH: Do you have any prior programming experience?
MACKEYTH: ImAmCoder the best place to start is the quest map on your home page. You can also work on Easy puzzles under Activities->Practice
MACKEYTH: Anything in particular you're having trouble with?
a-Rye: Just finished streaming the creation of my first playground: https://www.codingame.com/playgrounds/64843/beginner-python-concepts/hello-world
antiwonto: [auto] Hey a-Rye, here is a :taco: for loggin in today while it is quiet. You now have 1 tacos
a-Rye: Working on adding the "run" functionality, but this is a decent place to start for anyone interested in learning basic Python
Wontonimo: you can made the code blocks runnable. as of right now they are just text
a-Rye: That's what I'm trying to figure out now. Is it that Json part at https://tech.io/playgrounds/408/tech-io-documentation/coding-exercise ?
XXGojo_satoruXX: -.-
Wontonimo: idk a-Rye , i've never tried. just seen it done
a-Rye: I'll keep at it and make sure to stream it when I figure it out. So far, that last video should help others create their own playgrounds. It's such a cool tool and feature!
ASM_MOV_INT: is there no way to get a count of items in a list in python?
Mortis_666: list.count
ASM_MOV_INT: that gives an error
ASM_MOV_INT: ??
ASM_MOV_INT: <built-in method count of list object at 0x7f1da6d05840>
Westicles: lmgtfy ASM_MOV_INT length of list in python
antiwonto: [auto] hey ASM_MOV_INT let me google that for you https://letmegooglethat.com/?q=length+of+list+in+python
ASM_MOV_INT: i've already googled rofl
ASM_MOV_INT: it should work, correct? that's why I'm asking, maybe i'm missing something
ASM_MOV_INT: s = input().split(' ')
ASM_MOV_INT: s.count
ASM_MOV_INT: gives an error
Mortis_666: o u mean get the size of the list?
ASM_MOV_INT: yes, for example if it parses into 4 items in the list, i want 4
Mortis_666: if u want to get the size use len(list)
ASM_MOV_INT: oh len()? rofl
ASM_MOV_INT: omg ty
Mortis_666: yes
ASM_MOV_INT: I'm still a newb to python, and it's been a few weeks since codingame(ing)
ASM_MOV_INT: rofl
ScifiSpirit: MACKEYTH: yes, C++ deletes objects that go out of scope that still have pointers pointing to them in scope. Basically, all built-in functionality in C++ follows behavior of C, and the automated functionality is built into the C++ portion of the standard library.
ScifiSpirit: that's called a dangling pointer, often caused by returning a pointer to object allocated in a function
ScifiSpirit: Lots of things have automated counterparts, for example for this case, there is shared_ptr and unique_ptr, former does reference counting
ScifiSpirit: I'm going to sleep now, have fun :wave:
UZUHAMA: Helo world
BobLob: 250 OK?
BobLob: Not SMTP? I sleep too.
3ataja: any solution for back pain
3ataja: other than walking
Wontonimo: have it surgically removed. it's not needed.
Wontonimo: like tonsils
MACKEYTH: Yoga, tylenol... Salonpas pads work pretty well.
Wontonimo: stretch to touch your toes. works wonders for me
Wontonimo: slowly ... no jerking
Wontonimo: also weed helps, or so i hear
Wontonimo: i mean, if you are into getting new addictions
3ataja: @Wontonimo I prefer your first solution, other solutions require getting off my laptop
3ataja: @MACKYTH thanks, will actually try the other two
Wontonimo: huntdown taco
antiwonto: [auto] Cant find anyone with enough tacos
Wontonimo: figures
a-Rye: I figured it out Wontonimo, streaming the process now!
Wontonimo: you may want to try the .__name__ for type like so print(type(a).__name__)
Westicles: go tell it on the stream
Wontonimo: i don't have a twitch account
Wontonimo: nice stream btw
a-Rye: Thanks! And I'm still watching this chat as well, all good!
Wontonimo: print(multipy(a,b))
Synergyforge: http://chat.codingame.com/pastebin/7324727d-5115-41ef-adb7-3c9fafe45ccf
antiwonto: [auto] Hey Synergyforge, here is a :taco: for loggin in today while it is quiet. You now have 1 tacos
Synergyforge: Dangit. It converted to pastebin, but I was asking a question about Python conditionals.
Synergyforge: oh and I typed it a bit wrong in the first line... Basically, can I check that two separate characters are present in a char string?
Synergyforge: if var1 in chars and var2 in chars.... can I rewrite this to only mention chars once?
KerbalNo15: Not that I know of