FUN WITH THE EVOLUTION OF COOPERATION Math 3343 - Homework 6 Let's Play a Game of Evolution We play on a rectangular Mx N game board, where each entry represents a player. Each player is either loyal (denoted L), or a traitor (denoted T). Each square plays the prisoners dilemma with its 8 neighbors and itself, and receives as it's score the sum of the years of freedom gained in its 9 games. Prisoners dilema game L vs L each receives a score of 1. L vs T, player receive a score of O and player T receives a score of b. .Tvs T, each receives a score of 0. Since, in our game, each square plays 9 games, the score in our game is the sum of the 9 scores. So for example, if b = 2, then the gameboard TTT 2 44 T L L has as it's scores 6 5 4 LLL 3 5 4 Since this is a game of evolution, the players at each square evolve. Each player sees whether its neighbor fared better than itself. We will assume that, as rational players, each one assumes the strategy of its most successful neighbor. Thus, the next evolution of that 3 x 3 grid would be TTL T T L TTL We will then illustrate the state and movement of the board as follows: Illustrate each square as blue if I remains L. Illustrate each square as red if T remains T. Illustrate each square as yellow if L becomes T. . Illustrate each square as green if I becomes L. We will assume that players on the edge have as it's neighbors the entries in the corresponding entries of the opposite side, as if the board was wrapped into a cylinder in the north-south direction and the east-west direction. Opposite corners are neighbors of opposite comers. Your Assignment 1. (50 points) Implement the game of evoluation as a Matlab function that uses the following input and output Input M-A matrix of size p xq with entries equal to 0 or 1 to represent the initial state of the game. mariter - A maximum number of evolution cycles. . b. The maximum score of each prisoners dilemma game. Output An animation of the board evolution is illustrated. The first line of your code should therefore read function game of evolution (M,maxiter,b) Note/Bonus: Posted to the blackboard website is the code newboard.p, which is utilized: Mnew - newboard (M.s). It takes as input the current board (M) and scoreboard (S), and returns the new board (Mnew) according to the games rules. However if you can complete the homework without using this, you will receive 10 bonus points on this assignment. If you can recreate this component without any for (or while loops, you will receive 25 bonus points on this assignment. 2. (40 points) Create a script titled Hw6.m that runs the following two evolution games. . Using b = 1.9, illustrate 1000 iterations of a 101 x 101 game board where every player is initially loyal except for the one player at the center (51,51) position. = 1.9, illustrate 1000 iterations of a 101 x 101 game board where every player is loyal except for a set of 10 randomly distributed 3 x 3 clusters of entries randomly assigned to be loyal or a traitor (but with equal probability). For each run, play the script for a friend or family member, then save the final board configuration plot (image) and include it in your write-up. 3. (10 points) Describe the evolution of both games boards. (Is the single traitor an infectious strategy? Does one strategy dominate the game? Do any patterns emerge?) FUN WITH THE EVOLUTION OF COOPERATION Math 3343 - Homework 6 Let's Play a Game of Evolution We play on a rectangular Mx N game board, where each entry represents a player. Each player is either loyal (denoted L), or a traitor (denoted T). Each square plays the prisoners dilemma with its 8 neighbors and itself, and receives as it's score the sum of the years of freedom gained in its 9 games. Prisoners dilema game L vs L each receives a score of 1. L vs T, player receive a score of O and player T receives a score of b. .Tvs T, each receives a score of 0. Since, in our game, each square plays 9 games, the score in our game is the sum of the 9 scores. So for example, if b = 2, then the gameboard TTT 2 44 T L L has as it's scores 6 5 4 LLL 3 5 4 Since this is a game of evolution, the players at each square evolve. Each player sees whether its neighbor fared better than itself. We will assume that, as rational players, each one assumes the strategy of its most successful neighbor. Thus, the next evolution of that 3 x 3 grid would be TTL T T L TTL We will then illustrate the state and movement of the board as follows: Illustrate each square as blue if I remains L. Illustrate each square as red if T remains T. Illustrate each square as yellow if L becomes T. . Illustrate each square as green if I becomes L. We will assume that players on the edge have as it's neighbors the entries in the corresponding entries of the opposite side, as if the board was wrapped into a cylinder in the north-south direction and the east-west direction. Opposite corners are neighbors of opposite comers. Your Assignment 1. (50 points) Implement the game of evoluation as a Matlab function that uses the following input and output Input M-A matrix of size p xq with entries equal to 0 or 1 to represent the initial state of the game. mariter - A maximum number of evolution cycles. . b. The maximum score of each prisoners dilemma game. Output An animation of the board evolution is illustrated. The first line of your code should therefore read function game of evolution (M,maxiter,b) Note/Bonus: Posted to the blackboard website is the code newboard.p, which is utilized: Mnew - newboard (M.s). It takes as input the current board (M) and scoreboard (S), and returns the new board (Mnew) according to the games rules. However if you can complete the homework without using this, you will receive 10 bonus points on this assignment. If you can recreate this component without any for (or while loops, you will receive 25 bonus points on this assignment. 2. (40 points) Create a script titled Hw6.m that runs the following two evolution games. . Using b = 1.9, illustrate 1000 iterations of a 101 x 101 game board where every player is initially loyal except for the one player at the center (51,51) position. = 1.9, illustrate 1000 iterations of a 101 x 101 game board where every player is loyal except for a set of 10 randomly distributed 3 x 3 clusters of entries randomly assigned to be loyal or a traitor (but with equal probability). For each run, play the script for a friend or family member, then save the final board configuration plot (image) and include it in your write-up. 3. (10 points) Describe the evolution of both games boards. (Is the single traitor an infectious strategy? Does one strategy dominate the game? Do any patterns emerge?)