Greed: Getting different outcome than written in ladder for my code when viewing the match


#1

Hi,

Nearly all of my matches in greed ladder show that i have lost/tied the game but when viewing some of the matches, my units crush my enemies. My username is Vratislav and it happens with my code submitted for Human team.

Here is a reported ‘tie’ against player who does nothing named: (ノಠ益ಠ)ノ彡┻━┻

Or reported ‘loss’ against player named: asdlk;fj asd fas

Tested both in newest Chrome and Firefox.


Some simulator-related information
#2

Not relevant anymore. Everything seems to be working as expected when I resubmitted the code today.

It is still happening, even after resubmit, now for different players


#3

After resubmition of the code it happens for different set of matches. For exmaple against Zodd:


#4

It’s always good to see that we’re not alone…
It does not prevent to write code, but it’s difficult to see if it’s better or not.


#5

Yeah, the sad thing is that it actually messes up your score :\


#6

I’m working on a fix now that would be causing this problem for a small subset of solutions.

Do either of you use for (var foo in arr) loops over arrays in your code? Those can be buggy right now, so if you use those, try to rework your loops to for (var i = 0; i < arr.length; ++i) loops instead to get around it until I can figure out how to fix the problem.


#7

Yeah, that will be probably it! I am using the “for in” statement because I discovered that it is more efficient in terms of calls issued than for(;;; ) loop. Will rewrite and report back. Thanks @nick !


#8

So I have rewritten the code as suggested and it works like a charm!


#9

Cool! I’m also uploading a fix that should prevent other users’ builtin prototype extensions from bleeding over into your code which should stop the problem from happening as soon as all current simulators are restarted with the new code (which might take up to a couple days). Thanks for your patience on that one.

Generally, using for-in loops over arrays is not very good JavaScript, so I’ll have to update the statement counting to not favor it!


#10

Weird, the same thing is happening to me.

I enter to see a match that it was declared a tie, but on the replay I won easily.

How did you fix it @nick ? All my loops are of the type for (var i = 0; i < arr.length; ++i)

Thanks in advance


#11

Hi @Nick,

I have got the same issue as Vrastislav had I can not reproduce any of my loose on lader (always win). In fact I use for each for custom object not for array. But even if I remove it I will get the issue.

Could you suggest some workaround or fix the issue:) ?


#12

Unfortunately it still happens to me, even after I got rid of for-in loops. It happens a lot less often though.

Here is example of a match where I have won but leaderboard says I “lost”:


#13

Just an idea: when I try to improve my code in the editor, if I then click on a previous match, the simulation I get is for the new in development code, not the old submitted one. This can be confusing if you expect to watch the original match.


#14

This bug is not eliminated. Still getting wrong results often.


#15

Can confirm, it hasn’t been fixed.


#16

Isn’t this just a matter of a different random seed each time you (re)play a match? In order to view the original outcome, you’d have to force the replay to use the original random seed (as well as the original code that both sides used for that match) so that the coins/gems appear at the same locations/times. Right now, the URL to view a match only contains the opponent’s id hash, and you can’t use that to generate the random seed because that would result in all re-matches with the same opponent producing the same outcome.


#17

Hi there! I’m having the same issue as well. When I review the “Lost” match, it shows that I actually won the match:


#18

Here’s another one: http://codecombat.com/play/level/greed?team=humans&opponent=537be3c7a3b60b390500de0e


#19

I agree with Eye, being able to use the same seed for coin spawn should reproduce the outcome of the match.


#20

Hi guys,

Sorry that this issue is still prevalent. We’ll fix it before the end of the competition. Just focus on actually winning as many games as possible (the score on the leaderboards is merely an estimate, and we will calculate final rankings on numbers of wins/losses). Sorry for the inconvenience!