Skip to content

Should same code submissions yield same results? #4747

Open

Description

@vn971

Should same code submissions by same people yield same game results?

Currently, I'm observing a strange phenomena. This is my loss in ladder:
this_is_my_loss2

But I'm winning against the very same opponent!
submission2

Both games happened after my last submission, and his:
submitted_long_ago2

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.)

Here's a link I constructed to watch the game between these two submissions: https://codecombat.com/play/spectate/zero-sum?session-one=5849db3f457d1e24009c0db8&session-two=5515a210d792f354050c9339 Sometimes it says that an infinite loop is detected. Another time it loads whole game through to the end (if you re-load the page). The loss happened about 3 times in the last 3 days.

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).

Activity

  1. vn971 commented on Jun 7, 2018

    @vn971
    Author
  2. vn971 commented on Jun 7, 2018

    @vn971
    Author

    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.

  3. nwinter commented on Jun 7, 2018

    @nwinter
    Contributor

    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.

  4. vn971 commented on Jun 7, 2018

    @vn971
    Author

    @nwinter That's interesting. I see. Thanks for the quick response!

  5. vn971 commented on Jun 7, 2018

    @vn971
    Author

    // Not sure it's relevant, but my submission uses array.sort method, which could (?) use random to choose pivot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions