Question
You will implement 2 games, the Prisoner's Dilemma, The Stag Hunt and compare their results for your report. After you finish implementing everything else, you
You will implement 2 games, the Prisoner's Dilemma, The Stag Hunt and compare their results for your report. After you finish implementing everything else, you will only need to change one function to make it a prisoner's dilemma or a stag hunt game
1) main.cpp: This is the driver program that sets up the game and plays it. This is where you will call functions to print the statistics. The required statistics is percentage of players using strategy 1 (cooperate or hunt stag) after each round of game play.
2) player.h, player.cc: These files have the definition and implementation of the player class which is a node in the game board. Each player has 4 neighbors (left, right, top, bottom). You will need to implement the functions in the player class. Instructions are in the files. For example, you need to implement the function that the player uses to set his next strategy. You will need to calculate the reward in each round and then add up the reward with the lifetime total.
3) GameBoard.h and GameBoard.cc: This class uses the player class to set up the game board. The setBoard function sets up a rectangle while setBoardTorus creates a donut shaped game board. We will just use the rectangle for this analysis. Most of the functions in this class are done using arrays. You need to change it to linked list based implementation. I suggest you do so after you have finished the Player class and it is working to your satisfaction.
-Board size and shape. -- try various board sizes and shapes (rectangle, square, line are easy to do with the given code). Plot the percentage of players for each strategy with respect to the number of times the game is played
-Starting value/percentage of Cooperating players/Stag hunters. Vary the initial number of players that use the Cooperate/Stag hunt strategy and see how the number changes for consecutive games. plot the strategy vs game number.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started