You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Should same code submissions yield same results? #4747
Should same code submissions by same people yield same game results?
Currently, I'm observing a strange phenomena. This is my loss in ladder:
But I'm winning against the very same opponent!
Both games happened after my last submission, and his:
In last 200 games that were automatically played, my submission won 4 games out of 5 against this opponent. (Won't attach a super-lenghty screenshot, but it's true.)
I understand that, between all the problems that codecombat does or can experience, some tiny glitch may not be the biggest thing happening. But maybe this might hint to some underlying bug that would be useful to fix and that could affect more players? There's definitely something non-deterministic going on, and it subjectively feels that my submission is relatively predictable and should not lose at all (it does in fact win against any other opponent now, and wins this in most cases too).
With all my love for having deterministic results, I of course understand that this might be a minor bug regardless. So if there are reasons to believe it's not important, I won't be offended by team members closing the issue.
Further thinking about it, my opponent's submission could theoretically contain random-based actions. If codecombat doesn't go to lengths and tricky hacks to avoid this situation, it could correctly yield to different results in different match-ups. I subjectively do not understand how his submission could win against mine in any case, but it could be possible anyway.
So again, if you'll decide to close this specific issue, I won't feel offended. If it could instead be interesting, even better. Thanks.
We do go to some length and employ tricky hacks to avoid this situation, since all calls to Math.random and any functions using it should be replaced with a deterministic pseudorandom number generator based on a seed formed from combining the two players' session IDs.
Yet, in this case, each run is different, so clearly some randomness is getting in somewhere. Perhaps our Math.random swap has broken and needs to be fixed–indeed, rasdasd does use significant Math.random calls in their code.
Activity
vn971 commentedon Jun 7, 2018
Reference to my profile: https://codecombat.com/user/one-bitcoin (I was previously named "heavy".)
vn971 commentedon Jun 7, 2018
With all my love for having deterministic results, I of course understand that this might be a minor bug regardless. So if there are reasons to believe it's not important, I won't be offended by team members closing the issue.
Further thinking about it, my opponent's submission could theoretically contain random-based actions. If codecombat doesn't go to lengths and tricky hacks to avoid this situation, it could correctly yield to different results in different match-ups. I subjectively do not understand how his submission could win against mine in any case, but it could be possible anyway.
So again, if you'll decide to close this specific issue, I won't feel offended. If it could instead be interesting, even better. Thanks.
nwinter commentedon Jun 7, 2018
We do go to some length and employ tricky hacks to avoid this situation, since all calls to
Math.randomand any functions using it should be replaced with a deterministic pseudorandom number generator based on a seed formed from combining the two players' session IDs.Yet, in this case, each run is different, so clearly some randomness is getting in somewhere. Perhaps our
Math.randomswap has broken and needs to be fixed–indeed,rasdasddoes use significantMath.randomcalls in their code.vn971 commentedon Jun 7, 2018
@nwinter That's interesting. I see. Thanks for the quick response!
vn971 commentedon Jun 7, 2018
// Not sure it's relevant, but my submission uses
array.sortmethod, which could (?) use random to choose pivot.