include

include(string ai)
Includes the AI named ai in the current AI.

Warning: the include function must only be called in the main block, and its parameter must be a string written directly in the code. For more information, see the tutorial: <a href='http://leekwars.com/help/tutorialincludes'>http://leekwars.com/help/tutorialincludes</a>.

Includes the AI located at the path ai in the current AI.

Be careful: the include function must only be called in the main block, and its parameter must be a string written directly in the code.

For example, with a file tree like this one, and from inside the file myAI/main:


- (folder) myAI
  |- main
  |- utils
  |- (folder) myFolder
     |- (folder) other
        |- functions
- (folder) strategy
  |- attack
  |- defense
- (folder) data
  |- items
include("utils")
include("myFolder/other/functions")
import * as utils from "./utils.js"
import * as functions from "./myFolder/other/functions.js"
import utils
from myFolder.other import functions
include("../strategy/attack")
import * as attack from "../strategy/attack.js"
# Python looks for modules in the AI's folder, then at the root
from strategy import attack
include("/data/items")
// No leading /: without ./ or ../, the path is looked up in the AI's folder, then at the root
import * as items from "data/items.js"
from data import items
Parameters
Synonyms

import, require

TypeScript

include does not exist: the AI is split into modules with import / export. Only exported names (export function …) are visible from other files. See JavaScript and TypeScript.

Python

include does not exist: the AI is split into modules with import, as in regular Python. A module is looked up in the AI's folder, then at the root. See Python.