Search
Rules: https://en.wikipedia.org/wiki/Reversi
Your task is to download the ZIP file and alter the downloaded player.py file for the Reversi game and then play a Reversi tournament against the players of the rest of the class.
player.py
This task will teach you about:
The solution can be generalized to other classical games, although in some cases this strategy does not lead to optimal solutions and you would use different approaches (e.g.: Go).
You can find the codes in the student repository KUI Reversi:
kui-reversi
git
cd kui-reversi git clone https://gitlab.fel.cvut.cz/kui-student-materials/kui-reversi.git .
.
kui-reversi-master
In the supporting codes, you will find:
reversi_creator.py
headless_reversi_creator.py
The file player.py contains the MyPlayer class with a few methods. You can use the method that is already implemented in the MPlayer class called get_all_valid_moves in order to get all the valid moves and thus focus only on your strategy and decision how to play the game.
MyPlayer
MPlayer
get_all_valid_moves
__init__
my_color
opponent_color
board_size
None
board
select_move
list
board[r][c]
move
Example of MyPlayer implementation
class MyPlayer: '''super-smart indeed''' def __init__(self, my_color,opponent_color): self.name = 'username' #username of the student def select_move(self,board): return (0, 0)
Late submissions do not take part in the tournament and receive 0 points.
Points are given in the following way:
Upload a ZIP archive with the module player.py and any other possible modules you created to the Upload system. All the files must be in the archive's root folder! The archive cannot contain any other folders!
Information about the tournament:
TBA