首页 > > 详细

讲解 COMP34111 AI & Games辅导 留学生Java程序

Hex Game Engine Documentation

COMP34111 AI & Games

1. Submission checklist

This is provided to help you check you have included everything in your submission. Make sure you test your submission and read this documentation carefully. Pay particular attention to the Docker instructions to ensure that your code will run in the test environment.

1. Correctly formatted cmd.txt file specifying your Python agent (see section Section 4.3)

2. A Python class implementing AgentBase - either your own implementation or the ExternalAgent (see Section 3)

3. Any other files required to run your agent in the Docker container (see section Section 4.1.2), such as extra Python files, your agent implementation in an alternative programming language, and compiled files if relevant (e.g. .class files for Java). We will not compile your code, you should do this before submission in the specified Docker environment and include both the source code and the compiled files in your submission.

2. General Information

· The rules for Hex can be found here.

· The board is 11x11 and it is represented by a 0-indexed two-dimensional matrix with rows that fall diagonally to the right. That is, the position (x, y) has neighbours left (x-1, y), right (x+1, y), above (x, y-1), below (x, y+1) and diagonally (x-1, y+1) and (x+ 1, y-1). Below you can see the neighbours of tile X marked as N:

· Red aims to connect top and bottom sides, while Blue connects horizontally. Red moves first.

· The pie rule is implemented

· Each agent has a maximum total of 5 minutes per match

· Your agent's performance will be evaluated by a combination of win rate (75%) and move speed (25%).

· Possible outcome of a match:

   · Win - one agent has connected their sides of the board

   · Timeout - one agent has used up all the time allocated to it (5 minutes). The opposing agent wins.

   · Illegal move - one agent tries to occupy an already occupied tile, play a move outside the board or does not return a Move object. The opposing agent wins.

3. Implementation

3.1. Overview

You have the option to implement your agent in Python, or in an alternative programming language of your choice. You can either implement the provided agent template class in Python, or use the provided agents/DefaultAgents/ExternalAgent.py class to launch your agent as an external process. More detailed instructions on how to do this are provided later, with an example implementation in Java.

3.2. Python agent

An agent template is provided at agents/DefaultAgents/NaiveAgent.py. The class has two methods,_init_and make_move.

When the game starts, the engine will call the_init_method in your Python agent, which will tell you which colour your agent will be playing as and allow you to perform. any setup steps.

When it is your turn to move, the game engine will call the make_move method, which should always return a Move object. If the method is not a valid Move object, the game engine will classify the move as illegal, and your agent will lose the game immediately. When the make_move method is called, a Board object specifying the current game state will be provided, as well as a Move object specifying the opponent's move. The Board object contains a 2D list of Tile objects. Tile objects have x and y properties which match their position in the list returned by Board.get_tiles().

The Move object can be used to make a swap move or a normal move. To make a swap move, the Move object is created with the parameters (-1, -1). To make a normal move, the Move object is created with the parameters (x, y), where x and y are the coordinates the tile will be placed at.

The agent's only implementation requirement is it must be a class that inherits the AgentBase class (located at src/AgentBase.py). AgentBase is an abstract base class that ensures you implement both the_init_and make_move methods yourself, and provides all the necessary methods for running a game.




联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!