As we're approaching the final week of this year's challenge, it's time to present the end game.
Next monday (December, 3rd), at 23h45, we'll reset the leaderboard. This means everyone will once again receive the initial rating of 24, allowing you to overcome that streak of bad luck, and compete for a spot in the play-offs!
When the deadline (December, 10th) has passed, all (first year) students who have a rating higher than the Harlequin baseline will take part in the play-offs. During the play-offs, every contestant will play a single game against all the other contestants. The final stage will be determined by the win -and draw ratio during these play-offs.
Informatica challenge 2018
Welcome to this year's Informatica challenge. During the challenge, you'll compete with your fellow students to determine who can create the strongest Artificial Intelligence (AI) agent for a two player game, which we've developed, specifically for this challenge.
Best of luck!
–Pieter Van Molle, Ozan Çatal, Elias De Coninck & Gilles Vandewiele
When creating an account, you'll receive an initial rating of 0. By playing games against other students, your rating will update, based on the outcome of the game, and the rating of your opponent. Every 30 minutes, you'll be matched against a similarly rated student.
Participation is NOT obligatory. Though, we encourage you to participate, as this challenge gives you the opportunity to sharpen your problem solving and programming skills on a real-world problem. To add some additional incentive, the students with the highest rating at the end of the challenge will receive a prize. Respectively, the top three students will receive:
- A Fnac coupon of €50
- A Fnac coupon of €25
- A Fnac coupon of €10
Besides the top three, three additional students will be picked from the leaderboard at random, who will receive a participation prize (a Fnac coupon of €10).
Note: this challenge is designed specifically for students following the "Informatica" course, by prof. Bart Dhoedt. Therefore, only students enrolled in this course are eligible to the monetary rewards.
The challenge will end on 10/12 23:59.
The game: Hexatron
Hexatron is a two player game, where each player controls a different color agent, in a hexagonal grid. At every turn, both agents can rotate (120°, 60° or 0°, clockwise or counterclockwise), before moving forward a single space. Behind them, they leave an impenatrable trail. The goal is to outlive your opponent, by
- not crashing into the wall,
- not crashing into your opponent, or his trail,
- not crashing in your own trail.
The following image contains a replay for an example game. The darker colored spaces represent the starting position for both agents. The orientation (after rotating), is given by the arrows. In this case, the blue agent lost, by crashing into the trail of the yellow agent. Note that the actual playing field will be bigger than the one shown here.
An agent moves by first rotating, and then moving forward. There are five possible rotations, relative to the current orientation of the agent: 120° counterclockwise, 60° counterclockwise, 0° (no rotation), 60° clockwise, and 120° clockwise, represented by the actions
2. The following figure shows an agent oriented northeast. Highlighted are the spaces he can reach, along with the action required to reach them.
The following code snippet shows how you can find the compass points for each move, given your agent's orientation:
orientations = ['NW', 'NE', 'E', 'SE', 'SW', 'W'] current_orientation = orientations.index('NE') print([orientations[current_orientation + action] for action in range(-2, 3)]) # Prints `['W', 'NW', 'NE', 'E', 'SE']`
Playing field representation
The hexagonal grid is contained within a square array. An example is given by the following figure. Within each hexagon are the Y -and X-coordinates of that hexagon in the array.
Note that the top-left corner and the bottom-right corner of the array contain unreachable spaces. You'll have to take this into account in your move generation algorithm!
Some pointers to get you up and running for your first agent can be found below:
- Hexagonal Grids
- Flood Fill
- Game Trees (Advanced)
- Voronoi Diagrams (Advanced)
- Minimax/Alpha-Beta Pruning (Advanced)
- Monte Carlo Tree Search (Advanced)
- Of the 5 possible directions, send your agent in the one where the number of unfilled tiles it can reach is maximal.
- As an extension to the previous heuristic, send your agent in the direction where the number of unfilled tiles it can reach first is maximal.
- Calculate the number of tiles the opponent can fill, and take this into account when evaluating a candidate move.
- Try to partition the game board in two, where the partition belonging to you is larger, as illustrated below:
Making a submission
A valid submission consists of a single Python
.py file, which must comply to the following conditions:
- It is a valid Python 3.6 code file.
- It is not larger than 1 Megabyte.
- It contains no
importstatements, with the exception of:
numpy, functools, itertools, collections, operator, heapq, math, random, time.
- It contains (at least) the definition for the function
- Additional function definitions are allowed.
The following items are forbidden:
Execution code. This is top-level code, that is not surrounded by a function definition. This means that every (non-empty) line of your submission file has to start with one of the following:
import numpy as npin order to import NumPy,
defto define functions,
' 'to indent code.
Any of the following statements, function calls or modules:
Generating a move
generate_move function should have the following definition:
def generate_move(board, positions, orientations)
The arguments to this function are:
board: a 3D array, representing the playing field. The array has a shape of
(13, 13, 2). The first two dimensions are Y -and X-axis. The third dimension contains the trail of each agent. More specific, at the start of the game,
board[:, :, 0]will contain a single
1, at the Y -and X-coordinate of your agent. Similarly,
board[:, :, 1]will contain a
1at your opponent's location. As the game advances, more cells will contain
1's, indicating longer trails.
positions: a list, containing two tuples. The first tuple
(x, y)encodes the position of your agent, while the second tuple encodes your opponent's position.
orientations: similar to
positions, a list containing two orientations (integers in [0,5]), both for your agent and your opponent. The orientation is encoded as the index of the compass point in
['NW', 'NE', 'E', 'SE', 'SW', 'W'].
The function must return:
move: an integer in [-2,2], representing one of the possible rotations (120° counterclockwise, 60° counterclockwise, 0°, 60° clockwise, 120° clockwise), before moving forward.
IMPORTANT: When the time required for
generate_move exceeds one second or when an exception occurs in
generate_move, the corresponding player loses the game instantly!
An example of a valid submission (an agent that generates a random move), is the following:
import numpy as np def generate_move(board, positions, orientations): move = get_random_move() return move def get_random_move(): return np.random.randint(-2, 3)
Offline help files
To further assist you in the development of your agent, we're providing a ZIP-file, containing a series of Python files to evaluate your agent on your local system. The ZIP-file can be downloaded here, and contains (among others) the following files:
INSTRUCTIONS.txt: how to use the help files.
game.py: the game logic (that is actually used by the challenge).
simulator.py: the main execution script, to play a single game with two agents.
example_agent.py: a very basic example.
code_check.py: a python script that allows you to check if your submission is valid locally.
- Better matchmaking algorithm to prefer new match combination and higher quality matches.
- Fixed small bug in code checking logics.
- Migration to an ELO based ranking system.
queueare now allowed modules.
- Fixed a small bug in simulator when agents draw.
- Session now only expires after period of no activity.
timeis now an allowed module.
- Maximum move time and file size mentioned on homepage.
- Offline replay displays the agent names.
- The players' starting positions are now mirrored around the center of the grid.