# The Colossus Battlelands Randomizer

## 1 BattlelandsRandomizer

BattlelandsRandomizer is a (very crude) tool to randomly create Battlelands for use with the " Colossus " Game. It has the same requirements as Colossus itself, see Colossus README and Colossus build-HOWTO .
To create the program, just type "make tools" or "ant tools". See Building Colossus for more details. This should create all the tools for Colossus, including BattlelandsRandomizer.
BattlelandsRandomizer uses an input file that describes the properties of the future Battleland, and generates one random Battleland. At the moment, it's a purely static, text-based process.
The Randomizer used can also be accessed from inside BattlelandsBuilder , in a much more user-friendly way. An input file (described below) is still needed.
Examples of random input files can be found in the "Random" subdirectory.
Properties are lines of one of the three forms:

1. `AREA <list_of_hex> HAZARDS <list_of_hazards>`
2. `LABEL <label> = <list_of_hex>`
3. `PAIR <pair_of_hazard> HEXSIDES <list_of_hexsides >`

where

- `AREA` , `HAZARDS` , `PAIR` , `HEXSIDES` and `LABEL` are the strings literals ; = is the character literal '='.
- <list_of_hex> is a list of hex from the following available forms:
  - `"(" <number>, <number >")"`
  - `"(" <range>, <range>")"`
  - `"(" <number>, <range>")"`
  - `"(" <range>, <number>")"`
  - `<hex_label>`
  - `"(" <label>")"`
  - `SOMEOF"(" <number>, <list_of_hex >")"`
  - `SURROUNDINGSOF"(" <list_of_hex >")"`
  - `SUBSTRACT"(" <list_of_hex>, <list_of_hex >")"`
  where <number> is a number between 0 and 5, and <range> is of the form <number>- <number> i.e. a range of number between 0 and 5. <hex_label> is simply the label displayed on the Battlemap (F4, C3,...) <label> is a label defined previously with a `LABEL` statement (see below)
- There are some predefined labels available, including :
  - "inside" representing everything but the most outside Hex.
  - "leftdefenseentry", "upperdefenseentry" and "lowerdefenseentry", the 3 lines of 3 hexagons representing the defense entry lines (left, upper-right, and lower-right respectively).
  - "anywhere" representing the whole Battlelands.
  - "leftover" : special label representing all hexes that were in the most recent `AREA` statement, but didn't receive a Hazard.
  - "usedup" : special label representing all hexes that were in the most recent `AREA` statement, and did receive a Hazard.
  `SOMEOF` is a literal string ; result is a list of <number> hexes taken randomly from the <list_of_hex> in parameter.
  `SURROUNDINGSOF` is a literal string ; result is the list of hexes adjacent to any hex(es) in the <list_of_hex> in parameter. Note that all hexes present in the <list_of_hex> are excluded from the result.
  `SUBSTRACT` is a literal string ; result is the list of hexes that are in the first list but not in the second.
- <list_of_hazards> is a list of Hazard from the following available forms:
  - `<hazard_letter>(, <probability>)?(, <elevation >)?`
  - `<hazard_letter>(, <probability>)?(, <probability_elevation_0>, <probability_elevation_1>, <probability_elevation_2>)?`
- where <hazard_letter> is a letter representing a Hazard ('r' for Brush, and so on, see BattleHex.java), <probability> is a float number representing the percentile of chance of the hazard being present (a numerical point _must_ be present for all probability), <elevation> is a hard-coded elevation (integer between 0 and 2), and the three <probability_elevation_X> are the odds of the hazard being at elevation 0, 1 and 2 respectively (it's better is the sum is 100., but they will be normalized to percentile values). Only the <hazard_letter> is mandatory, the other parts are optionals. But if those other parts are present, they must respect the order above (first probability if present, the either the elevation or the elevation probabilities).
- <label> is a lowercase-only string, that act afterwards as it was the list of Hex on the right side of the '=' character.
- <list_of_hexsides> is alist of <hexside_letter>, <hexside_probability>
- <pair_of_hazard> is a pair of "(" <hazard_letter>, <elevation>")". Elevation can be 0, 1, 2 or the character literal *, which means 'any elevation'. For all hexside between such a pair of hazard, all hexside from the <list_of_hexside> will be tried in order, until either one is present, or all have been tried (in which case no hexside will be used between the two hazards). Not that the default Hazard, the plains (character 'p'), can be used.

BattlelandsRandomizer will then, for each `AREA` , try to put the Hazard in any one of the Hexes in the `AREA` . A Hex will not receive two hazards, but if a Hex is present multiple times in the same `AREA` , it may receive one Hazard per occurence of the Hex. In this case, only the last Hazard is used.
`AERA` s are processed in order, so an Hex that appears in multiple `AREAS` may also receive multiple Hazards. In this case only the last Hazard is used.
Note that all hexsides use the same `PAIR` -defined probability. Only the last `PAIR` statement is used for a given pair. For this purpose, all elevations including * are different. The more specific statement will be used (i.e. (s,0)(p,0) will be used instead of (s,*)(p,*) for the hexside between a 0-height Sand and a 0-height Plains).