###### GS 2000/Math - Collins
Lab 7
Game Theory

```In this lab you will play a game against the computer and try to
develop a winning strategy.

Gamebot

Save this MATLAB function gamebot.m.
To play a game using Gamebot, you just type gamebot
and then it will ask you for a payoff matrix and a
strategy vector for Player 2.  You will play as Player 1.
Then you get to play the game repeatedly, and Gamebot keeps
track of the payoffs and other statistics.  Use 0 as your
choice to end the game.

Example (what you type is in bold)

gamebot
Enter payout matrix: [2 -2;-2 4]
Strategy vector for Player 2: [1/2 1/2]
Enter 0 for your choice to end the game.
Computer chooses 1 for a payout of 2.
Number of games: 1  Avg. Payout: 2
.
.
Computer chooses 1 for a payout of -2.
Number of games: 50  Avg. Payout: -0.16
Strategy used by Player 1: 0.7  0.3

Note the strategy reported is the probability for me
choosing each choice, i.e. my strategy vector

Mora

For Mora the payout matrix is [2 -2;-2 4]

The plays for Player 1 and for Player 2 are:  1  or 2

Play against the gamebot, with Player 2 having the strategy:

(a) [1/2, 1/2]
(b) [3/4, 1/4]
(c) [3/5, 2/5]

Play at least 20 games against each strategy and try to develop a
winning strategy for Player 1.

E-mail me your best strategy in each case. ccollins@math.utk.edu

Mountain City Siege

For Mountain City Siege the payout matrix is
[3 1 0 -1;0 2 -1 -2; -3 1 1 -3; -2 -1 2 0; -1 0 1 3]

The plays for Player 1 are: 1=(4,0), 2=(3,1), 3=(2,2), 4=(1,3), 5=(0,4)
and for Player 2: 1=(3,0), 2=(2,1), 3=(1,2), 4=(0,3)

Play against the gamebot, with Player 2 having the strategy:

(a) [1/4 1/4 1/4 1/4]
(b) [1/18, 4/9, 4/9, 1/18]

Play at least 20 games against each strategy and try to develop a
winning strategy for Player 1.

E-mail me your best strategy in each case. ccollins@math.utk.edu

Challenge

Write a MATLAB program which accepts the payout matrix and
the strategy vectors for Players 1 and 2 and determines the
average payoff (called the value).

```
ccollins@math.utk.edu