Assignment 3: Adversarial Search |
CSE 415: Introduction to Artificial Intelligence The University of Washington, Seattle, Winter 2020 |
The reading for this assignment is
Search
in The Elements of Artificial Intelligence with Python.
|
Due Friday, January 31
at 11:59 PM. This is a partnership assignment and students
may work in partnerships of 2 or work individually.
|
Introduction
This assignment is to write a pair of game-playing agents that can play two simplified versions of the game Backgammon. This game normally involves rolling dice. In the first version of the game, there is no dice-rolling. Instead, it's as if one die had only 1s on all six of its faces and the other die had only 6s on all six if its faces. This adaptation removes the stochastic element of Backgammon, and it allows Minimax and Alpha-Beta pruning to be the appropriate techniques of choice for an agent. We'll call this variation of the game "Deterministic Simplified Backgammon" (DSBG). In the second version of the game, the dice rolling works normally, so expectiminimax search is the way to go, and neither Minimax nor Alpha-Beta is appropriate. We'll call this variation of the game "Stochastic Simplified Backgammon" (SSBG). In both versions, several of the rules of normal Backgammon are removed or simplified so that the new versions are easier to play. |
Game Rules
To get started with this option, read the standard rules of Backgammon.
Here are the simplifications we are assuming in both of our simplified versions of the game (deterministic and stochastic):
|
Working with the Starter Code
The starter code contains the following files:
|
What to Implement
You should create two agents. One will be able to play DSBG. The other will be able
to play SSBG. These two agents can be very similar, except that the algorithms they
use for choosing a best move should be different.
For DSBG, your agent should use Minimax search. You should also implement Alpha-Beta pruning for this search. You'll want to define a class for your agent. You can name it whatever you like. At some point you'll probably want to have your agent play itself. In that scenario, you'll probably be creating two instances of the class. Your agent should have two counter variables. One will count the number of states created by your agent (from whenever the counter is most recently reset). The other will count the number Alpha-Beta cutoffs (also from whenever this counter is most recently reset). The counters will be "instance variables" accessed from "self" and not class variables, which would shared by all instances and thus possibly not give accurate, per-agent results.
You'll need to be able to turn Alpha-Beta
pruning on or off, so that you can compare the results of searches using it vs. not
using it.
The way to expose this choice is to implement a method in your agent called
Your agent for DSBG should also provide a method
Another method your agent should support is
Your DSBG agent should expose a static evaluation method
Your second agent should play Stochastic Simplified Backgammon (SSBG).
Instead of Minimax search and Alpha-Beta pruning, it should use Expectiminimax search.
In order to allow testing this under standardized conditions, the agent should do
two things that your DSBG agent does and one new thing.
The old things are: it should respect the You'll be turning in a "report" for this assignment in addition to your code (see below). The report should contain the following sections: Partner 1 name (last name alphabetically earlier than Partner 2's) Partner 2 name (last name alphabetically later than Partner 1's) Agent file name "Assignment 3 for CSE 415, Winter 2020, University of Washington" Deterministic Simplified Backgammon Agent Who did what for this agent. How the static evaluation function works. Any special considerations for Alpha-Beta pruning, such as ordering of successors best-first. Other comments on the implementation. Stochastic Simplified Backgammon Agent Who did what for this agent. Other comments on the implementation. Partnership retrospective. What issues you faced or didn't face related to the partnership. Any lessons you learned as a result of working in this partnership. Optional additional comments. (Comparing the versions, insights on the games, or on the agents, for example). |
Notes about Grading
The staff is planning to autograde parts of your code. To do this, it is likely that your files will be imported as modules by the autograder. Your agent should not automatically start running when the agent module is imported. |
Commenting your Code
Each of your Python files should begin with a multiline string that gives, on the first line, your name(s) and UWNetID(s). It should identify the file (name and purpose), and explain if it is a modified version of starter code in CSE 415 or is a new file you created from scratch. Follow reasonable commenting practice in your code. |
Files to Turn In
Here is a list of the files to include in your Canvas turn-in. Do NOT zip up the files, since that will interfere with the grading workflow. (To incentivize compliance on this, the staff will be deducting 2 points, if the files are zipped.) [uwnetid1]_[uwnetid2]_dbg_agent.py [uwnetid1]_[uwnetid2]_sbg_agent.py A3_Report.pdf |
Academic Integrity
The code you submit for this assignment must be written by you and your partner. Code copied or "borrowed" from the web or from other students is not permitted. The staff makes spot checks for violations, and when found, these are reported to the administration. |
Acknowledgements Backgammon game image courtesy of Microsoft. |
Updates and Corrections
Last edited Tuesday, Jan. 21 at 1:35 PM.
If necessary, updates and corrections will be posted here and/or mentioned in class or in
ED.
|