First, we will import a program in the current directory (called
tournament.py), getting the class ChessPlayer from it. You can see the details of that program in tournement.py
from tournament import ChessPlayer import random
To have a baseline program to practice against, let's define a random player:
def random_player(board): move = random.choice(list(board.legal_moves)) return move.uci()
To run a tournament, you need to create two teams:
random_team = ChessPlayer(random_player, "Random Team")
other_team = ChessPlayer(random_player, "Making Chess Great Again")
And then you are ready to play a gaim. Simply have one team play the other:
By default, the play happens without any graphics. The output is of the following form:
[RESULT, MESSAGE, FINAL_BOARD, WINNER(S)]
MESSAGE is a string representing the final outcome.
FINAL_BOARD is a Board object, showing a FEN representation
WINNER is the name(s) of the winning teams.
If you would like to watch a game, use "simple" or "svg" as a second argument to the team.play() method.
Your team should write a chess-playing program. You must write the logic yourself and cannot use any other programs (such as opening move database). Each move must be made within 1 second.
Every member of the team should sumbit their own notebook, but the chess-playing program should be the same in each notebook. Put your team's chess program in the next cell.
# YOUR CODE HERE raise NotImplementedError()
The reflection cell is the most import cell in this lab... in all labs. In your reflection, you should:
For this second lab, please also add reflections on meta-topics:
YOUR ANSWER HERE