# 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.
