Due date: Wednesday, October 29, 2025.
Download the following file implementing the game of Othello:
This game takes place on a 8x8 board where two players take turn placing black and white tokens. In this implementation, the black player is the user (=1 in the program) and the white player is an AI agent (=-1 in the code). The human player has the first move. The game must start with the configuration you see when you launch the program.
When a player places a token on the board, it must to be able to connect with at least one of its existing tokens in a straight line, either horizontally, vertically, or in diagonal, with at least one opponent's token in between. After placing the token, all the opponent's tokens found on a straight line between the new token and an existing one are captured, meaning that they switch color and they now belong to the player making the move.
The game ends when there are no more moves that can be made by either player or when there are no more empty spaces, or when a player loses all their tokens. At the end of the game the player with the most tokens wins. A draw means that the players have the same number of tokens.
Use any generative AI system such as Copilot or ChatGPT to complete the functionality of this program. Construct a prompt for one function at a time, then copy the result into the script. Some adjustments to the code you get from the AI system may be necessary. Modifying the prompt may get you a result that requires less modifications and adaptations. Here are the functions that need to be written or completed:
dir_move(self)
This function returns the change in the row and column numbers to go in one of the 8 directions from the given position. The parameterdir
is one of the elements of the global listdirections
. 3 directions are already implemented and 5 more are needed. You can try giving the AI the partially written function or the description for it, or both.
next_move(b, who)
This function should return one of the possible moves for the player with identity given by the parameterwho
(1 or -1). You can suggest using the functions MinMax or AlphaBeta in the prompt, or not. You will need to specify that this is for the game of Othello, and probably what the values in the table mean (0 for empty, 1 and -1 for the players). You can try to see if the functionsscore
andpossible_move
help. You can also ask it to give you a better estimation of the utility of a move than the simplescore
.
no_more_moves(self)
This function verifies if either player has any more moves it can make on the tableself.board
. If either of them has a move, it should return False, otherwise True. You can try to see if the AI can write this function without providing the functionpossible_move
and also provide it to them if not.
With these three functions completed, the program should be fully functional.
Reflecting on your experience of trying to complete this program with AI, answer the following questions:
a) What prompt worked the best for each of the 3 functions?
b) How much extra work did you have to do to integrate the code you obtained into the program?
c) Do you think the process saved you time, or would it have been faster to write the code yourself?
d) Could some with no programming background (like an English major) be able to accomplish this? How about someone with only a little programming background, like someone who completed CSCI-C101 or INFO-I101 or CSCI-A504?
Turn in: the modified file Othello.py to Canvas, Assignments, Homework 8, and the answer to Ex. 2 either as a text file, or a Word document, or a comment to the homework submission.