Go to the first, previous, next, last section, table of contents.

## Scorekeeper Forms

Scorekeepers are the objects that manage scoring, winning, and losing. A game design need not define any scorekeepers, and none are created by default. A scorekeeper may either maintain a numeric score that is used at the end of the game to decide rankings, or simply declare a side to have won or lost.

Form: `scorekeeper` name properties...

This form creates or modifies a scorekeeper with the given name, with the given properties.

- Scorekeeper Properties
- Scorekeeper Bodies
- Scorekeeper Functions
- Scorefile

### Scorekeeper Properties

ScorekeeperProperty: `title` str

This property is a string that identifies the scorekeeper to the players. Defaults to `""`.

ScorekeeperProperty: `when` (type [ exp ])

This property is when the scorekeeper will be checked or updated. Defaults to `after-turn`.

ScorekeeperWhenType: `before-turn` exp

This indicates that the scorekeeper will run at the start of each turn matching exp, or after every turn if exp is not given.

ScorekeeperWhenType: `after-turn` exp

This indicates that the scorekeeper will run at the end of each turn matching exp, or after every turn if exp is not given.

ScorekeeperWhenType: `after-event` exp

This indicates that the scorekeeper will run after every event matching exp, or after every event if exp is not given.

ScorekeeperWhenType: `after-action` exp

This indicates that the scorekeeper will run at the end of each action matching exp, or after every action if exp is not given.

ScorekeeperProperty: `applies-to` side-list

This property is the set of sides or side classes to which the scorekeeper applies. Scorekeepers apply only to sides that are in the game. Defaults to `side*`.

ScorekeeperProperty: `known-to` side-list

This property is the list of sides that know about this scorekeeper, and can see the value of the score for each side that it applies to. Defaults to `side*`.

ScorekeeperProperty: `trigger` form

This property is an expression that is true when it is time to start checking the scorekeeper's main test. Once a scorekeeper is triggered, it remains active. Defaults to `false`.

ScorekeeperProperty: `triggered` t/f

This property is true if the scorekeeper is currently triggered. Defaults to `true`.

ScorekeeperProperty: `do` forms...

This property is a list of forms to execute in order each time the scorekeeper runs. Defaults to `()`.

ScorekeeperProperty: `initial` value

This property is the value of the score upon game startup. If this value is `-9999`, the scorekeeper does not maintain a numeric score. Defaults to `-9999`.

### Scorekeeper Bodies

The forms in the body (the `do` property) of the scorekeeper may be any of the forms listed here.

ScorekeeperForm: `last-side-wins`

If supplied as the only symbol in the body, then the scorekeeper implements the usual "last side left in the game wins" behavior.

ScorekeeperForm: `last-alliance-wins`

If supplied as the only symbol in the body, then the scorekeeper implements the "last alliance left in the game wins" behavior. For the purposes of this scorekeeper, an alliance means that the sides in the alliance all trust each other.

ScorekeeperForm: `if` test action

If the test evaluates to `true` or any nonzero number, then the action will be done.

ScorekeeperForm: `cond` (test actions...) ...

This is like Lisp's cond.

ScorekeeperForm: `win` [ sides ] [ own-message ] [ other-message ]

This scorekeeper action causes the side to win immediately.

ScorekeeperForm: `lose` [ sides ] [ own-message ] [ other-message ]

This scorekeeper action causes the side to lose immediately.

ScorekeeperForm: `end` [ message ]

This scorekeeper action ends the game immediately, with a draw for all remaining sides.

ScorekeeperForm: `add` exp [ side ]

This adds the result of evaluating exp to the score of the given side. The value may be a negative number.

### Scorekeeper Functions

ScorekeeperFunction: `and` exps

The result is true if all the operands are true.

ScorekeeperFunction: `or` exps

The result is true if any of the operands are true.

ScorekeeperFunction: `not` exp

ScorekeeperFunction: `=` exp1 exp2

ScorekeeperFunction: `/=` exp1 exp2

ScorekeeperFunction: `>` exp1 exp2

ScorekeeperFunction: `>=` exp1 exp2

ScorekeeperFunction: `<` exp1 exp2

ScorekeeperFunction: `<=` exp1 exp2

ScorekeeperFunction: `sum` types property [ test ]

The result is the sum of the property values for all units of the given type(s). The optional test filters the set of units being tested.

### Scorefile

GlobalVariable: `scorefile-name` str

This variable supplies the name of the file to be used for recording scores of people playing the game. The default value is `""`, which disables the recording of scores.

Go to the first, previous, next, last section, table of contents.