Currently encountering a bug when running as Blue which causes my colossi to freeze and shows this error message both in Samurai Duck’s red window and in the console:
|嫦娥’s Cheryl| TypeError: Cannot read properties of undefined (reading ‘get’)
play-7a99e3f23a8c3f6ffef7.bundle.js:152 |嫦娥’s Cheryl| Hero Placeholder 1 had new Programmable problem: plan TypeError: Cannot read properties of undefined (reading ‘get’) 0.2
My main loop is highlighted red when this occurs, and it’s happening when I test against the current top player, who happens to have a good variety of summoned units.
With some debugging, it appears that it occurs when I access unit.type for opponent units (possibly Ogres specifically) when playing as Blue.
Looking at the error, I can guess you might be accessing ‘get’ property, something like: unit.get
Another guess is the " Hero Placeholder 1 " (usually enemy or your own base) does not have all the properties there, ‘x’ is missing, ‘attackRadius’ etc… Which is expected - you’d might need to filter out the bases.
Can I have some clarification on something @Bryukh?
One of my matches when played as blue shows win, but when played as red is shown as loss. Which one of them will count when calculating the final results of the tournament?
I don’t have a spectate link, but I can make it happen by slightly modifying the starter code when going against the current top player as blue:
COLOSSUS_LIST = ["cronus","hyperion","atlas","talos"]
def guard(e):
colossus = e.colossus
place = e.place
while True:
for e in hero.findEnemies():
if e.type in COLOSSUS_LIST:
colossus.attack(e)
enemy = colossus.findNearestEnemy() or hero.findNearestEnemy()
if enemy and enemy.health > 0:
if colossus.isReady() and colossus.distanceTo(enemy) < colossus.specialRange:
colossus.special(enemy)
else:
colossus.attack(enemy)
def choose(place):
return {
'B': 'atlas',
'C': 'cronus'
}[place]
hero.chooseColossus = choose
hero.on('spawn-colossus', guard)
while True:
hero.summon('munchkin', 'B')
hero.summon('ogre', 'C')
It seems okay accessing e.type just to check equality, but it is when checking “e.type in COLOSSUS_LIST” that the error happens.
Hmm, that’s strange; I don’t see the same thing with that code playing as blue against a JS player. Does it do that for you when testing on a different account (which will get a different random seed for each match than your main account)?
Hmm I was trying that code logged out with an anonymous account.
The error message doesn’t show up until close to the end of the match. Near the beginning, the main visible difference is just that the colossses are not moving. It can be seen in the console though.
Update: Just tried it again on a different computer, by pasting the code into an incognito session. Still observing the issue when playing as Blue against a JS player.
Link: CodeCombat - Coding games to learn Python and JavaScript
In case it’s relevant, I’m using Chrome in both cases, but one is on a Macbook and the other is on a Chromebook.
(That was my first tournament)
(I got some spelling help from my brother (like when I spelled “shaman” wrong.) but other then that, ALL MY IDEAS)
(I’m proud)
Hi Bryukj, I’m SM Loh, but I no longer use the affected “e.type in SOME_TYPE_LIST” logic in my code - replaced it with a workaround. It might still be good to identify the cause of this issue in case it affects anyone.
Is it not replicating for you using the code in an anonymous account?
Hmm very strange. Well, if it’s not replicating for you and Nick then probably it shouldn’t affect simulations then. Wonder if there’s some JavaScript execution differences on my systems.
Hello can I speak to you please it is something that is very important that I need to discuss with you if you don’t mind. Can you reply ASAP to my message. Please and Thanks/ Thank You. If you do read my message that I send to you.
Is that message directed to me or to Bryukh? It’s kind of strange.
I don’t see any messages in my inbox. In any case, it’s better to discuss things in a public thread like this so everyone else can learn too.
Problem 1:
Sometime, it shows the following error message, the browser cannot enter into the game coding interface and keep on the loading page.
Uncaught Error: You can't set undefined's `chooseColossus` property here.
at t.set [as chooseColossus] (eval at module.exports.World.loadClassFromCode
Problem 2:
When I use python lambda statement as chooseColossus executing function (the following codes). It will not return anything, until I added merge strings code.