# Tower Defense Demo

This mini tower defense demo is used to demonstrate the different AI tools that were being created. It demonstrates the difference between A Star and Djikstra's algorithms when it comes to path finding.&#x20;

The regular turret shoots flying agents by checking if any agent has moved into its attack range. They have medium range and are used throughout the maze to destroy agents that try to get to the end.

<figure><img src="https://2886414827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuVu6MnwL34Z8kSpcNWp%2Fuploads%2FEmu4u4PsHQraVCE2ewts%2Fimage.png?alt=media&#x26;token=32139d40-81d2-41f7-806b-88a3fe163b93" alt=""><figcaption><p>Regular Turret</p></figcaption></figure>

The sniper towers have infinite range at a cost. They can only shoot agents that are being spotted by active turrets. While there are no agents in the range of any turrets, it can not shoot as indicated by its dark blue colour. The towers use a blackboard to broadcast when an agent enters the range of any turret and the sniper towers use this information to fight back. As seen in the images below, once the sniper tower has been broadcasted an agent from the blackboard, it can start shooting the agents.

<figure><img src="https://2886414827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuVu6MnwL34Z8kSpcNWp%2Fuploads%2Fkl5LHlsVSbxSdL7rLYIh%2Fimage.png?alt=media&#x26;token=a963a359-08b6-49e9-bcc7-d2425928fa59" alt=""><figcaption><p>Sniper Tower Inactive</p></figcaption></figure>

<figure><img src="https://2886414827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuVu6MnwL34Z8kSpcNWp%2Fuploads%2FlpG4h4NHUVcn7tsQTjOA%2Fimage.png?alt=media&#x26;token=df40fd5a-4380-46c5-aa98-0fa0d7952353" alt=""><figcaption><p>Sniper Tower Active</p></figcaption></figure>

<figure><img src="https://2886414827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuVu6MnwL34Z8kSpcNWp%2Fuploads%2FvevndH3hlhNAcHfkiDec%2FAI%20pathfinding%20-%20Made%20with%20Clipchamp.gif?alt=media&#x26;token=6ec93cb8-6967-4efe-b007-cdcd321eb7d2" alt=""><figcaption><p>Demo</p></figcaption></figure>


---

# 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://rhuynh502s-personal-organization.gitbook.io/projects/tower-defense-demo.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.
