1. Homepage
  2. Programming
  3. CS 380 Artificial Intelligence Assignment: Othello

CS 380 Artificial Intelligence Assignment: Othello

Engage in a Conversation
USDrexel UniversityCS 380CS380Artificial IntelligencePythonOthelloAdversarial Game

CS 380: Artificial Intelligence CourseNana.COM


Othello [https://youtu.be/xDnYEOsjZnM] is a 2 -player adversarial game in which a player place s pieces into a grid and tries to align them in order to win the game: CourseNana.COM

The object is to have the majority of your colored disks face up on the board at the end of the game. Every disk is white on one side and black on the other. CourseNana.COM

Setup : Initially, we place four disks, two with white sides and two with black sides up in the center of the board . Each player has 30 disks. One player plays as white and the other as black. The player playing black goes first, and then turns alternate. CourseNana.COM

Play : On your turn, you must place one disk on any empty space on the board and outflank your opponent. Outflank means to have your disk s on either side of a continuous straight line of your opponent's disks. This line can be any number of disks long and can be horizontal, vertical, or diagonal. When you place a disk so that you have outflanked your opponent's disks, you then flip the outflanked disks over to your color. You are allowed to outflank multiple lines in a single turn. CourseNana.COM

If you cannot outflank your opponent on your turn, you are not allowed to play, and you must skip your turn. If you can play, then you must play . Disks may only be outflanked due to a move and must be in a direct line of the placed disk. An outflank may not skip over your own colored disk to outflank more disks. Only the disks with in the immediate outflank are captured. CourseNana.COM

All outflanked disks must be flipped. You may not choose only to flip some of them. If you flip over the wrong disk and your opponent hasn't moved yet, you may fix the error. If your opponent has already moved, then you may not fix the error. Once a disk is placed on a square, it may never be rem oved , nor may it be moved to another square. If you run out of disks to place, and you still have a legal move, then your opponent must give you some of theirs to use. When it is no longer possible for either player to move, the game is over. Disks are cou nted, and the player with the majority of their color showing is the winner. You can also play multiple rounds and track points. The round winner receives points equal to the difference between the number of their opponent's disks, subtracted from the numb er of their disks. Once players reach a predetermined point total, the game ends, and the player with the most points is the winner. CourseNana.COM

The Assignment : In this assignment, we will use the minimax algorithm to make an AI agent that plays the game of Othello. Y ou are given the code to represent the board, handle the placement of pieces, and determine whether the game is over. Your task will be to extend this code into a full -fledged agent that can play and win the game. CourseNana.COM

Implementation Setup

The various parts of this assignment will require a shell script that can pass an argument to your code — thus allowing you to use the python 3 command on tux while allowing us to be able to run your code with a consistent interface. Again, you may only use built -in standard libraries (e.g., math, random, etc.); you may NOT use any external libraries or packages (if you have any questions at all about what is allowable, please email the instructor). CourseNana.COM

The shell script is the same code as you used in the previous assignments , including the ability to accept two arguments in the general format : sh run.sh As before , this scheme will allow you to test your code thoroughly and allow us to test your code using a variety of arguments. A sample shell script run.sh has been provided with this assignment. You should not need to modify this script file. CourseNana.COM

Game Implementation

Also provided with this assignment is the Python game implementation of the game . You can test it by running the command : sh run.sh human human which should run a game where both players are humans and generate moves from the input command line. You can assume for this assignment that the two players are represented by 'X' and 'O'. Most importantly , the Othello implementation is structured as foll ows: • “OthelloMove ”: this class contains a "move " (which player made the move and the coordinates of the move) • “State ”: this is the core class, which implements most of the functionality of the game. The functions you should be aware of for implementing min imax are : o “generateMoves ”: this function returns the list of moves for the next player to move. o “applyMoveCloning ”: this function creates a new game state that has the result of applying move 'move '. • “Player ”: this is an abstract class defining an agent that player Othello. Your agent should be implemented as a class that extends this one. • “game”: this class uses all the above classes to play a game of Othello. If you look into the agent.py file , you will find an implementation of an agent that play s Othello by the input that comes from the user. CourseNana.COM

Part 1: Random (3 p ts)

For the first part of the assignment , implement an agent that play s Othello by choosing moves at random. You can test it by running the command : sh run.sh random random CourseNana.COM

Part 2: Minim ax (5 pts)

In this part , we are asking you to implement an agent that plays Othello using the standard minimax algorithm, as we studied in class. The agent should be able to play both as the first and second players. CourseNana.COM

For the evaluation function, just use t he "score " function that is provided to you in the State class (make sure that your bot can play both as the first or second player). Your agent's constructor should accept the depth up to which we want to search. To make sure your agent works, make it play against the random agent . Your agent should defeat it easily! We should be able to test it by running the command: sh run.sh minimax random CourseNana.COM

Part 3: Minimax + Alpha -Beta Pruning (2 pts)

Implement a third agent, which uses alpha -beta search. Again, y our agent's constructor should accept the depth up to which we want to search and be able to play both as the first and second players . Compare the times that your two agents take to search up to different depths and report it in the PDF document . CourseNana.COM

We should be able to test it by running the command: sh run.sh alphabeta random CourseNana.COM

Part 4: Extra Credit ( up to 2 pts)

Implement another agent in a file called “ .py” , where is your lowercase Drexel user ID (e.g., awm32.py). Name the agent class the same thing (e.g., class awm32:) . Also , include all other classes that are needed to run the agent in the same file . This agent , instead of receiving the depth at which to perform a search, receives a certain amount of time (in milliseconds) that it can use to search. Make sure that your bot returns a solution within this time (you can assume that you will have at least 100 millise conds). CourseNana.COM

We should be able to test it by running the command: sh run.sh extra random

Hint: a good way to do this is by making your agent first search at depth 1. Then, if there is still time, search at depth 2. If there is still time, go for depth 3, etc. Also, make sure that you have code that cancels the search if enough time has passed. CourseNana.COM

You will receive 1 extra point by implementing this agent ; furthermore , we will also collect all the agents that comply with the instructions and play a tournament. Results will be announced in class in the case . For this part , you can make changes in the original function s such as “score ”. The top 5 will receive up to 1 additional point . Important Note: In all the above algorithms , your agent should be able to play as the second player. That will be specifically important if you’re doing the extra credit. For example , we should be able to run the below command with Player ‘X’ winning most of the time , depending on the depth: sh run.sh random alphabeta CourseNana.COM

Get in Touch with Our Experts

Wechat WeChat
Whatsapp Whatsapp
US代写,Drexel University代写,CS 380代写,CS380代写,Artificial Intelligence代写,Python代写,Othello代写,Adversarial Game代写,US代编,Drexel University代编,CS 380代编,CS380代编,Artificial Intelligence代编,Python代编,Othello代编,Adversarial Game代编,US代考,Drexel University代考,CS 380代考,CS380代考,Artificial Intelligence代考,Python代考,Othello代考,Adversarial Game代考,UShelp,Drexel Universityhelp,CS 380help,CS380help,Artificial Intelligencehelp,Pythonhelp,Othellohelp,Adversarial Gamehelp,US作业代写,Drexel University作业代写,CS 380作业代写,CS380作业代写,Artificial Intelligence作业代写,Python作业代写,Othello作业代写,Adversarial Game作业代写,US编程代写,Drexel University编程代写,CS 380编程代写,CS380编程代写,Artificial Intelligence编程代写,Python编程代写,Othello编程代写,Adversarial Game编程代写,USprogramming help,Drexel Universityprogramming help,CS 380programming help,CS380programming help,Artificial Intelligenceprogramming help,Pythonprogramming help,Othelloprogramming help,Adversarial Gameprogramming help,USassignment help,Drexel Universityassignment help,CS 380assignment help,CS380assignment help,Artificial Intelligenceassignment help,Pythonassignment help,Othelloassignment help,Adversarial Gameassignment help,USsolution,Drexel Universitysolution,CS 380solution,CS380solution,Artificial Intelligencesolution,Pythonsolution,Othellosolution,Adversarial Gamesolution,