Chat:World/2021-02-12
jcode94: lmaoo
Saad-py: How do I get the nearest value to 0 in python, i am very confused about abs
suuuumcaa: I'm looking for a mentor for work, my telegram @suuuumcaa
Divlo: Hello world!
TWrecks: If you fail a Clash of Code
TWrecks: Can you do it in your own time or whatever?
TWrecks: I find myself continuously frustrated that I can't get it done in the timelimit... Even simple problems.
KiwiTae: u can solve any problem on your own
FryMeALiver: screenshot it and solve it later perhaps
KiwiTae: u can also ask others to share their solutions so u can see what went wro,ng
TWrecks: Nobody is coding in FSharp
TWrecks: So I can't read their answers
Vigasaurus: Also after you're done you can try to look it up here to see the problem and test cases again https://eulerschezahl.herokuapp.com/codingame/puzzles/
Vigasaurus: And do it at your own pace
TWrecks: Ah thanks that's great
sayankhanmidnapore: https://www.codingame.com/clashofcode/clash/15899243e21f9ddd6ed15a3c8d62adc645050cd
lopidav: eulerscheZahl you have a base with all puzzles? Can I use it in my tampermonkey script?
Audatic: there should be an achievement if you complete a clash 100% in under 30 seconds :D
Totomns: yes and the achievement will be "do not read the instruction"
Audatic: easier to look at the sample in/out :D
FryMeALiver: any idea why when i make a contribution to clash only one example shows even though I have multiple?
lopidav: reading the statement to the end is an advanced coc strat. It took me two years to learn it and I still can't pull it of consistently.
lopidav: FryMeALiver give me a link
FryMeALiver: https://www.codingame.com/contribute/view/6238cf959ba938462e529d930fe417610a60
lopidav: of, I realized your question. Example is always one. There are multiple test cases tho, and the are there. Example is just a first test included in the statement so players waste less time going to the tests window
FryMeALiver: even if its a reverse challenge?
FryMeALiver: then multiple should appear no?
lopidav: multiple will appear
lopidav: FryMeALiver here how it'll look: https://i.imgur.com/GojwrBi.png
UncleZam: hello! I'm new here and was wondering if it is possible to use Vim bindings in editor?
ChristofferKJ: is clash down?
ChristofferKJ: for everyone
Nativeman: yee
ChristofferKJ: ty
phantom1299: is there a lag on the servers right now?
phantom1299: playing clash of code rn and when submitting my code it gets stuck on "Pending results..."
Nativeman: others can't even get into a game
phantom1299: oh, so its not just me
jacek: oO
Shurishe: I told everyone do not deploy anything on Friday. Never touch servers in friday:joy:
Magus: I pinged the staff about the CoC issue on discord. There is nothing more to do for the moment.
jacek: nothing more no CG. theres only clash on CG. no multiplayer bots, no optimization, no codegolfs... only clashes
jacek: AutomatonNN do something
AutomatonNN: eulerscheZahl is there a way to do that in the contest i want to learn c++ i guess
Andriamanitra: :worried:
Magus: Oh, so this is true
Magus: NN does ping euler :D
Magus: Automaton2000, do you ping euler too?
Automaton2000: its not that much of a difference
MadKnight: oh magus in #world
MadKnight: so rare
Nativeman: did they fix yet?
Magus: Yes it should be fixed
NOTsteve: any recommendations for an easy bot programming game to try after Coders Strike Back? I got to bronze league in that and wanted to try something different but alot of it still seems over my head
jacek: try silver in coders strike back
NOTsteve: I kind of wanted to try a different game before continuing with CSB
TH3Mjuss: Hello, I am having an issue with episode 1 of Power of Thor, could anyone help me pls ?
darkhorse64: Game of Drones is quite to start with
darkhorse64: quite easy
jacek: :notebook: :soccer:
Audatic: why is there no win statistic? :)
jacek: where
Audatic: for clash of code, would be more fun if you actually get a counter how often you won
jacek: oh
Rocky[K.G.F.]: hii
Andriamanitra: @Audatic i just look at the number of clashes played because i never lose :)
KiwiTae: TH3Mjuss read the hints
MSmits: Audatic the win statistic would not be very meaningful as the number of wins depends a lot on the strength of your opponents
MSmits: instead watch your leaderboard ranking
MSmits: for example, someone who takes care not to battle stronger players, will have more wins, but will not get a better leaderboard rank
Rocky[K.G.F.]: nice Andriamanitra
Audatic: We should play a round, I also never lose ;)
jacek: a force that cannot be stopped meets an object that cannot be moved
jacek: what happens then
jacek: :head_bandage:
Uljahn: NotImplementedError
Audatic: https://www.youtube.com/watch?v=9eKc5kgPVrA
Rocky[K.G.F.]: yeah it is true
Audatic: MSmits I feel the leaderboard is more about who plays most often not the win rate. I don't mind that it isn't perfect, it's just for fun. But given that there is no "history" of games played it feels less relevant if I win or not
Audatic: and there could be a "serious" mode where the opponents are always random, it's always 8 players and the language is restricted
Wontonimo: if it is a 'trueskill' score, then you are also measured on how consistently you win/lose against what the other players rank is
Wontonimo: just being consistent will raise your rank. So, if you play a lot without getting better, but you are consistantly playing at your level, then yes, you will see your score increase marginally
Wontonimo: https://en.wikipedia.org/wiki/TrueSkill
Wontonimo: one way to think. of it is that you have a penalty of 3 times your inconsistency.
Andriamanitra: it seems there's also quite heavy penalty for inactivity
Andriamanitra: i've seen top20 players drop down hundreds of spots in just few weeks of not playing
Wontonimo: yeah, there is that. incentive to stay active
Audatic: okay I see, didn't realized that it's using the Trueskill algo. I think it would still be fun to have a record of games you played/number of wins. Just for the fun of it. But I get your point :)
Wontonimo: personally, i'd recommend not getting to focused on your CoC score. CoC is a great place to practice your skills in a new language and watch yourself go from not being able to finish in time to ranking well. Those pesky python coders are gonna always give you a run for your money, so instead focus on how well you did vs you. I see some of the live streamers doing that, challenging themselves to compete with new languages. top notch there
Wontonimo: wow @Andriamanitra - 14th in CoC! that's crazy high. Congrats!
phantom1299: ruby programmers beat everyone in shortest mode
MadKnight: true
MadKnight: but what's your point ?
Nativeman: x,y
MadKnight: that's a vector
Mingus: hello
JohnathanBarbee: hello
Wontonimo: s/.*(hello|hi).*/\\1 to you/i
Alshock: that doesn't work Wontonimo
Alshock: "wow @... - 14th in CoC! that's crazy high. Congrats! to you
Alshock: "
Wontonimo: how does that not work?
Wontonimo: u nO liKy My eNglisH?
Okachobe: Is this chat specifically for the problem im doing or is it a general chat?
ichwarsnix: but if you have a question you can still ask
Okachobe: Sounds good I appreciate it. this seems like a good website to practice new languages without having to come up with my own coding projects and setup so far
jacek: :+1:
ElGoblino: guys what the hell is ASCII art
Gorgony: Im encoutering a problem with code vs zombies: https://www.codingame.com/replay/528339342. A zombie gets killed twice, and the second time it says my code didnt output a input in time, but the problem is not in my code. Anyone knows (what seems to be) this bug?
struct: weird bug
MadKnight: > but the problem is not in my code but are u sure ?
Gorgony: Yeah
Gorgony: I was just starting out
struct: this seems like a referee bug
MadKnight: it could be just a thing that happens when u don't print anything
struct: it even shows that he killed the zombie twice on the replay output
MadKnight: it just shows the same exact frame from the last turn
MadKnight: Gorgony it seems that it's just showing the same frame from last turn which could be a thing when u actually don't print anything
MadKnight: check your code again Gorgony
Gorgony: I will check again
Gorgony: I didnt know that the last frame was shown when you dont give an input
MadKnight: it's just the way they made replay viewer
MadKnight: it had to show something
Gorgony: But it seems my code was waiting on a readline while it shouldnt
MadKnight: maybe
Gorgony: Thats why console.error also was not in the console
Gorgony: Because it was after the readline
Gorgony: Thank you guys
struct: https://www.codingame.com/replay/528344098
struct: https://www.codingame.com/replay/528344368
struct: There is no bug I guess
Gorgony: I already thought it was strange that there would be a bug like this in a game that is several years old
Gorgony: I should have known it was my code
Okachobe: Is there any way to post the code to the problem were doing? instead of just the replay. I keep running into a problem which says that my program didnt write to the standard output in time. My code looks almost exactly the same as the solution code and I had this problem earlier too.
struct: just paste it here
MadKnight: (he fixed it)
jrke: is CG pastebin workin'
MadKnight: it's RNG-based
MadKnight: test it
MadKnight: http://chat.codingame.com/pastebin/f41f3bc2-5867-4d96-993c-c61ebe925570
MadKnight: yep
jrke: testing number - 1
jrke: http://chat.codingame.com/pastebin/c52e0755-eb68-4576-b0f8-82ad743c10b0
MadKnight: nice code
jrke: test succeded congrats you reached level 2
jrke: lol
MadKnight:
int img[x * y][3];
MadKnight: u can't do that in visual studio c++
MadKnight: x y are not const
jrke: thats code for gaussian blur image
jrke: oh edited that in code blocks a bit
[Kian-carling]: hi
JLukeSkywalker: darn, need top 2% bots to get the achievement thing. just got stuck at 3%
JLukeSkywalker: almost there
jacek: top 2% where
JLukeSkywalker: multiplayer bots
jacek: aww
JLukeSkywalker: for the homepage quest
Alshock: -3vel
jacek: that should be top 5%
JLukeSkywalker: i think if I get to gold in a second game i will hit it
JLukeSkywalker: and the previous quest is hit gold in a single league
JLukeSkywalker: so 2% might not be unreasonable
Wontonimo: thanks, I was wondering what I'd have to reach next on the quest line after gold. 2% it is
Wontonimo: we both need in the range of 2,500 more points (less for you, more for me) to hit 2%
JLukeSkywalker: climbing code royale rn, should just under 1k the next calculation
jacek: good evening
MSmits: hi jacek
YurkovAS: MSmits in mcts after expand node to children you play random playout games for each unsolved children or only for one child? This give many rollouts, but play worst for me.
MSmits: i tried both, same result as you
MSmits: darkhorse had a slightly better result with rolling out from each child
MSmits: but I never did
jacek: you have many rollouts, but shallower tree
darkhorse64: Yeah, I always do that. It also simplifies the implementation
MSmits: for some other games it was better for me
MSmits: especially games with less branching
darkhorse64: When expanding, I allocate a contiguous memory space for children which is completely used. So, it saves space
MSmits: it's just one of those things that you try for uttt and works differently depending on the rest of your bot
darkhorse64: Of course, it means you have to tweak the exploration parameter
darkhorse64: I did that first for uttt. It was a net gain for me
MSmits: i dont think it's just that, there's tons of little things about a bot that may change the effectiveness
MSmits: for example, if your rollout is heavier, it might be better to only do 1 each time
darkhorse64: ept is the other side of the spectrum. Light rollouts but many of them
MSmits: yeah
darkhorse64: I am amazed you are still finding new ideas for UTTT. How many versions (not variations) did you wrote ?
MSmits: full versions 3
MSmits: i mean 3 completely different bots
jacek: uttt is neverending story
MSmits: one is EPT, one is a bot with binary representation and heavy pruning, few lookups. One is a ternary representation with less pruning and light rollouts
Angecide: when going for the one rollout per iteration, do you pick a random unvisited child, or just the first child in the list of children that is unvisited? it feels like picking a random child would give better distribution but also more expensive search
MSmits: (with heavy lookups)
MSmits: the EPT bot sucked
MSmits: Angecide never saw much difference, so i just pick the first
MSmits: but yeah theoretically random should be better
MSmits: uttt doesn't always obey the law of making sense
jacek: oO
darkhorse64: I have two different engines (binary and ternary) but it did not make any difference.
MSmits: which is pretty weird
MSmits: because working with ternary is very different, it should be much slower or faster...
MSmits: but this is my experience a swell
darkhorse64: Any difference in ranking
MSmits: no idea
darkhorse64: I mean ternary and binary engines did not result in any different in ranking for me. I came to the conclusion that it was a kind of dead end for me and I should try other multis
MSmits: ahh
MSmits: well I still have many ideas to try for uttt, maybe I'll write them up when I am finally done with it
MSmits: the game has a lot more depth than I first thought
MSmits: wish i was able to write a good eval for this though, would like to have a competing EPT bot.
darkhorse64: One thing I have not tried (learned from other bots) is implementing the game state with m128.
MSmits: I did that, but it's only helpful if you save same time with AVX somewhere
MSmits: some time
MSmits: got some small improvements from it, nothing shocking
darkhorse64: I see I could implement a very fast move generator with that representation. I did something similar with C4. The only issue is randomizing a move choice without pdep/pext
MSmits: thats true
MSmits: I have a move generator like that
darkhorse64: It takes way too much time to find/select a move with my current engine.
MSmits: it's nice for initially getting all the moves
MSmits: but you still need to check whether the board is actually finished
darkhorse64: extract 9 bits / lookup
MSmits: i dont really use extract. I just union the thing with a normal array
MSmits: easier
darkhorse64: extracting is needed if the whole game state is a bitboard. My current engine is 10 separate boards. Easy for lookups but bad for move generation. Anyway speed is not that important. I did an experiment: disable optimisation which divides the rollout count by 3 for me. The bot still ranks between 30 and 40. Conclusion; you really need massive speed improvements to gain something. Being smarter pays more
MSmits: thats true. I did a test once with half calculation time and the winrate was 40% vs my full calc bot
karliso: "implementing the game state with m128" Why would you do that? I don't see a single reason how SIMD would help.
MSmits: http://chat.codingame.com/pastebin/64573132-7abb-4ed6-852a-e0da327cbc3c
MSmits: right before sim, i can pull out an array of moves this way. Then when the sim starts, i adjust them every time i do a move
MSmits: saves a little time
MSmits: might be negligible
MSmits: but you're right karliso, during sim it's quite hard to use simd for anything
karliso: This is only useful when you are given free move and can choose from all boards?
MSmits: sure yeah, it can be used for that
MSmits: i dont do that though
MSmits: I mostly use popcounts and pdep and such
darkhorse64: m128: the idea is to have the game state in one place and perform everything with masks, popcount and friends
MSmits: i would say m256 though
Nandita: Has anyone solved the defibrillators challenge?
darkhorse64: The usual joke is to give you the number of people who did: several thousands
struct: Since I saw puyo puyo engine on AVX, I believe anything can be made
MSmits: sure, i think it can be, but it's not always useful
MSmits: how would you parallelize jumping from board to board
MSmits: karliso is right that you can only really make good use of it on a free move
struct: darkhorse64
struct: check _mm_mask_expand_epi32
struct: _mm_mask_compress_epi32
MSmits: that first one requires avx 512
darkhorse64: You are probably right. Optimizing something that happens less than 10% will not be rewarding. RTFM now :grinning:
struct: ah
struct: Yeah sorry
struct: did not notice it was avx512
struct: my bad
struct: they are both for avx 512 :(
MSmits: some day...
darkhorse64: Good to know anyway
ZarthaxX: i used the compress one, love it
Angecide: MSmits I read yesterday that ur uttt bot had around 2k lines of code which got me speculating on how that happens, is it because there are multiple rollout and mcts algos depending on which side you play on and which stage in the game you are on (early/mid game) ?
MSmits: for that bot, yeah, that's part of it, though I did not go as far with that as some, probably
MSmits: it's mostly that i made them really heavy, both expansion and rollout
MSmits: but this is not my live bot. My live bot is quite tiny
MSmits: less than 1k if i take out the opening book stuff (it is not being used anyway)
Angecide: I see, I should probably look into trying some of that as well, the discussion about pure performance on normal mcts having negligible effect compared to sacrificing performance for doing smart rollouts and move selection made me think a lot, but it is quite a challenge to find the right combination of things to get some improvements
Angecide: improvements as in getting the bot to perform/play better
MSmits: yeah it is. Mind you, performance is still important, especially when it's your only edge. But when you start getting creative you can get bigger improvements
Wontonimo: if alphaGo taught us anything, it's that mcts+heuristics=win
MSmits: heuristics?
jacek: nn
jacek: guided mcts
MSmits: when someone says heuristics i kinda think of if/else
MSmits: not a nn
Wontonimo: doesnt' have to be nn, could be hard coded smarts
MSmits: i did that in plenty of bots
Wontonimo: like if/else , board weights
darkhorse64: i'd say smart eval, whatever it is
MSmits: also pruning moves
Wontonimo: yeah ,smart eval is a heuristic
jacek: pruneArray?
MSmits: let me give a typical prune for uttt
MSmits: say you have 2 ways to win
MSmits: one gives the opponent a free move
MSmits: one doesnt
MSmits: in that case, dont include the free move win in your list of children, just ignore it
MSmits: never explore it
Angecide: when you say "win" do you mean winning a small board right?
MSmits: yes sorry
MSmits: another thing is when there are 2 ways to win
MSmits: and bot give a free move
MSmits: both
MSmits: then only include 1 of them in your list of children
MSmits: prune the other
MSmits: there are more of those things
Angecide: ye pruning sounds cool, until the enemy plays a move that you pruned, then it becomes a bit of a pain to add that node back into the tree
MSmits: and since expansion is usually not much of a bottleneck, why not make use of them
MSmits: just reset your whole tree
Wontonimo: it feels true. long ago I wrote two checkers bots, one that eval'd on piece count, and the other eval'd on freemove count. Playing the freemove count bot felt like it was choking you all the time ... where as the piece count bot seemed dumb
MSmits: tree reuse is overrated
MSmits: if you prune 1 move, you will have more depth in the others
MSmits: so it's a gamble
Angecide: I see, I guess working under the assumption that the enemy will play smart as well seems like a good gamble in high legend
MSmits: most likely any prune you do is never going to affect the game this way because most expansions happen in parts of the tree that are never going to be encountered in the game
MSmits: there are only 81 moves played
MSmits: and millions of nodes expanded
MSmits: so, why worry :)
Damderiam: I'm sure this is a really obvious question, but why is "for i in v:" iterating backwards and skipping index 0 in python where v is a list of integers?
MSmits: because i are not indices
MSmits: they are the actual values in the list
MSmits: v is not sorted i guess
jacek: v = [4,3,2,1,0]?
Damderiam: Not sorted, no
MSmits: it's just iterating over the list in the order in which it is stored
MSmits: starting with the first element
Damderiam: I'm doing the stock exchange losses, and I'm doing it fine in C++ but I clearly don't understand python syntax
jacek: in C++ it would be for (int i : v) {}
jacek: what is i?
Damderiam: I'm trying to iterate from index 0 to index n, which I thought was what "for i in v" did
Damderiam: i is just an iterator
MSmits: Damderiam can you do print(v) and tell us what it gives you
jacek: for i in range(0,n):
MSmits: a range is basically a list of integers
Damderiam: v is 5 3 4 2 3 1 in this particular puzzle
MSmits: and thats why it doesnt give you 0 and goes backward
MSmits: it starts with 5, then 3, then 4 etc.
MSmits: when you say "for i in v"
MSmits: you're basically saying "for each item i in v"
MSmits: so i can also be an object
MSmits: in your case it's an integer
MSmits: but it could be a list of cars
MSmits: it would just iterate over the list of cars
MSmits: you're confusing the items in the list with the indices of the items in the list
MSmits: v[0] = 5;
Damderiam: So I am doing it right, I was just not understanding the stderr
MSmits: possibly
jacek: "it works. i dont know why"
Damderiam: Well, I know why the C++ version works, I don't know why the python version doesn't
Damderiam: But I guess that's part of learning a new language
MSmits: yeah, i learned python here on CG, by doing all easy puzzles i hadnt solved yet
MSmits: i did 30 of them in a few days
MSmits: (while on vacation and my wife was asleep :P )
Damderiam: It's such an unusual syntax, but I'm sure I'll figure it out
MSmits: it's not that unusual. Depends on what you're used to
MSmits: the tab thing with no brackets takes more getting used to
MSmits: once you get good with python you can do wonderful things with just a few lines of code
reactToThisVue: for i,e in enumerate(['a','b','c','d','e','f']): http://chat.codingame.com/pastebin/af434e5f-29a4-4f97-97b7-46804a118d54
jacek: :thinking:
reactToThisVue: sry I didn't mean to send 2 outputs
reactToThisVue: for i,e in enumerate(['a','b','c','d','e','f']): http://chat.codingame.com/pastebin/f192ed3c-811c-4f1b-aa35-782d4322d7b2
reactToThisVue: so basically it's like MSmits said. Don't get confused with the diference between index (indices) and element (elements) while in the example above i stands for the index and e for the element. You can use them both with enumerate(iterable) in pyhon
reactToThisVue: http://chat.codingame.com/pastebin/251451da-898d-4646-8d1b-a874f8775737
Damderiam: Yeah, I got it working by using enumerate to keep track of the index being worked on for each loop
reactToThisVue: otherwise you can reverse the list with list.reverse() or list=list[::-1]
reactToThisVue: than i and e would match
reactToThisVue: also reasonably is the following syntax: http://chat.codingame.com/pastebin/2dfd88d7-a0a4-4660-8827-11352254ba70
Damderiam: I really had to get C++ syntax out of my head was the problem
Damderiam: I've only barely used python, and not for years, so I was doing everything totally wrong
reactToThisVue: yeah that's true I've written a lot stuff in c++ and if I would write c++ now I had to google every 2 seconds
Majeck: .
Majeck: thought the chat was lagging
Andriamanitra: i always forget not to play clash at this time of day
Andriamanitra: i don't understand why they can't have this silly lagfest during the time when no one is playing (about 5 hours from now)
therealbeef: by then Asia is playing
Andriamanitra: from my experience at least clash is pretty dead at that time of day, cant even get games with more than 2-3 human players
Kevinboards: it is friday though
RockNTroll: Just need a banner across the side that makes it an exciting event rather than what it actually is which is a lagfest