Homework Four

Adversarial Search

out 10/8, due 10/17

(1) Minimax and Alpha-Beta (10)

In the game trees in this problem, the value of the static evaluator functions is show for the leaves. Squares are maximizing nodes and circles minimizing nodes.

1.2 For this game tree, use the minimax algorithm to compute a value for each non-leaf node. Squares represent max nodes and circles represent min nodes. Indicate which move the maximizing player should make.

1.2 Simulate the alpha-beta algorithm on this game tree, crossing out the nodes that are pruned. For each non-leaf node that is not pruned, show the exact value (e.g., =3) or the last constraint (e.g., <=2, >=8) that the alpha-beta algorithm determines.

 

(2) Game characteristics (30)

For each of the following statements, say whether it is true or false and provide a short (e.g. one paragraph) justification for your answer.

2.1. Given a two-player, turn-taking, zero-sum, fully observable game between two perfectly rational players, it does not help the first player's outcome to know what strategy the second player is using -- that is, what move the second player will make, given the first playerÂ’s move.

2.2. Given a two-player, turn-taking, zero-sum, partially observable game between two perfectly rational players, it does not help the first player to know what move the second player will make, given the first playerÂ’s move.

2.3. A perfectly rational backgammon-playing agent with unlimited resources never loses.

(3) Three person games (20)

The games we discussed in class have only two players. Assume we have a perfect-information, deterministic game that has three players A, B and C who alternate taking turns -- first A, then B, then C, then A, ... The game will result in one winner and two losers. A fellow student suggests modifying the minimax procedure to work for such a game.

Based on information specific to each player, we have three independent static evaluation functions, Fa , Fb and Fc that are associated with players A, B and C, respectively. Each function indicates the estimated value of a board position with respect to that player. For example, Fa(p)=-5 means that position p is not good for player A, whereas Fa(p)=100 means that position p looks very good for player A. At each leaf node n in the look-ahead minimax tree, we compute a triple of values (Fa(n), Fb(n), Fc(n)). At the level corresponding to A's choice, the value to be backed up is the triple which maximizes A's components. Similarly f or B and C.

3.1 Using this scheme, what are the backed-up values that should be computed for the following game tree, where the root corresponds to player A's turn, nodes at depth one are positions where it's player B's turn, etc.

3.2 Identify and briefly discuss at least two problems with this approach, i.e., potential aspects of a three person game which this modification of minimax does not deal with.

(4) Nim (40)

The AIMA book's Python code games.py has a generic framework for multi-player deterministic games along with examples for Tic-Tac-Toe and Connect Four. Use this framework to implement a game and players for the simple game Nim. Nim has been used as an exercise for computer programs for a long time -- see this short article on an electronic Nim playing device from the New Yoker from 1952.

Nim is a simple two-person, turn-taking fully-observable game in which the two players take turns removing objects such as coins or sticks, from a set of distinct heaps. On each turn, a player must remove at least one object, and may remove any number of objects provided they all come from the same heap. The last player to take an object wins, i.e., the player who is left without a move loses.

Nim has been completely solved for any number of initial heaps and objects, e.g., in games with heaps of three, four, and five, the first player will win with optimal play.

Your representation should be able to support games with any non-zero number of heaps with an arbitrary number of initial objects. For example, you should be able to handle a game of Nim with three heaps that initially contain seven, six and five objects.

We will provide a stub file and advice on how to approach this as well as details on how you should test and demonstrate your program later.

ADDED 10/10: See the hw4/code directory for the stub file and the two AIMA Python modules you will need for your program. The slides on problem four we covered in class Wednesday are here: ppt, pdf. If should implement a player for the AIMA frame work but are more than welcome to also implement other players that don't use it. You can extend the PLAYER dictionary in nimstub.py to map comand-line args to those functions and demonstrate playing them against some of the alpah-beta players.

What to hand in

Submit in your assignment via cvs by 23:59:50 on Wednesday, October 17 3. It should consist of readme.txt, hw4.txt or .pdf, and nim.py. If you are unable to produce an electronic version of your answers for problem one, you can had it in on hardcopy in class on October 17. In emergencies, mail your assignment as a zip or gzip file to cmsc671hw@cs.umbc.edu.