Warning
This page is located in archive. Go to the latest version of this course pages.

Reversi game

Player specification

A file player.py containg the MyPlayer class with the following methods

method input output explanation
__init__ my_color, opponent_color None A player contructor. The color is either 0 or 1
move board (n x n game board) r , c (row, column) a tuple - coordinates of your move The input is 2D list - current game board. Method should return a valid move. Example: (0,0) means putting your stone to the position board[r][c]. If no valid move is possible return None. board values -1 for empty space and 0/1 for the stone color. The max time spent within the move method is 5 secs

MyPlayer properties

  • docstring should be informative enough
  • attribute name contains the username of the student

Example of MyPlayer implementation

class MyPlayer:
    '''super-smart indeed'''
    def __init__(self, my_color,opponent_color):
        self.name = 'username' #username of the studen
 
    def move(self,board):
        return (*,*) 

support codes

See README_EN.txt in reversi.zip

courses/be5b33kui/labs/reversi/start.txt · Last modified: 2017/03/24 17:42 by svobodat