Skip to content

A Game of Amazons AI project for COSC 322 using Monte Carlo Tree Search written in Java.

Notifications You must be signed in to change notification settings

luctowers/montejava

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Monte Java

A multithreaded Java implementation of MCTS for the Game of Amazons. This AI was created for a class tournament in the course COSC 322 Introduction to Artificial Intelligence.

Techniques used

  • Lockless multithreading
  • Efficient chamber analysis using bitwise operations
  • Hybrid roullouts with endgame detection
  • Splitting players turns into two layers to mitigate the large branching factor

Usage

To compete with this ai compile the jar with COSC322Test as the main class.

# run with gui
java -jar team-01.jar username password
# run with no gui
java -jar team-01.jar username password nogui

To test locally checkout the LocalTest class!

Project Structure

All of the functional bits for our AI are in java.ubc.cosc322.engine. The rest is mostly just code wrapping the prof's API.

Final Tournament Configuration

new MonteCarloPlayer(
	() -> new SwitchHeuristic(
		60, // switch between heuristics at move 60 (turn 30)
		// full rollouts first
		new RolloutHeuristic(
			new RandomPlayer(new LegalMoveGenerator())
		),
		// hybrid rollouts second for improved endgame
		new HybridRolloutHeuristic(
			new RandomPlayer(new ContestedMoveGenerator())
		)
	),
	() -> new LegalMoveGenerator(),
	Runtime.getRuntime().availableProcessors(), // 1 thread per core
	28000, // 28 second thinking time
	0.6 // UCT exploration factor
);

About

A Game of Amazons AI project for COSC 322 using Monte Carlo Tree Search written in Java.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages