Algorithm Mods

Algorithm mods allow you to add new programs for your Circuit Boards to execute.

Algorithm mod files come in two parts: The mission definition files (\*.mission) and the algorithm source files (\*.aloca).

## Mission Files

Algorithm Mission Mod files are text files with an extension of ".mission". Note: white space matters in this file. They are split into two main parts:

### Header Section

The header section consists of 10 lines of metadata text. Optional lines can be left blank, but the empty line should be kept in the file. The fields are:

1. Name of the mission defined in this file (required)
2. Mod Name, of the mod this mission is being distributed in (required)
3. Author Name, of the person or group who wrote this file (optional)
4. Version, no format specified, for your own purposes (optional)
5. Release Date, YYYY-MM-DD (required)
6. Port type (see below for supported values) (required)
7. Plug form factor (see below for supported values) (optional)
8. Power Provide Rate - a floating-point number at or above zero that defines how many Power Cubes this connection provides per second while connected.
9. Difficulty level - an integer from 0 (tutorial-level easy) to 10 (requires every component and research and takes ten cycles at best).
10. Required CPU Level - the minimum CPU level the circuit board has to have achieved for this mission to spawn
11. Required Research. The names of research nodes required to be finished before this mission will appear. Semicolon separated.

### Mission List

The first line of the mission list should just be the number of missions that follow.

After that, each mission should be defined in sequence according to the following format:

1. Algorithm display name
2. Algorithm source code filename (don't include path or extension)
3. Preward materials - materials provided to the player as the algorithm is started up (generally only used in tutorials; best to leave this blank)
4. Reward materials - materials provided to the player upon completion of the algorithm
5. Dataset filenames (don't include path), semicolon separated, must be in same folder as mission file

#### Materials Definition

The Preward and Reward material lines use the following format. The line of text will have a sequence of two character sets. The first character, a digit, will indicate quantity. The second character, a letter, will indicate material type. Break double-digit quantities into multiple sets. There is no limit to the number of sets that can be included. Materials will be imported by the circuit board's data pin in the order they're defined here.

For example, the following, used as lines 3 and 4 of an Algorithm definition from above, would result in one life node being provided as the mission is started, and three life nodes and two research nodes being provided upon mission completion.

```
1L
3L2R

```
The following materials are defined:

* L - Life Cube
* P - Power Cube
* R - Research Cube
* C - Conductor Cube
* S - Silicon Cube

## Algorithm Source Files

Algorithm source files are written in ALOCA and have the file extension ".aloca". They should reside in the same folder as the mission files that use them.

For more information on writing ALOCA programs, view the ALOCA Wiki Page.

## Dataset Files

Most algorithms take in certain data and expect properly altered data to be output. Dataset files define this data.

Dataset files are text files with the extension ".hex".

Dataset files have two lines. The first line is the input data provided to the player bit-by-bit. The second line is the expected output data (doesn't matter to gameplay, only for testing your code for accuracy). Both lines should be written in hexadecimal, with each character representing 4 bits.

A mission algorithm can have an unlimited number of datasets. One will be picked at random when the algorithm is started in-game.