<!--
SPDX-FileCopyrightText: 2023 Jummit
SPDX-License-Identifier: CC-BY-SA-4.0
-->
# Code Architecture
## ECS
The ECS "framework" is inside `world.fnl`.
## Screens
The main script allows switching between screens by setting the `next` field on the world.
These are the possible screens:
* `title_screen.fnl`
* `tutorial.fnl`
* `opponent_select.fnl`
* `match/match.fnl`
* `credits.fnl`
## Actions
`match/state.fnl` builds a "state" object which contains just the game state.
`match/actions.fnl` gives a list of possible actions from a given state.
`match/info.fnl` provides high-level queries for the data.
`match/player.fnl` displays a user interface for possible moves.
`match/ai.fnl` contains AIs which decide which move is best.
## User Input
## AI
## Components
The following components are used:
### Title Screen
```fennel
{:title-screen {:selected 1}}
{:emitter {:delay 0 :emission (fn [] {})}}
```
### General
```fennel
{:x :y}
{:card {:owner 1 :kind :virus :open true :border false} :screen-x :screen-y}
```
### Match
```fennel
{:cell {:start-for 1 :exit-for 2} :circuit-x 1 :circuit-y 1}
{:slot {:owner 1 :icon 12} :x 1 :y 1}
{:match {:phase {:setup true :player 1} :entities []}}
```