Chat:World/2022-04-13

From CG community
Revision as of 05:29, 14 April 2022 by Chat Log (talk | contribs) (Created page with "<img src=/a/77574940369500> a-Rye: taco? <img src=/a/70964948703282> antiwonto: [auto] Hey a-Rye, here is a :taco: for loggin in today while it is quiet. You now have 9 taco...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

a-Rye: taco?

antiwonto: [auto] Hey a-Rye, here is a :taco: for loggin in today while it is quiet. You now have 9 tacos

a-Rye: noice!

Default avatar.png a_single_boy: how use boost?

jacek: print BOOST instead of 100

Default avatar.png a_single_boy: thank

Default avatar.png a_single_boy: 为什么还是不行

jacek: oO

Default avatar.png a_single_boy: if next_checkpoint_angle >90 or next_checkpoint_angle <-90 : http://chat.codingame.com/pastebin/3f113e23-d4b9-4612-a986-2fd28ebb7cbc

Default avatar.png a_single_boy: why?

Uljahn: print(str(next_checkpoint_x) + " " + str(next_checkpoint_y) + " BOOST")

jacek: :upside_down:

antiwonto: [auto] ':upside_down:' was defined as ' ɥǝllo '

Default avatar.png a_single_boy: thank

Mr-Nemo: print("Hello Frien")

jacek: :no_mouth:

Tanvir: Is there a way to solve the problem after the clash?

jacek: not officially. if you remember it, you can try to search it via https://eulerschezahl.herokuapp.com/codingame/puzzles/

Tanvir: Thanks

jacek: e-greedy, so simple yet so effective

antiwonto: [auto] Hey jacek, here is a :taco: for loggin in today while it is quiet. You now have 49 tacos

jacek: :taco: derjack

antiwonto: [auto] jacek has awarded derjack 10 tacos. derjack now has 50 taco. jacek now has 50 taco

derjack: :taco: jacek

antiwonto: [auto] derjack has awarded jacek 10 tacos. jacek now has 50 taco. derjack now has 51 taco

Darleanow: i feel guilty gofling my code in coc where its code length

Darleanow: should i ?

Darleanow: http://chat.codingame.com/pastebin/be7aa3db-21be-4c88-bc9e-b381bd7f61c4

Darleanow: oh and btw, i was wondering how i could shorten this :

Mortis_666: Darleanow use a//b instead of floor

Mortis_666: *p

Darleanow: oh , does it round it to the min number ?

Darleanow: like floor does ?

Mortis_666: yes

Darleanow: that's nice, any other ideas ?

Darleanow: ty :)

Darleanow: someone did a shorter one: i,I,c=int,input,0 for j in range(i(I())):c+=i(I()) I(c//(j+1))

Darleanow: RsCrazy is a genius :oo

Mortis_666: Darleanow u can read this https://www.codingame.com/blog/code-golf-python/?utm_source=codingame&utm_medium=details-page&utm_campaign=cg-blog&utm_content=chuck-norris-golf

Darleanow: thanks !!:)

Darleanow: is there any way to do only coc length of code ?

Darleanow: because the fastest one is a bit annoying lul

Mortis_666: no :(

Darleanow: okay i've got an idea, why it is like this

Darleanow: everyone who're creating coc ggames are making them on fastest

Darleanow: but not on shortest or reverse

Mortis_666: its random

Mortis_666: but u can choose in private clash

Darleanow: oh thats nice !

Darleanow: but i want the contest lol

Uljahn: just skip all except shortest [solved]

jacek: :smirk:

Default avatar.png BengLeZhenJun: How to play the second level of pea pod

jacek: mad pod racing?

jacek: pass the tutorial (note checkpointX and checkpointY), submit code test to arena

Darleanow: hello, need help

Darleanow: idk why i can't convert the int to str

Darleanow: http://chat.codingame.com/pastebin/84a354dc-b675-4e72-bb5b-ed42f67acddc

Darleanow: i tried with number="{number}" too

jacek: number is str

jacek: you can do for i in number:

Darleanow: yeah but why am i unable to do a len(number) ?

Darleanow: http://chat.codingame.com/pastebin/acec3f35-23cb-498f-9fb8-d6284d679d6b

Darleanow: its now working with this

Uljahn: you mean a += i ?

Uljahn: what are you trying to achieve?

Darleanow: No worries Uljahn its fixed, i was trying to convert an int to a str

Darleanow: using the method number=str(number)

Uljahn: nice

Darleanow: but it didn't worked at first, so i had to use a="".join(i) in a for loop

Default avatar.png PainEXE: im grinding clash of code till i get top 1000

Default avatar.png PainEXE: im top 1900 rn

Passifi: yo anyone got any pointers on this piece of code ? I completly rewrote it to use map to cut down own runtime but it still times out for huge data sets.. and i don't know what else to do

Passifi: http://chat.codingame.com/pastebin/4bd93018-bb45-4636-9b93-c0bb4c9878ff

Passifi: its the rod cutting problem puzzle

jacek: buy faster computer *_*

Passifi: kk any mods here ? please make coding game use faster servers

Passifi: nvm I am stupid I don't have my code jump over piece sizes I have calculated before so that causes the problem

Passifi: this chat truly is a great rubber duck ;)

darkhorse64: You don't need maps/queues/... Simple arrays do the job

Passifi: but I have to check what combos I already went through, right ? and without the map the look up time would be so much bigger wouldn't it ?

Passifi: Well, regardless maybe if I think about how to implement the thing with just arrays I get to the bottom of this, thx for the input :)

Uljahn: for your information mods are not admins but regular users, they can't develop CG platform

antiwonto: [auto] Hey Uljahn, here is a :taco: for loggin in today while it is quiet. You now have 5 tacos

Thorcode: bruh

Thorcode: how can i do not got daily taco

Wontonimo: it's not a daily taco. it's for saying something on the channel after it has been quiet for an hour

Thorcode: ah

Thorcode: wonton pls take taco

antiwonto: [auto] That taco command has moved to the #taco channel

Thorcode: can i still have CG point in time travelers?

Thorcode: yep still have in an easier way

Darleanow: Hello Thorcode and Wontonimo :)

Thorcode: hi Darleanow

Darleanow: wazzup ?:)

Default avatar.png DefNotColin: is there a good place to wirte my java script code so i can upload it to my game

Darleanow: ??

Darleanow: you have an ide there already

Default avatar.png DefNotColin: where?

Darleanow: i mean if you're solving a challenge

Default avatar.png DefNotColin: no im makignmy own game

Darleanow: otherwise use VSC or Atom

Default avatar.png DefNotColin: ok ty

Darleanow: if youre comfortable with command line etc, go Atom, otherwise VSC is more user friendly

Darleanow: Atom has the best interface for me, depends on you tho

Default avatar.png DefNotColin: im decent with javascript i just need a place to imput code

Darleanow: Not talking about jsc, you should use VSC then

Default avatar.png DefNotColin: ok

Default avatar.png ofarukcan: i dont understand anything guys

Default avatar.png ofarukcan: what doest the program want

Thorcode: I have a question: can i see the previous of a profile before being deleted?

Thorcode: for specify this friend: https://www.codingame.com/profile/07c02518b623ada49c7778c5e36548039563664

Thorcode: oh nevermind

Thorcode: i found him

vinnie_rinella: how do i make the guy move in code v zombies

vinnie_rinella: nvm

vinnie_rinella: how do i find coordinates in it tho

5DN1L: what coordinates?

vinnie_rinella: hhold on i think i under stand it

5DN1L: ok, good

vinnie_rinella: how do i tell the program where the humans are

Darleanow: hello 5DN1L :)

Darleanow: vinnie, if i remember correctly theres a loop giving you pos of them

5DN1L: hello Darleanow

Darleanow: you can also opt for a strategy where you go for zombies instead of humans

Darleanow: it works great too !

Darleanow: how are you man ? :)

5DN1L: good, thanks

5DN1L: how are you?

Darleanow: i made some progress since the last time we've talked

Darleanow: i'm great too !

5DN1L: nice

Darleanow: it's been a while i haven't see u there

vinnie_rinella: i know that there is a loop giving me positions but the console.log statment wont accept it

5DN1L: Yeah, I had limited internet access for some time

Darleanow: i'm not familiar with js, so i can't help you about the syntax

Darleanow: and as it's a loop, the values changes everytime, try to put your console.log in the loop

5DN1L: what console.log code do you have vinnie_rinella ?

Darleanow: or store the values into a list where you can evaluate distances from you

Darleanow: oh that sucks, but glad you're back again ! :)

5DN1L: yeah, slowly getting back to full speed...

vinnie_rinella: console.log(inputs[1] inputs[2]);

Darleanow: interne providers are rat anyways

5DN1L: vinnie_rinella i think the syntax is wrong?

Darleanow: vinnie, is it in the loop where human locations are given ?

vinnie_rinella: no

vinnie_rinella: does it need to be

5DN1L: you can't just put a space in between like that

vinnie_rinella: what is the syntax that would fix it then

Darleanow: indeed, because if you do after the loop you gon have only the last value

Darleanow: a,d 5DN1L is right too

Darleanow: maybe a , ??

BJD: console.log(inputs[1]+' '+inputs[2]);

5DN1L: ^ that

vinnie_rinella: thanks!

Darleanow: he reminds of me lol

vinnie_rinella: haha

Darleanow: i'll be happy to help whenever you need !

5DN1L: :thumbsup:

vinnie_rinella: if i can i will also help you !

Darleanow: appreciate, but i do think i know a little bit more atm :)

Darleanow: thanks to everyone there

vinnie_rinella: yea

vinnie_rinella: haha

Darleanow: and i'm using python tho

vinnie_rinella: i know a little about it i used to code it but i thought i liked javascript more

Darleanow: 5DN1L , when u want to pop an item from a list i should use lst.pop(indexpos) right ?

Darleanow: because it's not removing it from the list, which i don't know why

5DN1L: what's the code

Darleanow: the statement is in the else:

Darleanow: http://chat.codingame.com/pastebin/b5c7f20b-78de-41ea-a096-8cadf43e2ecb

5DN1L: lst=lst.pop(1) <- nope

vinnie_rinella: how would i go about makeing it pick one human to go to

5DN1L: pop changes the list and returns what has been popped

vinnie_rinella: because on the second test case it just goes back and forth and both humans end up dead

5DN1L: so if you do: p = lst.pop(1), then lst will lose lst[1], and p will contain the value of lst[1]

Thorcode: to be easy just try to save one human first

Thorcode: the closet to you

Darleanow: oh okay, is there a built in func to remove an item from the lst ?

vinnie_rinella: i know but it switches back and forth

Thorcode: just go around that human to get 100 %

vinnie_rinella: how do i tell it which human to pic

vinnie_rinella: pick*

5DN1L: Darleanow, I mean it is removed that way. but if you just want to throw away the result, then you can also use del or remove

Darleanow: vinnie, you can also try to eval distance between you and zombies, and focus the closest one then go to the closest one etc

Darleanow: okay thanks !

vinnie_rinella: Darleanow im not sure i under stand what your sayign

vinnie_rinella: saying*

Darleanow: basically, i'm trying to check if i can divide by d if if i poop a number

5DN1L: pop it don't poop it :joy:

vinnie_rinella: not that

Darleanow: ahahhaha xd

Darleanow: oops

Darleanow: typing too fast

vinnie_rinella: yea haha

Darleanow: vinnie_rinella basically, instead of trying to protect humans, you can act like you rush zombies; eval distances and focus the closest to you, the do so for the next one etc until they're all dead

Darleanow: but you can also go and protect one human

5DN1L: meaning you need maths and calculation and then comparison, vinnie_rinella

vinnie_rinella: i kind of jurry rigged it and it worked so i guess i did it

5DN1L: not difficult to get 100%

5DN1L: but a bit more difficult to get higher marks

Darleanow: indeed, there's a lot of manners to do it !

vinnie_rinella: yea

Darleanow: i should go and optimize it too tho xD

vinnie_rinella: it trys to go to where the other zombie died how do i fix that

5DN1L: your code tells it to

5DN1L: so fix your code :shrug:

vinnie_rinella: what is the syntax for checking if a constant variable is 0

Darleanow: if var ==0

Darleanow: smth like this

vinnie_rinella: ok thanks

Darleanow: google is ur friend tho !

vinnie_rinella: yea thats what it is i remember now

vinnie_rinella: i just made it camp the human with the id of zero

Darleanow: gjob !

Husoski: "Constant variable" sounds a bit like "jumbo shrimp" or "military intelligence".

Darleanow: the second one was savage lmfao

Husoski: I almost forgot..."postal service".

Darleanow: XDDDDDDD

Darleanow: or either fraternity police

vinnie_rinella: how do i tell the code to go to the farther human

Darleanow: check distances

Darleanow: and compare them

vinnie_rinella: how?

Darleanow: you're given x;y

Darleanow: of each human

Darleanow: simply substract them to yours

vinnie_rinella: how do i get it for 2

Darleanow: put them in a list

vinnie_rinella: how

Darleanow: and print the index value which is the farther

Darleanow: with the function max

Darleanow: google is ur friend :)

Darleanow: in python, the print statement would be :

Darleanow: lst.sort()

Darleanow: print(list[-1])

Darleanow: or smth like that

Darleanow: the only way to learn is the boring way

Darleanow: google google and goole

Nik05: Beginning of programming can be really confusing :P

Nik05: Well later on, it can still be

5DN1L: Confusing in different aspects

Nik05: yeah :)

Darleanow: hey nik, i had a question

Darleanow: whats the difference between cpp and c#

Nik05: Uh why are you asking me?

Darleanow: bc i saw you code in both :)

Nik05: Lots of similarities and differences :P

Darleanow: CLEAR

Nik05: Haven't used C++ in a long time though

Darleanow: oh :0

Husoski: C# started out as a clone of Java, but with .NET instead of the Java SE platform.

Darleanow: need help :

Darleanow: http://chat.codingame.com/pastebin/ac7be063-4d31-48e9-8eb1-495297e7e884

Darleanow: i can't figure out why lst changes

Darleanow: and thanks for clarifications Husoki

MrMaster500: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeefffffffffffffffffffffffffffffffffffffffffffffffffffggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhhhhhhiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii

5DN1L: first kick after I'm back

Darleanow: xd

5DN1L: MrMaster500 please observe code of conduct

5DN1L: https://www.codingame.com/playgrounds/40701/help-center/code-of-conduct

5DN1L: no spam please

5DN1L: why waste the time, really

Nik05: Hm I wanted to say the biggest difference is having a runtime for C#/Java, which include a garbage collector

Nik05: While C++ uses RAII(or something) for cleaning up resources

Husoski: I'd guess it's the "lstb = lst;" statement.

Husoski: That does NOT make a copy of lst. Both lst and lstb will refer to the *same* array object after than statement.

Darleanow: Thanks Nik05 :))

Darleanow: and how could i copy lst to lstb

Darleanow: using a loop ?


Husoski: lstb = lst[:] ... or lstb = list(lst)

Darleanow: ty :)

Darleanow: its working !

Nik05: lst[:] makes a copy? Not a slice/reference into the lsit?

Darleanow: i used lstb = list(lst)

Darleanow: looked mor familiar :)

Husoski: Python lists don't make proxy objects for slices.

Darleanow: wdtm ?

Nik05: I guess it makes a copy of the slice instead of a fatpointer

Husoski: a[b:c] extracts the elements into a new list. Some other collection methods do make an object that give you a view of the original object that changes when the original does. dict.values() for example, doesn't return a list or tuple. It returns an object that indexes into the original dictionary.

Mortis_666: i have a math question: https://imgur.com/a/wYp9K9f can anyone help?

Darleanow: im 50% done with it : https://www.codingame.com/ide/puzzle/largest-number

Default avatar.png Wizard-Dude: quick question, how do you find your position in Mean Max?

5DN1L: Mortis_666 intersection of the line and the circle

5DN1L: you get both equations

Darleanow: theres probably an indication

Darleanow: at the start

Darleanow: giving pos of everyone

Darleanow: with a following id

Mortis_666: 🤔

Darleanow: idk tbh Wizard-Dude

Husoski: ttfn ... breakfast time on the us west coast

Default avatar.png Wizard-Dude: they do have a unit id, but I don't know what my id is?

5DN1L: statement says: (you are player 0)

Mortis_666: 5DN1L can you give further explanation?

Default avatar.png Wizard-Dude: oh whoops

MrMaster500: Hello

Default avatar.png nathan-415: Hi, I just started doing Code Royal, and I want to train multiple Barracks in Golang. I have tried using an array, but that doesn’t work. Could you tell me how I would train multiple barracks?

5DN1L: MrMaster500 hello and don't spam again, otherwise you'll be banned

Mortis_666: or u can draw it so i can understand it better

MrMaster500: ok

MrMaster500: 5DN1L

Default avatar.png Wizard-Dude: thanks for that, didn't see that at the top

5DN1L: Mortis_666 oh I thought you had the equation of the circle

5DN1L: I think you might have to have that info in order to calculate :thinking:

Mortis_666: i only have the coordinates of a and b and need to find the coordinate of c

5DN1L: because the circle can be bigger or smaller depending on where C is

Mortis_666: ah I have the radius of the circle too

5DN1L: and the centre coordinates too?

Mortis_666: yes, its (0, 0)

5DN1L: then you can find the equation of the circle

5DN1L: with radius and centre coordinates

5DN1L: as for the line, you have point A and B, so you can find equation of the line

5DN1L: express y in terms of x or x in terms of y, then substitute it in the equation of the circle

Default avatar.png nathan-415: Hi, I just started doing Code Royal, and I want to train multiple Barracks in Golang. I have tried using an array, but that doesn’t work. Could you tell me how I would train multiple barracks?

5DN1L: array isn't the issue i guess

5DN1L: it's more what you do with it

5DN1L: I think you should explain your strategy/code in more details in the forum post

5DN1L: then wait for somebody to reply you there

5DN1L: or here

5DN1L: with luck

5DN1L: or you can also read the thread

5DN1L: or the resources on the front page of the puzzle

5DN1L: there are some hints and tips

Default avatar.png nathan-415: I have done all the other stuff so, I am going to post my problem in the discussion

Default avatar.png nathan-415: Thanks!

5DN1L: ok, more specifics will help

5DN1L: no problem :)

Wontonimo: hey nathan-415, I can see you are pretty new. There is another bot battle called Mad Pod Racing that has a tutorial of how to get the most out of the multis https://www.codingame.com/multiplayer/bot-programming/mad-pod-racing

Default avatar.png nathan-415: Ok, I will try that thank you!

Darleanow: need help: out of range l.21 , WHY ???

Darleanow: http://chat.codingame.com/pastebin/088e39f1-4e13-4df9-b56e-8bda4cf0b844

Wontonimo: you may benefit from taking a break from your current multi and going through the tutorial in mad pod racing, even if you are not going to seriously compete there

5DN1L: Darleanow do some debug print?

Wontonimo: what's on line 21?

vinnie_rinella: how do i separate the coordinates of human one and human 2

Darleanow: basically, if n>len(lst) zoom goes to 0 so while stops

Darleanow: but it doesn't

5DN1L: Darleanow you gotta learn debugging skills :wink:

Darleanow: wonto : del lstb[n]

Wontonimo: okay, so n is out of range

Darleanow: sounds terrifying ToT

5DN1L: Darleanow nah, you'll need it

Default avatar.png notfreddynocappamcramen: coc

Default avatar.png notfreddynocappamcramen: coc

Default avatar.png notfreddynocappamcramen: coc

antiwonto: [auto] 'CoC' was defined as ' Clash of Code '

antiwonto: [auto] 'CoC' was defined as ' Clash of Code '

antiwonto: [auto] 'CoC' was defined as ' Clash of Code '

Darleanow: Wontonimo, BUT NO, N==4 AT ITS MAX

Darleanow: and len(lst) is 5

5DN1L: no spam please notfreddynocappamcramen

Wontonimo: did you write this code ?

vinnie_rinella: does anyone know how to separate human id 1 cordinates from human id 2 coordnates

Darleanow: yeah i did write all by myself wonto ! :)

5DN1L: vinnie_rinella split perhaps?

jacek: and you dont understand it?

vinnie_rinella: how

Darleanow: without cheating a single time

vinnie_rinella: what does that mean 5DN1L

5DN1L: vinnie_rinella ah ok

Darleanow: jacek , me ?

Wontonimo: maybe you meant to do this del lstb[0]

Default avatar.png notfreddynocappamcramen: coc

antiwonto: [auto] 'CoC' was defined as ' Clash of Code '

Darleanow: nope wonto, i'm deleting n

Darleanow: this is my goal

5DN1L: kicked coc spammer

Wontonimo: hey notfreddynocappamcramen you have been given a time out

Default avatar.png notfreddynocappamcramen: coc

antiwonto: [auto] 'CoC' was defined as ' Clash of Code '

vinnie_rinella: what i thought you kicked him

Default avatar.png notfreddynocappamcramen: coc

antiwonto: [auto] 'CoC' was defined as ' Clash of Code '

Default avatar.png notfreddynocappamcramen: coc

antiwonto: [auto] 'CoC' was defined as ' Clash of Code '

5DN1L: is he banned?

vinnie_rinella: put antiwonto to sleep

Wontonimo: done

5DN1L: vinnie_rinella sorry

vinnie_rinella: if he cant be vbanned

vinnie_rinella: its ok

Darleanow: I GOT IT WHY IT WAS OUT OF RANGE

5DN1L: i read your question wrong

Darleanow: lstb was going to 4

Wontonimo: cool

Darleanow: okay it's fine now :)

5DN1L: vinnie_rinella you read the coordinates of each human

Wontonimo: sorry everyone for the double spam from antiwonto ;(

5DN1L: then store them in an array

vinnie_rinella: yea when that happens i think you guys should but him to sleep for a while

Darleanow: okay it's not workign TOT

vinnie_rinella: 5DN1L do you have an example?

5DN1L: no, you can google

vinnie_rinella: ok

Darleanow: while zoom==1: http://chat.codingame.com/pastebin/cc9962bc-29ef-4301-96c2-a8aa3739975a

Darleanow: does someone finds any error ?

vinnie_rinella: what language is that Darleanow

Darleanow: py

vinnie_rinella: k

5DN1L: Darleanow do you intend to learn debugging? :thinking:

Darleanow: xDD

vinnie_rinella: what is the problem with the code

5DN1L: we can't debug for you all the time, Darleanow

Darleanow: my brain is out of range atm

vinnie_rinella: which puzzle are you doing

Darleanow: okay sir, not disturbing you again :p

Darleanow: https://www.codingame.com/ide/puzzle/largest-number

Darleanow: this one

vinnie_rinella: ok

5DN1L: it's not disturbing

Wontonimo: nope. sorry Darleanow, looking at that code doesn't make me want to debug it. It isn't clearr what the problem is or what you are doing. If you clean it up it may even make it easier for you to debug

Darleanow: ill clean it up

5DN1L: but it'll really help you in the long run to learn debugging skills

vinnie_rinella: what is it outputting

Wontonimo: what 5DN1L said, add debug lines and look at the debug output to see what's happening

Wontonimo: also, move some logic into a function and write a micro test for it

zakacat: take taco

Wontonimo: here is an example of writing micro tests in code to solve a problem Darleanow https://stackoverflow.com/questions/64974829/search-not-working-for-river-crossing-problem-in-python/64993148#64993148

zakacat: :taco: Wontonimo

zakacat: is tacobot dead?

zakacat: Rest in Tacos

Wontonimo: hint : don't try to solve the whole problem and instead think of some small function that will help you get you end result and write a test to prove that it works... then move on

Darleanow: this is what i'm doing

Wontonimo: taco bot is ded zakacat

Darleanow: first i did for 0 numbers to remove

zakacat: shame

Darleanow: then for one, then added a loop stop if i check the whole number

Uljahn: what? aren't you iterating through a string?

Uljahn: btw how many beginner tutorials have you done?

Darleanow: 6 !

jacek: oh my

Darleanow: this is why i'm trying to do them

Nik05: "hint: [...] and write a test to prove that it works... [...]" This!

Darleanow: my brain going out of range too

Darleanow: won't understand this ahah

Darleanow: i'll figure out by myself !!!

Darleanow: http://chat.codingame.com/pastebin/1fbdef04-b393-48e6-b7fd-c115653ac6cf

Wontonimo: have you ever tried following your code with pencil and paper Darleanow ? Pretend you are the computer and follow the code exactly as it is written, using your pencil and paper to track values of variables. It is a super useful skill to have and will give you needed insight into what the computer does

Darleanow: ok i will try this

Wontonimo: it really should be the first thing that programmers are shown to do. It's a critical skill to master

jacek: :upside_down: https://i1.kwejk.pl/k/obrazki/2022/04/0wamNXO3FSYzxjTm.jpg

Wontonimo: random, but funny

Darleanow: i'm doing it now !

Darleanow: xd

Wontonimo: actually, jacek, I love that pic! What a great demonstration of the power of the right (or wrong) mental model for solving a problem

jacek: :o

jacek: so, muzero?

Wontonimo: a good mental model for chess is lines of force, areas of control. They really help. Thinking of throwing horses doesn't help, it isn't a useful mental model. Funny, but unhelpful. Ima gonna keep this :grin:

Wontonimo: what about mu zero ?

Darleanow: http://chat.codingame.com/pastebin/f0415950-2bf8-46dd-b9cf-46d41519d375

Darleanow: here you go wonto

jacek: it may have right or wrong model of chess rules

Darleanow: its the explanation of this :

Darleanow: http://chat.codingame.com/pastebin/8ae774e8-c663-4a77-ba9e-2fbec0835699

Darleanow: OK I FINALLY HAVE AN IDEA

Wontonimo: combine the two Darleanow, where the explanation becomes comments in the code

Darleanow: nvm...

Wontonimo: and make it into a function ...

Wontonimo: and then write some microtests for that function ;)

Nik05: Anyone here that knows something about rust?

Wontonimo: not me

Darleanow: http://chat.codingame.com/pastebin/b109b2a7-611a-4530-9808-76896d4318bd

Darleanow: here you go !

Wontonimo: hmm, i meant more for your own sake. No need to keep posting here. Work on it on your own for a while

Nik05: languageusespacestomakethingseasiertoread

Darleanow: okay sir !:)

Darleanow: ahahhaha nik

Darleanow: http://chat.codingame.com/pastebin/9d59120b-02f3-4542-a174-5e81a0e6d596

Darleanow: better now ?:)

Wontonimo: when i said a while, what i meant is at least an hour or two, not 30 seconds.

Nik05: I would also use spaces between operators

Nik05: :P

Darleanow: yeah Wonto, i'm no asking for debugs dw wanted to make sure its easily readable, anyways

Darleanow: brb in a few hours every1

jacek: if you cant read it, then its not

vinnie_rinella: if (humanId == 0,humanId == 1) {

       console.log(inputs[1]+' '+inputs[2]);
       }  anyone lnow wht this does not work

Ajaiy: Which puzzle?

Uljahn: you have to use logical conjunction or disjunction between two logical statements to combine them

Wontonimo: what are you trying to accomplish with : if (humanId == 0,humanId == 1)

Wontonimo: do you mean && (and) or do you mean || (or)

Wontonimo: it doesn't make sense to be && because it will always be false

Wontonimo: so rewrite it like this if (humanId == 0 || humanId == 1) {

jacek: he didnt specify the language. the , could be ||

FrancoRoura: console.log looks like javascript to me

FrancoRoura: if (humanId == 0 || humanId == 1) {

       console.log(inputs[1]+' '+inputs[2]);
       }

Westicles: 59 woods to go. these realm puzzles look doable but too long to read

Ajaiy: wdym by 59 woods?

Westicles: promote to wood everywhere possible

Ajaiy: You mean in bot programming?

Westicles: yeah

Ajaiy: Whoa

vinnie_rinella: hey sorry about that i hade to go do somehting sorry for distracting you all

vinnie_rinella: it was javascipt btw

jacek: oh my

vinnie_rinella: what does the || do in the code

Wontonimo: || means "or"

vinnie_rinella: ok

vinnie_rinella: it still just goes back and forth its the zombie v code one it cant decide wich zombie to go after

Wontonimo: hey vinnie_rinella, considering that is pretty intro stuff I'd recommend you do some intro to javascript course or video before doing any more here. This site is probably a little too advanced if you are unfamiliar with the || operator

vinnie_rinella: ok

Wontonimo: what i mean is that || is intro. the zombie thing isn't

jacek: you dont need || if you make NN for that

vinnie_rinella: yea that was just me being stupd

Wontonimo: "you got a problem with your code? don't debug, use NN" - jacek

Wontonimo: :rofl:

Wontonimo: man, you make me feel bad for not using NN on this site jacek

jacek: you dont? oO

Wontonimo: keep up the reminders... I need the kick in the pants

Emmus: hey, anyone know, if I can use ,,&" in python, when you compare two booleans?

Wontonimo: ,,&" ? what does that do?

Emmus: like ,,and" but with one character

Wontonimo: do you mean the & operator? if so, then yes

Emmus: yes, thx

jacek: there is no &&. & is bit(?) operator

Wontonimo: sorry, the double comma at the beginning threw me off.

Wontonimo: and since booleans can be dynamically case to a bit, then i believe it works

jacek: welp you can do if False & True:

Wontonimo: you can also use the + or * operator like so a * b == 1 # is like a & b == True


Wontonimo: a + b >= 1 # is like a | b == True

Emmus: I google it, and & its bitwise operator :)

Wontonimo: yes, jacek said that earlier

jacek: but no one listens

Emmus: sorry, my bad

Wontonimo: I listen jacek, that's all that matters

Wontonimo: :taco: jacek :hug:

antiwonto: [auto] Wontonimo has awarded jacek 10 tacos. jacek now has 50 taco. Wontonimo now has 39 taco

jacek: shall i make next tutorial with genetic algorithm for search race? :thinking:

jacek: https://streamable.com/a52fbn

Wontonimo: oh, that's really good!

Wontonimo: yes please

Wontonimo: I don't think my GA for search race is that good so I'd love to see your tricks

Wontonimo: how would you describe your GA? Crossover strategy? Mutation strategy? Population size? Fitness function?

Wontonimo: that slide into ckpt 1 is fantastic

jacek: my basic fitness was something like 10000 * checkpoints done - distance to next checkpoint

jacek: but fitness with distance to next checkpoint - 3 * vel is much better

Wontonimo: :grin: clever!

jacek: the number at the top is number of generations https://www.codingame.com/share-replay/619298929

jacek: as you can see from streamable, for abut 50 first generations it explores more - bigger mutation rate. then later mutation rate is smaller to exploit and it pays off

Wontonimo: oh, not that many generations! That's good to know

Wontonimo: almost like an annealing process

Wontonimo: that's a nice twist and optimization

jacek: my population size is 100, each genome contains 16 moves. i didnt discreeted, it allows all moves -18,18 angle and 0,200 thrust

eulerscheZahl: topcoder marathon delayed by a few hours, should have started 10min ago

jacek: i have never done SA, i only did GA. i have some intuition regarding its hyperparameters

vinnie_rinella: how do i get the location of human 1 and human 2 separeatly

eulerscheZahl: what game are you playing?

vinnie_rinella: zombies v coders

eulerscheZahl: code vs zombies?

vinnie_rinella: yea that one

eulerscheZahl: you get them one by one. just store them in a list or an array

vinnie_rinella: i still dont see how that separates it

eulerscheZahl: humans = empty list for i = 0 to humanCount-1

   read human, add to list

eulerscheZahl: now you have all of them

vinnie_rinella: can you make in code form

eulerscheZahl: which language?

eulerscheZahl: checking your profile, i assume JavaScript?

Uljahn: eulerscheScript

eulerscheZahl: http://chat.codingame.com/pastebin/8ddbe3d1-ddad-4d93-8c3e-03e2a9148ba7

eulerscheZahl: also: thanks Uljahn, would have expected that kind of comment from MK

Uljahn: ye, miss him too

eulerscheZahl: i don't

eulerscheZahl: i'd rather take CyberPunk back

Uljahn: :sweat_smile:

vinnie_rinella: thanks

Default avatar.png Cybergoth: Aye, i´m kinda newbie so, based in your experience, what´s the most effective way to become problem solver? I´m having a real hard time with the matter. Thx in advance

vinnie_rinella: THE ALL POWERFUL GOOGLE

vinnie_rinella: that is the best way

eulerscheZahl: google that guides you to stackoverflow

Default avatar.png Cybergoth: Iwill take a look, i´ve been using books but

eulerscheZahl: whatever fits you best. i learned from a book + lectures at university. but that was some years ago, now there are also great youtube tutorials available

eulerscheZahl: the most important part: get your hands dirty and do some coding yourself while learning. don't just accept it after reading/watching

jacek: find a problem and solve it

DavidSOLOME: Hello

Default avatar.png Joosy199: Heyo

Darleanow: Hello again evry1

jacek: :scream:

Darleanow: :'(

Darleanow: gimme love jacek :)

jacek: :kiss_mm:

Darleanow: this is better.

Darleanow: imma finna debug this code !

Darleanow: if its not finished in 3 hours

Darleanow: i'll give everything i own to Wonto

Darleanow: and a bit for you because you gave me a kiss UwU

jacek: eat :taco:

Darleanow: bot seems down

Darleanow: drop :taco:

Default avatar.png Joosy199: Some of these clash of code games seemed rigged XD if you use python you can do the tasks in less code

Darleanow: ruby is the worst tbh

jacek: dont bring knife to a gun fight

Darleanow: xDDD

Default avatar.png 21stCenturyPeon: At this point, I'm just assuming they release a new Python update every time someone publishes a new CoC puzzle, with the solution as its own function

jacek: there was coc about making every word start with capital letter

jacek: lo and behold, python has "".title()

Darleanow: hey jacek

Darleanow: could u give me just a clue, about whats going wrong there

Darleanow: http://chat.codingame.com/pastebin/5dbcd4cc-a984-4ba6-971e-e8febf0d02a4

Darleanow: error code @ del secondlist[indexing]

Darleanow: out of range

Darleanow: pls --'

jacek: where out of range. in del?

Darleanow: yeah indeed

jacek: so indexing is >= size of secondlist

Darleanow: if indexing==len(secondlist):

Darleanow: but i'm checking if it is superior

Darleanow: just after i add 1 to indexing

Darleanow: so if it's equal, it breaks the while loop because of the looping becoming 0

jacek: but according to your prints, you should see the indexing and len of secondlist is the same :?

Darleanow: EXACTLY AT THE END

jacek: what if it goes into if int(onenumberless)%d==0 during last indexing

jacek: after this if and else print something and see

Default avatar.png Not_Sorrb: why did i get unbanned

Darleanow: OHHHHHHHHHHHHHHHHHH

Darleanow: ITS BC I APPEND IT TO SOLUTIONS COUNT

Default avatar.png Not_Sorrb: OHHH OFCOURSE

Default avatar.png Not_Sorrb: U UNSMART FELLA

Default avatar.png Not_Sorrb: joking

Darleanow: indeed now it's fixed

Darleanow: jacek, my hero

Darleanow: drop :muchlove:

Default avatar.png Not_Sorrb: jacek mid

Wontonimo: turn off caps lock

Darleanow: wonto, the mean boy is back

Darleanow: i mean sorb, not you obv :)

Wontonimo: Not_Sorrb, are you going to play nice?

Darleanow: 2 corrects out of 5 lets goooo

Nik05: I just got a notification that I received a message. Where can I find this message?

Nik05: But I can't find the message back in the notification log...

Nik05: (╯°□°)╯︵ ┻━┻

Darleanow: yeah its me

Darleanow: *its not*

Default avatar.png Not_Sorrb: wdym the mean boy

Darleanow: who knows :p

Default avatar.png Not_Sorrb: you do

Default avatar.png Not_Sorrb: obviosuly

Default avatar.png Not_Sorrb: since u said i

Default avatar.png Not_Sorrb: it*

a-Rye: Haha Nik05 YES! Flip the table!

a-Rye: :taco: Nik05

antiwonto: [auto] a-Rye has awarded Nik05 2 tacos. Nik05 now has 3 taco. a-Rye now has 10 taco

Darleanow: a-Rye *drops taco*

Darleanow: :0

a-Rye: Ah, but Darleanow I drop it with Style! My Style is now a whopping 1

Darleanow: If you need style, ask for Wontonimo

Darleanow: He's the star in the middle of the dancefloor

a-Rye: and to antiwonto, he's the almighty creator

Darleanow: This is exactly correct

Darleanow: everybody loved him, he needed ennemies

Darleanow: and antiwonto became

Nik05: Thank you a-Rye :P

Default avatar.png Not_Sorrb: yall sound so goofy aww

a-Rye: "¯\_(ツ)_/¯"


Default avatar.png Nicolas_Zimmerman: fori

Default avatar.png Not_Sorrb: frfrfr';'

Default avatar.png Nicolas_Zimmerman: 1

Uljahn: no spam here, read the rules https://www.codingame.com/playgrounds/40701/contribute---help/code-of-conduct

ycsvenom: taco Uljahn

ycsvenom: take taco

Darleanow: add : before and after taco :)

antiwonto: [auto] That taco command has moved to the #taco channel

ycsvenom: :taco: Uljahn

antiwonto: [auto] ycsvenom has awarded Uljahn 6 tacos. Uljahn now has 11 taco. ycsvenom now has 10 taco

Nik05: Anyone done Buster II, it feels like test case 9 is wrong...

Nik05: I mean Blunder episode I

Darleanow: I DID EHEHH


Darleanow: 2 ez

Nik05: The testcase called Broken wall. If i read the rules this will result in a loop and should not finished

Darleanow: jk i don't know what u're talking about

Nik05: The puzzle Blunder Episode 1

Darleanow: i didn't do it unfortunately :)

Uljahn: the name of the testcase gives you a hint, also there are beers on the map

Default avatar.png Not_Sorrb: deez nuts

Darleanow: IS IT depressed robot ?

Default avatar.png Not_Sorrb: wa

Uljahn: Not_Sorrb: you've been warned, next is a ban

Default avatar.png Not_Sorrb: i already got bnned

Default avatar.png Not_Sorrb: but for somereason im unbanned

Darleanow: so it was a kick not a ban :)

Darleanow: Uljahn IVE ALMOST FINISHED

Default avatar.png Not_Sorrb: not today smartie

Default avatar.png Not_Sorrb: it was like a week ago or sumthin

Nik05: Uljahn yes, i am drinking correctly, but when you are at 'S" for the second time your next direction is South. And because buster is now not drunk he cannot move and therefore needs to go to the next direction, which is East because he is not inverted

Default avatar.png Not_Sorrb: thats cuz ur not doing it write

Uljahn: Nik05: you can analyze the solution for the testcase by enabling expert mode in the settings on the left

Nik05: Yes, for some reason it goes East while being on a 'S', i think that is incorrect...

Uljahn: nope

Default avatar.png Not_Sorrb: ratio

Nik05: oh it isnt doing that

Uljahn: ot goes south 4 times breaking the wall and turning east on the second B

Uljahn: If Blunder is in Breaker mode and passes over a beer again, then he immediately goes out of Breaker mode.

Uljahn: *it

Darleanow: when will [CG] add a /ignore function ?

Uljahn: never

Darleanow: why ?

Nik05: Oops sorry

Darleanow: some ppl really do be annoying there

Uljahn: too hard to maintain this xmpp-based chat

Default avatar.png Not_Sorrb: ratio tbh

Uljahn: banned

Darleanow: thanks :)

Darleanow: i was reffering to him

Darleanow: elif solutionscount==0: http://chat.codingame.com/pastebin/b17a611b-2a76-4a22-9255-86c92dc4f21e

Darleanow: im almost there !

Nik05: I forgot to break the wall, but damn this making calculating loops pretty intensive

Nik05: *expensive

Nik05: To detect a loop you need to check if the state has been in before, breaking a wall is also a new state. So you also need to included the map into a hash set

Nik05: Or am I wrong with this?

Uljahn: dirty hack: if a path is longer than 200 steps it might be a loop

Nik05: Yes, but that is dirty :P

Nik05: Guess I will include list of broken obstecles in my state

Nik05: obstecles, wtf

Nik05: obstacles, thats it

Nik05: Pronounce it in another language than English and then you know how to correctly spell it :P

Nik05: Now only that damn teleporter...

Darleanow: ONE LINE AWAY FROM SUCCESS GUYS

Darleanow: 80% WTF

Nik05: What puzzle are you doing?

Darleanow: largest number

Darleanow: idk why but my program removes two

Darleanow: for ONLY one

Darleanow: test

antiwonto: [auto] 'test' was defined as ' this is a test '

Darleanow: so i will add another layer of script

Nik05: I haven't solved that one :P

Darleanow: ahaha

Darleanow: its way harder than it looks tbh

Darleanow: or to me

Nik05: "Easy"

Darleanow: NO ITS NOT

Darleanow: THE OTHERS ARE EASY

Darleanow: only 73%wr

Darleanow: and only 200 finished it

Darleanow: even murder in the village has more ppl completed it

Nik05: Ok, it's not that trivial but should be doable :P

Nik05: 2 <= d <= 10

Darleanow: hey sir

Darleanow: my mind is blowing

Darleanow: http://chat.codingame.com/pastebin/9d8f12b8-f2db-454d-9552-275734b94ca9

Darleanow: oh nvm you're nnot using py

Darleanow: and yeah it's kinda hard for me

Nik05: i can read some python

Darleanow: i mean i've coded it into noob python so u should be able to understand it then

Darleanow: i used clear var names

Darleanow: so it's easier

Nik05: i dont get that paste

Darleanow: ah crap

Nik05: Doesnt look like everything?

Darleanow: wdym ?

Nik05: I don't get your first line.

Darleanow: okay, you begin with a list

Nik05: thirdList = list(lst)? where is lst coming from?

Darleanow: lst is coming from number

Darleanow: ive put it in list

Darleanow: that was easier to me

Nik05: but where is your number = int(input()) ?

Darleanow: wait, heres the whole code

Darleanow: http://chat.codingame.com/pastebin/06196b10-641c-4df7-ae81-b4165acddc8f

Darleanow: ive sent you before only the one to check for remove 2 digits

Nik05: Ah yeah looks like beginner code :P

Darleanow: >:(

Darleanow: i will make it better

Darleanow: first, i'm doing all the easy ones

Darleanow: thennnnn i go for optimizing

Nik05: If you solve it, I wouldn't "optimize" but refactor to more understandable code

Darleanow: aight sir :)

Nik05: And use functions to give meaning to code. That helps a lot

Darleanow: yeah wonto told me that

Darleanow: but i want to keep it basic at most

Nik05: If you have understandable code, you can always try to optimize

Default avatar.png TheHereticalSponge_f08d: ah

Default avatar.png TheHereticalSponge_f08d: hey

Nik05: Darleanow but do you need any specific help?

Darleanow: http://chat.codingame.com/pastebin/d542d937-cc6a-4c40-8c2b-01da2aebc00a

Darleanow: this part isnt working

Darleanow: and my brain is lagging

Nik05: since you didn't put it in a function with a name, what should it do?

Default avatar.png TheHereticalSponge_f08d: lags brain

Default avatar.png TheHereticalSponge_f08d: ok

Darleanow: basically its appending a solution if we remove two number and THIS number%d==0

Nik05: Hm i just completed it

Darleanow: okay,basically i'd just like to cry

Darleanow: i'm so bad this is terryfying

Darleanow: terrifying

Nik05: No, you are just starting, right?

Darleanow: i've started like two months ago maybe

Darleanow: something like this

Darleanow: yeah, two months ago, checked on my git repo lol

Nik05: ok, good

Darleanow: no not good, i can't see my improvment

Darleanow: this is frustrating :/

Nik05: Well, the code is quite confusing for me, so I guess it will also confuse yourself :P

Nik05: Have you done the first test case?

Darleanow: basically

Darleanow: i have 80%

Darleanow: only the 2 remove isn't completed

Darleanow: the only problem is the loop for the two digits

Nik05: How do you create those pastes?

Darleanow: ctrl c your code

Darleanow: then ctrl v it here

Nik05: oh ok

Darleanow: but don't give me the answer

Darleanow: i'd just like help if possible :)

Nik05: I would first structure the code to show what you are doing

Nik05: So first check if the number itself is divisible, if it is print the number and you are done

Nik05: Those should be a few lines of code

Darleanow: i have it for no digits to change and one to change

Nik05: If it does not divide, you can create a list where each element is the number from with the nth digit is removed.

Darleanow: did too

Darleanow: http://chat.codingame.com/pastebin/f8bfe7a3-c418-460d-a310-f81719127192

Nik05: You can make a function for this, really break things up into smaller pieces

Darleanow: this is what i tried to do

Darleanow: first, loop

Darleanow: then create str

Darleanow: then add number in string and compare them

Darleanow: if divisible, add to res

Darleanow: then

Darleanow: compare res to find the highest value

Nik05: First case could be really easy:

Nik05: http://chat.codingame.com/pastebin/c7308b5c-17c1-4ad1-bb08-7549f382f82e

Darleanow: indeed, i have this

Nik05: Doesn't need any of the other variables you are creating

Darleanow: and this is not right,tho, it's hardcoded

Darleanow: because there might be two number divisble by d

Darleanow: and IF they are

Darleanow: youre gonna print 2

Nik05: You need to print the largest number, if the first number is the divisible it is the largest, because all other number with a digit removed are smaller

Darleanow: OH FUCK YEAH IM RETARDED SRY

antiwonto: [auto] Darleanow be respectful and watch your language https://www.codingame.com/playgrounds/40701/help-center/code-of-conduct

Darleanow: oops

Darleanow: sry wonto

Nik05: Just a bot

Darleanow: ik xd

Darleanow: but it's an habit that i have xd

ASM_MOV_INT: rofl

Nik05: I have to say that removing a character from a string is not that easy in python

Nik05: I would create a function for that Darleanow

Nik05: Darleanow do you know how functions work?

Darleanow: i do !!!

Darleanow: but, i wanna do without :)

Darleanow: ik i'm kinda weird

Darleanow: im about to finish it

Nik05: ok

Darleanow: nevermind, the loop seems fixed

Darleanow: but it's not xd

Darleanow: even tho its working with only my two digits loop check

Nik05: Haven't used python in like 20 years

Nik05: This puzzle is pretty nice

Darleanow: :)

Darleanow: forfeit

Nik05: finished it with 11 lines of code :P

Nik05: sorry, dont let that distract you

Darleanow: :'(

Nik05: I created it with functions first, it really lets you see the algorithm you are using

Darleanow: ive deleted my whole code

Darleanow: im starting again

Darleanow: and not going to sleep until it'q finished

Nik05: I also calculated the problem for the number, numbers with one removed and numbers with two removed seperatly

Nik05: After that all worked it tried to refactor the code, so i removed duplicate code

Nik05: Darleanow please make functions, and clearly state what they are doing

Darleanow: okay !!

Darleanow: http://chat.codingame.com/pastebin/54b12add-b338-4568-811b-bd76c69a6381

Darleanow: not working --'

Nik05: please use spaces...

Nik05: What does your function need to calculate?

Darleanow: checks for no num change

Darleanow: prints number if number%d==0

Nik05: What does "no num change" mean?

Darleanow: first test of the puzzle

Nik05: Oh, well don't create functions for specific test cases, only if you are writing tests

Nik05: Use functions that mean something

Nik05: I had a function "is_divisible_by(number, d)" and "remove_char(string, index)"

Nik05: Your function should do small pieces of your algorithm that you need to model the problem

Darleanow: okay i see

Nik05: Forexample:

Nik05: def is_divisible_by(number, d): http://chat.codingame.com/pastebin/d941674e-d4dd-4ed3-8dfa-7861962f126d

Nik05: So after this what is a step in the algorithm you need to do?

Nik05: Also dont be affraid to break up a function in multiple other functions

Darleanow: http://chat.codingame.com/pastebin/d3843406-eb08-4d4e-bebd-ab4470b255e1

Nik05: Can you explain in english what you need to do for the second test case?

Darleanow: atl u have this

Darleanow: first if will be function 1

Nik05: Sorry what do you mean?

Darleanow: i mean only one number check

Nik05: And what do you need to do for the second test?

Nik05: Can you describe the algorithm you want to use?

Darleanow: two numbers check

Darleanow: okay

Darleanow: wait let me use my brain

Nik05: Solving these puzzles isn't just programming, you need create an algorithm

Nik05: Just at a high level first, what do you need to do when the number itself isn't divisible by d?

Darleanow: remove number[n+1]

Nik05: In a little bit more words?

Darleanow: ill get the next digit of number and remove it

Nik05: But what do you need to check/calculate?

Darleanow: if number with sliced n is divisible by n

Default avatar.png SubZeRoy9: What are the easiest challenges for people that know basic java?

Nik05: Even at a higher level what is it that you want to calculate?

Darleanow: if is true that number can be divided by d

Darleanow: ?

Nik05: That is the first step, we have done to solve the first test case. But after that what we want to do is find the largest number created by removing a single digit that is divisible by d

Darleanow: so we'll append in a list for ex for each number we find that is divisible

Darleanow: and return the highest one

Nik05: And to do that we can do the following: 1. Create all numbers by removing a single digit from the first number. 2. Filter those numbers by the numbers that are divisible by d. 3. Find the maximum number of those divisible by d

Nik05: Yes

Darleanow: print(str(number)[:2])

Darleanow: I GOT SOMETHING


Darleanow: I COULD USE THIS

Nik05: So can you now write this algorithm down? You dont have to do everything. If some part of the algorithm is difficult or unknown at the moment, you can create a function and just call that

Nik05: Yes you can use slices to remove a character from a string. This is kind of difficult to do in python. THere isnt a string.remove(i) function

Nik05: Do you have python installed don your PC?

Darleanow: yes i do

Nik05: I would create a function who's only job is to remove a character at some index and return this string

Nik05: And try that out first

Nik05: Or you could do this in the CG ide, by using debug prints

Nik05: i guess you can also just do it in CG IDE

Darleanow: http://chat.codingame.com/pastebin/5e6fddb1-8740-41f7-9819-1de7affcd6bc

Nik05: Try to put all the login inside the function

Darleanow: login ?

ycsvenom: i love translating code between languages :relieved:

Darleanow: brb, ill go smoke, this is too frustrating

Nik05: oh im tired, all the logic

Darleanow: idk why, but i can't do it

Darleanow: like

Darleanow: wtf is wrong w me

ycsvenom: what do you want?

Nik05: you are just starting with programming, it is hard when you are just starting

ycsvenom: what's your problem Darleanow?

Darleanow: im frustrated because i've spent the whole day trying to solve an easy problem, wrote 2k chars ,passed all the test and didn't got the 100%

Default avatar.png PainEXE: sajhgEnd of line (\n)

Default avatar.png PainEXE: the hell

Default avatar.png PainEXE: Found: sajhgEnd of line (\n) Expected: Nothing

ycsvenom: what's the problem?

Darleanow: for largest number

Darleanow: http://chat.codingame.com/pastebin/2129684e-d09b-4d88-9240-27930d2c3af1

Nik05: Darleanow def remove_char(string, index): http://chat.codingame.com/pastebin/678ffcd9-ab81-46e9-8ed3-27bf81da3467

Nik05: def remove_char(string, index): http://chat.codingame.com/pastebin/87ee8cef-2ab2-444e-ac41-08cf959a166e

Nik05: not working...

ycsvenom: which puzzle

Darleanow: largest number

Darleanow: brb Nik05 imma smoke

Darleanow: i need toxic air

Default avatar.png PainEXE: im so confused on how i just got a puzzle right

Nik05: ok

Default avatar.png RawSauce50: what are you guys up to?

ycsvenom: i didn't solve yet i will solve it and then back to you if you up

Nik05: Darleanow try to do this next

Nik05: def remove_char(string, index): http://chat.codingame.com/pastebin/9f4ede67-d269-499f-b541-ed475e610e77

Darleanow: what is assert ?

Darleanow: aight ycsvenom

Nik05: Will create an error when the stuff behind it is false

Nik05: Its just to test your function for now, you can remove it later

ycsvenom: assert is a statement that check a condition if that condition is true nothing happens and the program continue to execute else it will throw an AssertExeption

Darleanow: Nik05, idk why, but i can't do it

Darleanow: i'm trying to use my brain

ycsvenom: it's recommended for debugging only

Darleanow: im really trying

Darleanow: but i can't

Nik05: Well that function is not that easy, i can just give you the code

Darleanow: aight lets go !

Nik05: def is_divisible_by(number, d): http://chat.codingame.com/pastebin/beb630bf-81c1-4417-b04c-61aebe3cce34

Nik05: Now try to write down the steps of the algorithm

Darleanow: okay i will try

Nik05: I wrote the steps down:

Nik05: def is_divisible_by(number, d): http://chat.codingame.com/pastebin/577f4a03-5385-4465-ba7d-f41739b0083c

Darleanow: def remove_char(string, index):

   return string[:index] + string[index + 1:]


Darleanow: is it for the two numbers to remove ?

Nik05: No, it does what the function say it does. It removed a character from string at index

Nik05: it removes*

Nik05: It works with slices, you should check that out later

Nik05: for now just use that function

Darleanow: elif remove_char(number,d):

   print(number)
   exit()

Nik05: What is your idea for the first step?

Darleanow: like so ?

Nik05: No remove_char gives you back a new string with a digit removed

Nik05: It does not do more than that

Darleanow: i used like so:

Darleanow: n=1

Darleanow: else:print(remove_char(number,n))

Nik05: and what does that print?

Darleanow: 7659

Darleanow: for n=1

Darleanow: and 7259 for n=2

Nik05: Ok, so now you have one number with a digit removed. What do you need to do to create all numbers with a digit removed?

Nik05: you can make a for loop

Darleanow: a list !!!!!!!

Nik05: do you that list indices start from 0. So the first element is lst[0], second element is lst[1]

Darleanow: for i in range(len(number)):

   lst.append(remove_char(number,n))
   n+=1


Darleanow: ['2659', '7659', '7259', '7269', '7265']

Nik05: good, but the for i in range(...) already takes care of incrementing the index. So remove n and just use i

Darleanow: for i in range(len(number)):

   lst.append(remove_char(number,i))
   i+=1

Nik05: Another important aspect in programming is naming variables.

Darleanow: removed the i+=1 tho

Nik05: You dont need to increment i with `i += 1`,

Nik05: ok

Nik05: So do not name the list "lst" but something meaningful

Darleanow: now it's onedigitrm

Nik05: Forexample: "numbers_on_digit_removed"

Nik05: for now just spell everyything out

Nik05: on => one

Darleanow: okay its now numbers_on_digit_removed

Nik05: good

Nik05: do use "one" not "on", that was a typo :P

Darleanow: yeah ive changed !:)

Nik05: Can you show me the code?

ycsvenom: Darleanow

ycsvenom: i have finished it

ycsvenom: what is your question?

Darleanow: why this wasn't working :

Darleanow: http://chat.codingame.com/pastebin/e9b716ac-9ec1-49aa-ad2b-c9fc84ebbc84

Darleanow: for i in range(len(number)):

   numbers_one_digit_removed.append(remove_char(number,i))

print(numbers_one_digit_removed)

Darleanow: the blank is for Nik05

Nik05: Can you paste the whole code?

Darleanow: def is_divisible_by(number, d): http://chat.codingame.com/pastebin/70191d53-c819-4896-ad57-d74e6be2c6ae

Darleanow: removed n=0 tho

Nik05: Ok, that is good. Remove stuff that is not needed.

Darleanow: def is_divisible_by(number, d): http://chat.codingame.com/pastebin/43182bff-af2c-4aa3-9366-bebf3b267e94

Darleanow: here we go

ycsvenom: the problem says that they might remove 0,1 or 2 digits

ycsvenom: in the code you just removed one digit

Nik05: Also declare variables as late as possible. In old C you needed to declare everything at the start of a function. You dont need to do that in pythong

Darleanow: okay sir !!

Darleanow: but why ?

Nik05: That makes reading the code easier to follow

Darleanow: okay !!

Nik05: Also use space and enters ;)

Nik05: def is_divisible_by(number, d): http://chat.codingame.com/pastebin/d150c55c-c86f-4fd7-89a3-3f11f40352e4

Nik05: See what i have changed

Nik05: So now you got the first step in the algorithm. What can you do with the others?

Darleanow: u added this : print(numbers_one_digit_removed)

ycsvenom: that code is overdone

ycsvenom: you don't have to declare a function for modding

Nik05: what do you mean ycsvenom?

ycsvenom: modding is operation so you don't have to make a new operation out of it

ycsvenom: you made a function named is_divisible_by which is not useful

Nik05: "modding" or calculating the remainder of a division is indeed an operation. It can be really useful to create a function that explicitly tells what it is doing

Nik05: Especially for something that is just starting out it can be easier to see is_divisible_by() then "int(number) % d == 0"

Nik05: There is nothing wrong with making short functions

ycsvenom: you don't have to create a function for everything in this way your code will lose performance for something that is already readable

Darleanow: for i in numbers_one_digit_removed:

   if is_divisible_by(i, d):
       print(i)
       exit()    

Darleanow: I DID IT

ycsvenom: congratulations

Darleanow: its not the end yet tho xD


ycsvenom: how many cases did you end?

Darleanow: 2 of the 5

ycsvenom: :cry:

Darleanow: Nik05 LEFT ME

Nik05: ycsvenom premature optimalization. No problem in creating a function

Darleanow: ah he's back

Nik05: Good Darleanow !

Nik05: now you need to find the largests of those numbers ;)

Darleanow: okay !

ycsvenom: http://chat.codingame.com/pastebin/5bef736f-4f0a-4a28-921e-195878f4b562

Nik05: So there are now two options, you either create a new list with only divisors and after that you go to step 3 and calculate the maximum of those. Or you keep track of the largest divisor and update it in the for loop

Nik05: Creating functions with meaningful names is a lot better than comments everywhere ;)

Nik05: And if you have really computing heavy code, well yes then you can look at optimalizatioons

Nik05: But not this problem :P

Darleanow: http://chat.codingame.com/pastebin/96326710-f89b-43c3-b794-6f43b08724e3

Darleanow: okay !!

Nik05: Good! There is still a bug, but you will find that in the next test case ;)

Darleanow: if len(divisible_is_max)>=1:

   print(max(divisible_is_max))

else:print('0')


Darleanow: i added this

Darleanow: to check if solutions or no

Nik05: i think max will throw an error when a list is empty

Darleanow: this is why i check the len of it

ycsvenom: Nik05 if this your standards then i have to ask did you make an add , subtract, multiply or division before :expressionless:

Nik05: you can use max(divisibles, default=0) to return 0 if the list is empty

Nik05: ycsvenom yes i did for vectors

Darleanow: wdym Nik05

ycsvenom: vectors is different than ordinary numbers

Nik05: ycsvenom i think everyone know what "+" means. Not everyone, especially beginners, know what "x % d == 0" means.

ycsvenom: vectors must have operations and it's better to make special operations for it to make code more readable like vecA+vecB not vecA.add(vecB)

Nik05: Darleanow your solution is good!

Darleanow: I DO

Darleanow: know what modulo is

Darleanow: :)

Nik05: well it's not modulo, it's the remainder of a division

Darleanow: a friend told me it was modulo

Darleanow: the remainder of a division

Nik05: And it was just an example. If it is clear what it is doing you can always inline the function. But you should not be afraid to create function, even for single lines of code

Darleanow: okay i will remind this

Nik05: But see that now your code is really clear what it is doing?

Darleanow: first function to see if is divisible by d

Darleanow: then remove char function

Darleanow: then if is divisible, we print result

ycsvenom: readability is good when professionals can easily read your code you don't have to care about beginners because they don't understand code well enough to read it

ycsvenom: :sweat_smile:

Darleanow: then we append to a list number with a removed char

Darleanow: then we check if we can divide the numbers with a removed char by d

Nik05: That doesn't make sense. Readability is great for beginners

Darleanow: if yes we put them in a new list

Darleanow: then if we have results, we print the highest value

Darleanow: else we print 0

Nik05: So now you can do something similar for remove 2 digits

Darleanow: return string[:index] + string[index + 1:]

Darleanow: i dont understand this line very well

ycsvenom: v%3==0 is globally readable you are the only human complaining about it's readability :slight_smile:

Darleanow: for me, we take two from str

Nik05: ycsvenom as i said, it was an example

Nik05: Darleanow you still have a list with all numbers with one digit removed. You can loop over these and then per number you can do the same what you did with removing one digit

Darleanow: for i in numbers_one_digit_removed:

   numbers_two_digit_removed.append(remove_char(number,i))

Darleanow: like so ?

Nik05: You want to loop over the number, and then loop over some index to remove digits from that number

Nik05: Like this?

Nik05: for number in numbers_one_digit_removed:

   for i in range(len(number)):
       numbers_two_removed.append(remove_char(number, i))

Nik05: And I guess you will be almost done then ;)

Nik05: If you have solved all test cases, you can then always try to find some duplicate code.

Nik05: But if you only duplicated code twice, and arent going to use it again. You can always just leave it the way it is

Nik05: But it can be a great exercise to improve code maintenance

Darleanow: it removes 2 numbers from 7265 now

Darleanow: i need to find a way to do otherwise

Nik05: But dont try to optimize everything, readabilty is much more import than then CPU potentially executing less cycles...

Nik05: important*

Nik05: Darleanow where are you stuck now?

Darleanow: it always creates a second list

Darleanow: OH NVM IK


ycsvenom: (╯°□°)╯︵ ┻━┻

**ycsvenom slaps around a bit with a large fishbot

Darleanow: THIS IS UNFAIR

Darleanow: i GOT 100%

Darleanow: BUT THE 3 NOT WORKING


Nik05: 3 not working?

Darleanow: def is_divisible_by(number, d): http://chat.codingame.com/pastebin/8d4a5030-29f1-4bdf-b2e5-cc22cf72c0c0

Darleanow: Trouvé : 04890600 Attendu : 4890600

Nik05: If you find the divisor in the list of number with one digit removed, you can exit the program

Nik05: Keep that code as close as possible

Darleanow: if i add exit to for i in numbers_one_digit_removed:

   if is_divisible_by(i, d):
       divisible_is_max.append(i)

Darleanow: its not working

Nik05: Can you show me what you are trying?

Darleanow: for i in numbers_one_digit_removed:

   if is_divisible_by(i, d):
       divisible_is_max.append(i)
       exit()

Nik05: yes, you need to print the largest divisor first ofcourse

Darleanow: but the 3 still isn't working :'(

Darleanow: def is_divisible_by(number, d): http://chat.codingame.com/pastebin/ca65e884-22d8-4444-9c62-bec5ed3f071a

Nik05: let me check

Nik05: I have reordered the code a little

Nik05: def is_divisible_by(number, d): http://chat.codingame.com/pastebin/a99ccf36-7e53-48c3-bc5f-ab819e849e31

Nik05: So 3 is not working

Nik05: Check the ouput to see what is wrong ;)

Nik05: Since python is dynamically typed, things can be int but also strings...

Nik05: It just because the number starts with a 0

Darleanow: int(i))

Nik05: yes

Darleanow: :)

Nik05: And if you see the code i reorder you can see that you have duplicate code

Nik05: So you could put that in a function

Default avatar.png CaptainWorm_2cf4: :grinning:

Darleanow: for i in numbers_one_digit_removed: http://chat.codingame.com/pastebin/cd596c10-8e7b-4ae2-b5ab-1a47133584c3

Darleanow: this

Nik05: even more

Darleanow: if len(divisible_is_max)>=1:

   print(max(divisible_is_max))

elif len(second_divisible_is_max)>=1:

   print(max(second_divisible_is_max))

Darleanow: and this ? for i in range(len(number)): http://chat.codingame.com/pastebin/f711cfaf-8c26-4e4c-8ebe-40bf165aae34

Darleanow: rated the puzzle 1 start tho.

Nik05: See how i changed it:

Nik05: def is_divisible_by(number, d): http://chat.codingame.com/pastebin/ed1054c7-9b78-4db1-af4a-cea96c8827b2

Nik05: And declare variables where you are going to use them ;) I saw you putting variables in the top of the function again :P

Darleanow: naughty me

Darleanow: idk why i do this

Nik05: And if you want to see what my solution was :P

Nik05: http://chat.codingame.com/pastebin/b7410050-d64b-40e5-83f0-e82215ec5dc1

Nik05: But your code is better

Darleanow: I PREFER YOURS

Darleanow: I LOVE GOLFING

Nik05: Like I said, it is better to use describing functions. Although mine uses variables that have meaningful names and therefore you can still follow what is happening

Nik05: And my solutions also calculates all numbers with 3 digits removed, which it doesnt need to do...

Darleanow: id like to be as good as u

Nik05: Continue doing puzzles and really try to clearly write down an algorithm and use clean code

Darleanow: okay sir ! i'll do my best

Darleanow: i'll try to do one per day

Darleanow: tomorrow will be asteroids

Nik05: And then you will find new python syntax, like i used. Search for list comprehensions if you want to know more

Nik05: I know those from Haskell, and thought python also supported those.

Darleanow: okay i will

Nik05: Even though i havent programmed in python for years, it is experience in other languages as well that you can use

Darleanow: thanks sir !

Darleanow: i know that theres a few similarities

Darleanow: between all of them

Nik05: But you just started out, so there is nothing wrong not knowing how to do thing ;)

Darleanow: ik, but i don't like to fail

Darleanow: i hate failing

Darleanow: and i hate MattDESTROYER for creating this one too.

Darleanow: aight Nik05, i don't have tacos to give you, but i enjoyed spending all this time with you

Nik05: And dont forget to check out other solutions, like Uljahn

Darleanow: thanks for your patience, sincerely

Darleanow: Yeah ! i've watched some, and its impressing

Nik05: He has a nice solution as well. And uses a function for divisible_by as well ycsvenom ;)

xxd: hello

Nik05: Darleanow :taco:

antiwonto: [auto] Nik05 has awarded Darleanow 3 tacos. Darleanow now has 6 taco. Nik05 now has 4 taco

Nik05: hello xxd

ycsvenom: why don't you check my solution if Nik05 and show me yours?

xxd: i need to keep myself busy for the next weeks man

Darleanow: Nik05 :taco:

antiwonto: [auto] Darleanow has awarded Nik05 5 tacos. Nik05 now has 9 taco. Darleanow now has 7 taco

Darleanow: hehe !

Nik05: Darleanow :taco:

antiwonto: [auto] sorry Nik05 but you can only award tacos once per day

Nik05: oh

Darleanow: :'(

Darleanow: tomorrow !!

Darleanow: i'll be online everyday

Darleanow: i really enjoy coding :)

Darleanow: imm check ycsvenom

Darleanow: which lang ?

Darleanow: i can't see it

Nik05: And sometimes you are just really stuck on a problem. Come back to it later :P

ycsvenom: python too

ycsvenom: http://chat.codingame.com/pastebin/d3c9c68e-3d07-4b57-a5b5-416320edfd5e

Nik05: You need to publish it for others to see

Darleanow: i like this : [::-1]

Darleanow: like ppl using this, it looks fun

ycsvenom: it's a shorthand for reverse

Darleanow: okay i see

Darleanow: i really need to sleep guys, but thanks so much for everything again !! :)

ycsvenom: Nik05 show me yours

ycsvenom: paste it here

Nik05: http://chat.codingame.com/pastebin/2fea1238-4521-4386-b479-617c4fabc7df

Darleanow: gn every1

Darleanow: <3

Nik05: have a goodnight Darleanow

Nik05: What do you think ycsvenom?

ycsvenom: i see that you code is more general than mine which can solve higher n without much work

ycsvenom: your*

Nik05: I first had functions for some stuff, and duplicated code. Then really easy to generalise

ycsvenom: nice solution

Nik05: functions really help seeing your algorithm in a higher level, without all the low level details

ycsvenom: without is_divisible_by :joy:

ycsvenom: i know big fan

ycsvenom: i used it a lot but only where i need them

Nik05: Although sometimes functions can hide details that could be refactor with other code. So you can always try to inline stuff, reorder, etc

ycsvenom: every person programmed in c++ love functions

Nik05: Every programmer should love functions...

Nik05: Without functions we cant do anything

ycsvenom: not exactly

ycsvenom: we can do everything but it will harder to picture the program abstractly

ycsvenom: will be*

Ayza: In most cases you don't need functions but you also gotta be ready to write the same 100 lines twice for one thing

ycsvenom: functions are just dynamic variables :slight_smile:

Nik05: So practically you cant do anything without functions

ycsvenom: it's variables**2

Nik05: well you could see a constant/variable as a morphism f: t -> C, where t is a terminal object

Nik05: But yeah, not going to help us going there :P

Nik05: although the terminal object can be seen as void or the unit tuple ()

Nik05: So a function f: () -> A, can be seen as a constant

Nik05: void in the C language is actually a really bad name

Nik05: Because void is not void. It inhibates a single element

Nik05: gn

Ayza: gn

ycsvenom: void is great name

ycsvenom: like "typeless"

ASM_MOV_INT: anion

dpdog: onion

ASM_MOV_INT: anion - neg ion

dpdog: onion - vegetable

GilbertGaming27: gilbert

dpdog: gilbert :)

Wontonimo: 2^x = 20

antiwonto: [auto] Hey Wontonimo, here is a :taco: for loggin in today while it is quiet. You now have 40 tacos

Wontonimo: 2^x = 20

antiwonto: [auto] x = 4.3219280948542504

Wontonimo: 1.1^x = 20

antiwonto: [auto] x = 31.43139882603113

Kaelidian: oo

Kaelidian: take taco

antiwonto: [auto] That taco command has moved to the #taco channel

Kaelidian: whaaa

tangent0: 22/7 = 3.14

Wontonimo: it solves for x. there is no x in your equation tangent0

Wontonimo: 4x*x + 8x = (1+x)/x

Wontonimo: well, maybe not

Wontonimo: 4x*x + 8x = 7/x

Wontonimo: 4x*x + 8x = (1+x)/x + 8

Wontonimo: ?? why is it broken ;(

ASM_MOV_INT: 3+x=2

antiwonto: [auto] x = -1

ASM_MOV_INT: x^3-5x=3.14159

ASM_MOV_INT: 6.28x=3.14

ASM_MOV_INT: 6x=3

ASM_MOV_INT: hmmmm

ASM_MOV_INT: cool though!

ASM_MOV_INT: :sparkling_heart: