Reversi is a two player game.
Let us take a square playing board consisting of N x N square fields. The playing board is clearly delimited and board's edges do not neighbor each other. We have stones of two colors(traditionally black and white), one color per player. AT the beginning there are four stones in the middle of the board in this configuration:
B | W |
W | B |
Player whose turn it is, then places a stone so that it closes off his opponents row. These stones then turn into his. It works like this:
B | W |
W | B |
W |
Player A placed his stone at the bottom, and this is the result:
B | W |
W | W |
W |
It is now Player B's turn.
You can place stones either diagonally, horizontally or vertically. If a player cannot place a stone in a way that would take at least one stone, he loses his turn. The game ends when either the board is full, or neither player can place his piece. The objective is to have more stones than your opponent after the game ends.
You are to create a player, that will play properly (no exceptions and obeying the rules) and better than every other player.
During this assignment we will see properties of following kinds of problems:
Just like in the whole course, foremost we value your effort. You do not have to worry about not finishing this course just because of this assignment if you at least try. However, during the upcoming weeks, there will be several control points, where we check your progress. At the end, all the algorithms will be compared by playing against the algorithms of all the other students and you should try to score as high as you can.
More details are here.
Submission is done in two phases:
Player
Username.java
that extends ReversiPlayer
. If you need more classes, create those as internal.
Reversi
reversi.jar
(get reversi.jar by unpacking reversi.jar.zip)
$$$
”, and replace $$$
with the name of your favourite IDE (NetBeans, Eclipse, Intellij Idea, …)
cz.cvut.agents.rph.reversi.players
PlayerXxxxxxxx
, and replace Xxxxxxxx
with your username - e.g. student with username novakja1 should name his player PlayerNovakja1
- NOTE: the name is case sensitive.
ReversiPlayer
getName()
, that returns your username
makeNextMove(int[][] board)
, that returns your move as ReversiMove
for given game state (defined in variable board
). For finding out your player's colour, use method getMyColor()
implemented in class ReversiPlayer
.
init(…)
for own initialization of the player. In that case, it is necessary to call super.init(…)
as a first command in your method to ensure correct initialization of the player's parameters.
cz.cvut.agents.rph.reversi.main.ReversiCreator
DummyPlayer
, i.e. player that randomly selects valid moves
ReversiCreator
with parameters cz.cvut.agents.rph.reversi.players.PlayerNovakja1 cz.cvut.agents.rph.reversi.players.DummyPlayer
You can set the time limit used for limitation of the reasoning time by setting the parameter timeout
. This can be set by --timeout=XXX parameter of class ReversiCreator
where XXX is maximal time (in milliseconds) for which your player can stay in method makeNextMove()
.
During debug and testing it can be helpful to set this parameter high, e.g. run the class ReversiCreator
with parameters cz.cvut.agents.rph.reversi.players.PlayerNovakja1 cz.cvut.agents.rph.reversi.players.DummyPlayer --timeout=99000000
Source code for the reversi.jar framework will be at your disposal after the submission of the siplme player.