Frequently Asked Questions

Frequently Asked Questions

> Beginner's Guide

Here are the questions players ask most often. If yours isn't here, feel free to ask it on the Chat or the Forum.

How do I fire a pistol three times?

Each leek has a certain number of action points, or TP (10 at level 1, but this can change), which determine how many actions you can take during the turn.

Firing a pistol costs 3 TP, so you can do it 3 times in one turn by spending 9 TP.

To fire several times, all you need is enough TP, and to write the instruction that fires several times, for example:

var enemy = getNearestEnemy()

useWeapon(enemy) useWeapon(enemy) useWeapon(enemy)

You can also use a loop.

Why are the leeks I face a higher level than mine?

Opponents are picked based on your leek's talent. With each fight, a leek gains or loses talent depending on the outcome. The outcome of a fight depends on each player's AI, their characteristics, and their weapons and chips. Talent therefore reflects how this whole package performs against other players.

Facing higher-level leeks is actually a rather good sign. It means your strategy (your choice of equipment and characteristics, as well as your AI) can make up for the difference in level, and therefore in characteristics.

As it wins, your leek gains talent, and so faces stronger and stronger opponents. When you start losing, its talent will grow more slowly, or even drop. You can therefore be sure to face opponents as evenly matched as possible, given the players available.

On top of that, there are a lot of abandoned leeks at low level. They gained levels by being attacked, without their AI being improved or their characteristics being raised. This also makes some of your opponents look stronger than they are.

Don't worry, it settles down as you level up. And if it keeps happening at a high level, take it as a compliment!

Why does my leek explode?

This happens when an error stops your AI. In that case, look at the error message shown in the fight report. Usually, it means a game limit has been reached, such as the operations limit.

Why do I get an error message that says "AI interrupted: too many operations consumed"?

In an AI, every function call and every use of a variable costs operations.

A leek can perform up to getMaxOperations operations per turn.

This message is shown when that limit is exceeded. At low level, it usually happens when there's an infinite loop in the AI.

Why doesn't my leek do the same thing in a test fight and in the Garden?

When you start a test fight, you choose the AI to test from a list just above the test leek selection. That AI can be different from the one your leek uses in the Garden, which is set on the leek's page.

How do I summon a bulb?

The first bulb, the Puny Bulb (CHIP\_PUNY\_BULB), is available at level 48. Bulb AIs must be written as functions. For example, to make my bulb move toward its summoner and then boost itself with Protein:

function punyAI() { moveToward(getSummoner()) useChip(CHIP_PROTEIN, getEntity()) }

To summon the bulb, you don't use the useChip function but summon, like this (for our example):

// cell: the cell where you want to summon the bulb summon(CHIP_PUNY_BULB, cell, punyAI)

Be careful not to put "()" after the name of the bulb's AI: we pass the function itself as a parameter, not its hypothetical return value. More details on the Bulbs page.

How are a bulb's characteristics determined?

A bulb's characteristics are calculated from the level of the leek that summons it. The maximum is reached when the summoner is level 300 (or higher), and the minimum when the summoner is level 1 (which isn't possible in practice).

Between those two levels, the characteristics grow linearly, following this formula:

characteristic = floor(min + (max - min) * min(300, summonerLevel) / 300)

If the summoner is level 301, the characteristics are those of a level 300 summoner.

How are a leek's characteristics determined?

It's up to you to spend the Capital Points you earn by leveling up in your leek's characteristics tree. (This is a capital point in your leeks' progression.)

More details on the Characteristics page to help you distribute your Capital Points.

How do I equip more weapons and chips?

Your leek gains a weapon slot at levels 100 and 200. The number of chips your leek can equip depends on its RAM characteristic.

More details on the Chips and Weapons pages.

How do I raise more leeks?

See the "Farmer" section of /help/general.

You can eventually own up to 4 leeks, under the following conditions:

\* Careful: these are the leeks in that order. Having your first leek at level 150, the second at level 50 and the third at level 100 won't let you buy a fourth leek...

How do I find my own mistakes?

Before calling for help on the Chat when your AI doesn't behave as expected, you can add debug() calls to your code to understand what's going on:

var enemy = getNearestEnemy() debug("ID of my nearest enemy= " + enemy)

This code will show in the fight report the content of the enemy variable, preceded by the string "ID of my nearest enemy= ". debug() doesn't cost any action points (TP), but it's best not to overuse it: it makes reports harder to read, and the number of debug() calls allowed per fight isn't infinite.

debug() can display an array, for example

debug("Living allies: " + getAliveAllies())

will show an array in the report with the IDs of the living allied entities. That said, when you're working with arrays of cells, it's much more convenient to color the cells directly on the map during the fight with the mark() function:

var myPosition = getCell() mark(myPosition + 17, COLOR_RED)

This code colors in red the cell to the right of your leek on the map. Note: you can create your own colors with the getColor() function; you could even draw rainbows or the Mona Lisa!

How do I keep variables from one turn to the next?

Just use global variables, with the global keyword:

Or static class fields, with the static keyword: