# Chain Tactics Modding Tutorials

Unit Lister Mod:

* Set up the headless client (see Installation).
* Query units with GetUnits().
* Output names:

`using Sovrun.CTServer;`\
`class UnitLister {`\
&#x20;   `static void Main() {`\
&#x20;       `var client = new CTServerContext("http://127.0.0.1:8545");`\
&#x20;       `var units = client.GetUnits();`\
&#x20;       `foreach (var unit in units) {`\
&#x20;           `Console.WriteLine(unit.Name);`\
&#x20;       `}`\
&#x20;   `}`\
`}`

**AI Opponent Mod:**

`public class RandomAI {`\
&#x20;   `private CTServerContext client;`\
&#x20;   `public RandomAI(string rpcUrl) {`\
&#x20;       `client = new CTServerContext(rpcUrl);`\
&#x20;   `}`\
&#x20;   `public void MakeMove() {`\
&#x20;       `var moves = client.GetAvailableMoves();`\
&#x20;       `var randomMove = moves[new Random().Next(moves.Count)];`\
&#x20;       `client.ExecuteMove(randomMove);`\
&#x20;   `}`\
`}`

Enhance with strategies like minimax for smarter AI.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sovrun.org/build-with-sovrun/chain-tactics/getting-started-guides/chain-tactics-modding-tutorials.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
