Infinite Inferno arena issues

@Bryukh, I am encountering a similar TypeError now if I attempt to check enemy.health for a tower. No such TypeError when checking enemy.health for a creep or a champion. Is this by design or is it unexpected?

Thanks! Added health and maxHealth properties to towers api.

Great!!
I think I also ran into issues accessing tower objects’ .pos.x and .pos.y
Do you mind checking if those are in place too?

Thanks!

Hmmm, pos should work, I’ve fixed it a week or two ago.

Hmm, yes, I just checked and it seems to be working fine, I’m not sure what was the circumstance under which it wasn’t working for me, might have been my own bug like me calling the function on a None. Thanks, Bryukh!

Ok, I realized the issue I encountered with pos was when I tried to use it with Vector.
From the help text I thought that pos could be used with the Vector functions, but when I try the following code:

    diff = Vector.subtract(unit1.pos, unit2.pos)
    return Vector.distance(diff)

It gives

TypeError: Cannot read property 'x' of undefined

try:

return Vector.distance(unit1.pos, unit2.pos)

Is .type broken? I think it worked yesterday.

Thanks, ShiningLice! Yes that works:

return Vector.distance(unit1.pos, unit2.pos)

And it turns out that this also works since Vector.distance() is an instance method and pos turns out to be a Vector:

return unit1.pos.distance(unit2.pos)

I guess the methods described in the documentation with (other) as the parameter are actually instance methods and not just static methods of the Vector class.

Is .type broken? I think it worked yesterday.

I haven’t noticed a problem with type. Are you running into an issue with it for towers? I think I noticed a couple of days ago that the type for mage towers was fixed to now be ‘mage-tower’ instead of ‘tower’.

My code is

eRangers = [e for e in enemies if e.type == 'ranger']
print(eRangers)

prints an empty list []
I also tried this:

for enemy in enemies:
    if enemy.type == 'ranger':
        print(enemy)

no messages

What are you using vectors for?

Usually in CodeCombat people use Vectors to go away from missiles/enemies.

1 Like

Does Infinite Inferno have a missile detection method?

1 Like

I don’t know, sorry. I don’t have enough time to play it.

1 Like

Printing has long been a problem with CodeCombat. A few notes from this level in JS, which may apply to Python as well:

  • enemies has to be found via champion.findEnemies, not hero.findEnemies

  • You’ll get nonsense errors if you try to check the type of the enemy base. Filter that out first, perhaps by finding enemies via champion.findEnemies("champion")

  • Printing out the enemies themselves may not work, it’s possible you’ll see output by printing out the position or type of each enemy.

  • CodeCombat will only show you so many messages in the console, which may hide messages if you have too many other debugging messages being logged. If this happens you’ll see Log limit 200 reached; shutting up. in the console.

Additionally, you can check if your code is being run at all or if it’s a problem with logging to the console by printing out a constant as well: print(2, enemy.type)

3 Likes

Vectors as used in CodeCombat are (x, y) coordinates. They are useful when managing positions, and nicer than managing pos.x and pos.y individually. Vector operations make it easy to calculate information like the average position of my army, the distance to the enemy army, the difference between the two, the closest direction to run to avoid the enemy fireballs, etc.

I don’t believe Infinite Inferno provides a missile detection method, but by being clever it isn’t necessary. By monitoring enemy.pos, enemy.isReady("special"), and enemy.target, you can determine where, when, and at which target the fireball is headed.

6 Likes

Great posts, Hydrobolic!

Hmm Shininglice are you having a problem with finding friend or enemy champions from hero, where previously it worked? I do believe I had previously used it. But it does not seem to be working anymore for me.

@Bryukh, @Bobby_Lockhart, I was just testing and I don’t seem to be getting any units back on any of the hero.findX() methods in Python. I am not clear whether the base is supposed to be omniscient, or have a fixed limited field of view, or aggregate the field of view of friendly units, but I am not seeing any units returned even in situations where there are definitely units close to the base.

Sorry, my fix for this bug was overwritten accidentally. Got it back. Thank you for the report.

No, I don’t think that is my problem. My code is able to print out the type but cannot detect it.

for e in eChampions:
    print([e, e.type])
    if e.type == "ranger":
        print([1, e.type])

Screen Shot 2021-04-27 at 12.33.02 PM