Are there a list of features, a wiki or Help? How to learn all possibilities of game?

Hi! I’m wondering, if there are any possibilities to learn what is possible and what is not to do in the game?

  1. It’s really easy to forget all features that were described in the tutorial.How to refresh memories easy way?

  2. I’m sure there are much more features than that were described, the problem is I can not understand the way to recognize them. It will be helpful, at least, to be able to see list of all methods of an object. It’s very boring to guess if there is enemy.health or enemy.type or enemy.name.

  3. Maybe there are some possibilities to use some standard Python modules, such as Math?

  4. Is it really true, that defining a function (Python) and using it slows my hero significantly (in comparison with the same action without defining a new function)? Is it a bug or it’s meant to be?

Thank you for your answers!

hi @mikesmypath, I’ll answer most of your questions,

  1. under where your code is, there will be all the available features you have for code combat, all you have to do is hover over them and it will tell you about it.
  2. there are more features, you mainly get them as you get farther in the game.
  3. you can use most standard python tools at any given moment.
  4. i may not have understood you correctly, but if i did, when you define a function and use it, your hero should be the same. :smile:
  1. But I can’t see there commands to my allies, how to define type of enemy (and that was already mentioned in my completed levels), how to define health of enemy.

  2. I’ve tried math.fabs(x) and fabs(x) - it’s not working. Same with sqrt(x).

  3. I’ve tried now absolutely identical code with and without defining a function on the level The Dunes. I did it 5 times for both variants. If i do:

    loop:
    #and then all my code
    i have 5 wins out of 5.
    If I do:

    def my_solution():
    #and then all my code
    loop:
    my_solution()
    I have 0 wins out of five, because my hero is moving slower (actually, she hangs more at the beginning of each loop).
    The same effect was on another lever.

  4. Actually, it’s always feels like my code is running very slow, like in an ancient PC. If my code has 10 if-statements my hero acts significantly slower than if my code is very small. Is it meant to be like this? It’s the same very slow speed of running for all players?

  1. I dont think its possible to define the health of enemy, at least as far as i know
  2. If you play multiplayer, those commands should work for you.
  3. I’m not sure why it would run slower. It might be because of the fact it has to process more, not sure. I would ask nick about why it would be running slower. Could be because of your browser, maybe.

I agree that some of these things would be nice to have laid out for us. We must remember thought that this campaign format is fairly new and meant to bring a total beginner to programming from nothing to wherever we get. I would expect that in the progression they will introduce other functions and things.

That said, I think you should be able to access these attributes of any character:
.health
.maxHealth
.pos
.targetPos
.type
.attackRange ?

May be others as well.

For math, if you are using python then you can simply do:

Absolute Value: abs(-4)
Square Root: (4)**0.5 or Math.sqrt(4)
** is exponent for python

You can also use Math for other things like trig:

Math.sin(Math.PI)

I don’t think this Math is quite the same as the math module in python, but it is pretty similar.

1 Like

We haven’t provided a shim for the Python math module yet, but the JavaScript Math module is available: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math

We will make sure to alias to the standard Python math stuff when we start doing levels that introduce it. The plan is to introduce the documentation for all the abilities as you get items that grant those abilities, like sense stones and glasses and programmaticons and watches and such things. But if you don’t have those items, you can’t get the documentation for them yet.

For the issue with the extra pauses in each loop when you are using a function, can you open a GitHub issue for me with as many details as you can? Would love to get that fixed up. https://github.com/codecombat/codecombat/issues

Thanks!

1 Like

I actually found the ‘slow code’ thing happening in one of the levels. This was actually preventing me from completing one of the levels, because the ‘important’ part of my code was entering ‘run-time’ at a late point. To succeed in that level, I had to move the ‘important’ part of my code to the top, and have the ‘unimportant’ part be secondary.

I do get the sense that Nick IS pushing us to make cleaner code. Cleaner, simpler, more succinct code. If that is his intention, then I fully agree with it. I did some coding a number of years back in grade 10-12, and my code was certainly not clean. CodeCombat (plus reading the article about the single guy who coded & runs Plenty of Fish) has helped me keep my code a lot more terse.

Terse simple clean code = faster in run-time.

Do you have any loops in your ‘my_solution’?