Check This Awesome FAQ Before Posting

… you know it’s sweet stuff! Might save your life some day.

  1. I need help with my code!
    1. Walkthrough videos and personal coding help from the CodeCombat developers
    2. Post your code with radiant, harmonious formatting
    3. Check each level’s help guide for common tips
    4. If a level is too hard, try a different hero or different items
    5. Common error messages and how to debug them
  2. The game is not working!
    1. It crashes
    2. It doesn’t load
    3. It’s slow
    4. The graphics aren’t showing up
  3. Can you please fix this bug I found?
    1. Known bugs live in the GitHub issues
    2. How to report a bug
    3. Status of experimental programming languages
  4. What’s free and what’s paid?
    1. Levels
    2. Gems
    3. Heroes
    4. Support and tutorial videos
    5. Buying CodeCombat for your school or group
  5. I love this game! How can I help?
    1. Becoming an Archmage, Adventurer, Diplomat, Artisan, Scribe, or Ambassador
    2. Playtest new levels for free as an Adventurer
    3. Custom CodeCombat avatars

I need help with my code!

Walkthrough videos and personal coding help from the CodeCombat developers
If you’re a paid CodeCombat subscriber, we love you and would be happy to look at your code, figure out what is wrong, and happy to explain what to do, why, and how programming concepts work. Just use the contact form on the site to email us. If you are playing for free, we still love you, just… not in that way.

Subscribers also get access to walkthrough videos for every level, which explain in more detail how each new coding technique works as well as going over common mistakes and showing the full solution for when you get stuck. The first several levels’ walkthrough videos are free for everyone. Just check each level’s help guide for the video.

Post your code with radiant, harmonious formatting
You can get your code to format properly by surrounding it in triple backticks. This:

enemy = self.findNearestEnemy()
if enemy:

becomes this:

enemy = self.findNearestEnemy()
if enemy:

**Use spoilers for long text**
You can use the \[details\]-block to hide text or even code in an expandable textblock.

\[details=Some descriptive text\]

This text will not be visible until you expand the spoiler.

\[spoiler\]It also works with blurred text.\[/spoiler\]

self.say("You can even put code in here")



[details=Some descriptive text]

This text will not be visible until you expand the spoiler.

[spoiler]It also works with blurred text.[/spoiler]

self.say(“You can even put code in here”)


**Check each level's help guide for common tips**
If you get stuck, the first place to look is in the Hints for each level, located in the upper right. We've listed common gotchas and good-to-knows that will save you some serious brain agony.

**If a level is too hard, try a different hero or different items**
In addition to writing the right code, for many levels, your hero will need to be strong enough to defeat her enemies and survive their slings and arrows. Some levels are easier with a warrior, wizard, or ranger, so try a different hero if you have one. If you're dying too quickly, try buying more armor. If you don't have enough gems, consider playing more of the replayable challenge levels or simulating some multiplayer games. You could buy more gems, too, but it's not required to beat the core level progression.

**Common error messages and how to debug them**
I'll pretend you're writing Python, but most of this is the same for JavaScript or other languages.

* **Infinite loop detected**: uh oh, this is probably a problem on our end. If the "Comment out my code" option doesn't work, let us know. You can also try switching your programming language, hero, or gear to see if that lets you play. Most often, this happens either with an experimental programming language or a new, untested level.

* **undefined is not a function**: You probably don't have the method that you're trying to call. Maybe you're trying to `buildXY` but you have a sword instead of a builder's hammer. Make sure that you equipped the item that should provide it. You might also just be trying to call a method that doesn't exist.

* **Target is null. Is there always a target to attack?**: you are probably trying to attack `None`. Make sure that if you use something like `findNearestEnemy`, you use an `if enemy:` check before you do anything with `enemy`, because there might not be an enemy!

* **Find the distance to a target unit**: Same as above–if there is no target unit at some point during the level (possibly because you can't see anyone or have killed everyone), you'll pass a `None` target to `distanceTo` and error out. Use `if` statements to make sure that there is always a target.

* **'item' was null. Use a null check before accessing properties. Try `if item:`**: Same as above. If there is no `item`, then trying to access `item.pos` will throw an error. So use `if` to make sure there is always an item/flag/enemy before you read `item.pos` (or `enemy.pos`, or `flag.pos`, or ``, or whatever!)

* **Move to an {x: number, y: number} position**: are you sure that the arguments you passed to `move` or `moveXY` are numbers? For example, `hero.moveXY(item.pos.X, item.pos.Y)` won't work, because the `X` and `Y` should be lower-case properties of `item.pos`, and you'll see this message.

* **My hero isn't doing anything, but there's no error**: are you using a loop? Do you have an `if` or `else` condition that is firing but not telling your hero to do anything?

* **My distance check isn't working**: make sure you are comparing to a number, like this: `if hero.distanceTo(enemy) < 10:`


<a name="not-working"></a>
## [The game is not working!](#not-working)
We'd love to figure out what's going wrong and fix it up. Help us narrow the problem down:

1. Try it in Google Chrome, Mozilla Firefox, and either Safari (Mac) or Edge (Windows) to see if the problem only affects certain browsers.
2. Make sure that your browser is running the latest version.
3. Make sure that you have at least 2GB of RAM (only really old computers have less than this).
4. Figure out whether it happens on just one level or on all levels.
5. If you are using an experimental programming language (not Python or JavaScript), try in Python or JavaScript to see if the problem is specific to the programming language.

**It crashes**
This is often caused by either an old browser version or by running out of memory. Please let us know when it crashes and how it crashes: does the tab crash, does the browser crash, does the page stop responding, or something else?

**It doesn't load**
This is often caused by either a new bug on our end, an unsupported browser version, aggressive internet firewall settings (possibly from your work or school), malware on your computer, or a new and buggy level. Please [open the Google Chrome JavaScript console]( and send us the entire log for when it stops loading, plus a list of the steps you take where it doesn't load, and we can probably solve it.

**It's slow**
*If it's choppy*: CodeCombat should run fine on all but the oldest of computers. That said, the more CPU, graphics power, and RAM you have, the faster it will run. If you have a slow computer, consider trying another browser, which may often run faster. We find that Google Chrome is often the fastest.

*If it takes a long time to load*: either your bandwidth isn't fast or our servers are having problems. CodeCombat does need to download a lot of data so you can play the game, but there isn't any way around that, so on slow connections, it can take a minute or two to download everything. Browser and CPU speeds also affect level load times.

**The graphics aren't showing up**
If you either see a dark gray screen or [really glitchy graphics like this](, then either not all the art was successfully downloaded (try reloading the page) or there's an uncommon problem with your hardware accelerated graphics. Unfortunately, we don't have a workaround for problems with hardware acceleration, but you might try updating your video card drivers.


<a name="bugs"></a>
## [Can you please fix this bug I found?](#bugs)
**Known bugs live in the GitHub issues**
You might want to do a quick search in our [GitHub issues]( to see whether someone else has already reported the bug. If not, we'd love to hear about it so we can fix it. It's really helpful if you can post the issue on GitHub, but if you're not sure, you can also post it to the forum.

**How to report a bug**
When reporting a bug with gameplay in a level, please include:

1. your code, and
2. a screenshot of what's going wrong.

When reporting a bug with the rest of the website, please include:

1. what operating system,
1. what browser(s),
1. exactly when it stops working and what you see,
1. what programming language you're using,
1. what level isn't working,
1. and whether it worked before or has never worked.

If something in the web interface isn't responsive, it can be helpful to [open the Google Chrome JavaScript console]( and send us the entire log for when it doesn't work, plus a list of the steps you take to reproduce the bug, and we can probably solve it.

**Status of experimental programming languages**

JavaScript and Python are solid and well-tested, although some advanced Python features don't work. Other experimental programming languages may have some bugs; if you see any, let us know.


<a name="subscribers"></a>
##[What's free and what's paid?](#subscribers)
Everyone can play the main campaign level progression for free (yay free). We did this so that everyone could learn to code, regardless of means. But if you are a $9.99/mo CodeCombat subscriber, you get access to tons of extra bonus levels, in which you can learn new tricks, practice your skills, fight exclusive enemies, earn extra gems and experience, own pets, and unlock bonus heroes.

If you've beaten all the free levels, don't worry–we create new levels every week, some of which are free. So if you're patient, you can wait for the next free levels. But if you want more action, please consider supporting us with a subscription and checking out all the sweet bonus levels.

You can earn all the gems you need to advance for free by playing levels. If you want extra awesome items or heroes, though, you may want to buy some gems. Subscribers get 3500 gems per month, or you can buy gem packs in the gem shop.

You can also get more gems for simulating games or for beating higher difficulties of replayable levels. The formula for repeatable level reward scaling is 0.125x<sup>2</sup> + x, so the first several times you beat one, the linear term dominates. So as to not blow out the gem economy, we save the exponential growth on rewards for the very high difficulty levels that we hope are impervious to any hilarious tricks.

The basic warrior heroes, Anya, Tharin, Ida, and Alejandro, are available for free. As you beat subscriber-only levels, though, you can unlock the ability to purchase additional heroes with your gems. There are Ranger- and Wizard-class heroes with different abilities and gameplay strategies, and there are more specialized Warrior heroes, too. And there are more heroes on the way: dark elves and fairies, oh my!

**Support and tutorial videos**
Each level has a textual help guide that offers hints and programming info, and the first several levels have free walkthrough videos for when you get stuck. Subscribers gain access to full walkthrough videos for many levels.

In addition, if you are a subscriber, you get premium support from us, the CodeCombat developers: just shoot us an email through the contact form and we'll be happy to take a look at your code, teach you about programming, and generally help you out!

Unfortunately, we can't offer personal programming instruction for non-subscribers.

**Buying CodeCombat for your school or group**
If you want to use CodeCombat in your classroom, that's great! Just create a teacher account and invite your students to play the free introductory course. If you are looking for more levels or want to get your students even more excited about programming, then let's get you set up with a discounted school/class/group license. Check out [our teachers' getting started guide]( for more info.


<a name="contributing"></a>
## [I love this game! How can I help?](#contributing)
**Becoming an Archmage, Adventurer, Diplomat, Artisan, Scribe, or Ambassador**
CodeCombat is 100% open source, and we couldn't have done it without the help of our wonderful open-source contributors. Check out our [Contribute page]( to learn more about becoming a contributor:

* [Archmages]( write code for [our GitHub repository](
* [Artisans]( help build levels with [our level editor](
* [Adventurers]( playtest new levels first
* [Scribes]( help write documentation
* [Diplomats]( help us translate CodeCombat to 50+ languages
* [Ambassadors]( help out other players

**Playtest new levels for free as an Adventurer**
Yes, that's right–if you [sign up as an Adventurer](, you'll get emails with new levels a week early, and you can play those levels for free, even if you're not a subscriber, for the week that they're in Adventurer playtesting. It's our way of saying thanks for helping us get these levels right! You can continue to play levels you've started even after they become subscriber-only.

**Custom CodeCombat avatars**
If you make significant contributions to the game, we may ask if you want your own custom CodeCombat avatar drawn for you. Join us!

<img src="/uploads/codecombat/1789/c767ef5a8bdd0854.png" width="690" height="405">