Skip to content
CppCooperProgramming Portfolio
Selected projectProject year 2021

Game of the Amazons AI

A Java search agent with piece-and-arrow move generation, territory and mobility evaluation, pooled move objects, and separate search workers.

Version
Original project
Status
In development
Built with
Java, Maple, ygraph SmartFox client
My work
AI implementation; course client and libraries supplied separately
The case study

Project overview

This Java search agent plays Game of the Amazons through a course-supplied client. A turn combines a queen-like piece move with an arrow that blocks another square, so generating and evaluating a turn involves more than choosing a destination. I implemented the project’s search, state, and heuristic work; the network/game client and external libraries are separate dependencies.

A move has two destinations

The move compiler scans the eight queen directions to find piece destinations, then scans again for arrow destinations from each resulting position. A candidate move records the piece, where it moves, and where the arrow lands. That produces a large collection of combinations even before the search begins exploring later turns.

The implementation can retrieve Move objects from a pool using packed integer keys. Board state, moves, and search-tree nodes have separate representations, allowing the move-generation code and tree exploration to share those concepts without putting the course client into every operation.

Estimating useful territory

The evaluation combines territory and mobility terms. Queen-distance and king-distance calculations estimate how pieces can reach the remaining board, while mobility accounts for the options available around pieces. Stage-dependent weights change the contribution of those terms as play progresses.

The repository includes Maple worksheets and PDFs supporting the calculations. The code turns those terms into values that candidate positions can be compared by. These are heuristic estimates: they supply an ordering for the search, without proving the outcome of a position.

Organizing exploration

The search uses a deque with front-first and back-first exploration policies, along with dynamic heuristic selection. The AI core starts separate exhaustive-search and simulation workers and can also process a heuristic queue. This creates several interacting paths through the same move and state representations.

That structure is part of the implementation, but it does not establish thread safety, search strength, or a speed advantage. The original test files contain move-generation timing loops and print-based probes; they do not supply a reproduced benchmark or a verified win rate for this page.

Course version and unfinished refactor

This account follows the course implementation on master. A later dev branch reorganizes the program around human and AI game controllers and a separate game loop. That refactor is unfinished and should be read as a different source tree, rather than features already integrated into the course version.

The course version depends on the separately hosted ygraph SmartFox client. That dependency is missing from the current local setup, blocking a faithful rebuild and server-play check. The useful material here is the move-generation, representation, and evaluation design; accepted match results and comparative playing strength remain unverified.

By Joshua Cooper Published Updated

Keep exploring

More projects

View the portfolio