Coding Assignment
Game Theory Coding Assignment
• You are allowed to work alone or in a group of maximum size of 2.
• IMPORTANT - You need to write the program in Java and use the newest version of
Netbeans IDE. If you do not do this, you will get a zero for the project.
Normally, I would let you write the code in any language and IDE that you like because you would be showing
the code running on your machine. But since this is not the case you will need use Java 13 and the newest
version of Netbeans, so I can run it on my machine without an issue, thanks.
Download Netbeans here: https:
netbeans.apache.org/download/index.html
Download Java here: https:
www.oracle.com/java/technologies/javase-jdk13-downloads.html
• You must zip your entire Netbeans Project folder and upload it to canvas using the
assignment link. Important, if your group has two people in it each person must upload the
zipped project to canvas.
• If you have any questions please email and I will gladly help you. •
If you email me this project, I will not except it. Do not wait until 11:58pm to upload it. If
you are late and you email it to me your project stating, there was issues with canvas
uploading it. I will not except it. So please make sure to plan accordingly.
1) When setting up your Netbeans Project go to the File menu and select: New Project
then select “Java with Ant” with “Java Application” then click on the next button. See
figure below:
https:
www.oracle.com/java/technologies/javase-jdk13-downloads.html
https:
netbeans.apache.org/download/index.html
2) A new dialog window will appear. Please do the following:
• Set the Project Name to: “GT-SPR2020”
• Set the Create Main Class to: “app.Controller”
• Make sure that the Create Main Class checkbox is checked
The Project Location and Project Folder field are set to your machine, so they will be different
from mine. Also pay attention to the case sensitivity of “app.Controller”, see figure below.
3) Your Project should look like this in the IDE:
4) Add this header to the top of the Controller.java file. Please note that if you do not put the
header in your code, I will deduct 40% off your assignment grade.
File Header
=============================================================================
PROGRAMMER1: Your name
PANTHER ID1: Your panther ID
CLASS: Your class: example CAP4506
PROGRAMMER2: Your name
PANTHER ID2: Your panther ID
CLASS: Your class: example CAP5706
SEMESTER: The cu
ent semester: example Spring 2020
CLASSTIME: Your COP2210 course meeting time :example T/TH 9:00-10:15 am
Project: Description of project
DUE: Sunday, April 19, 2025
CERTIFICATION: I certify that this work is my own and that
none of it is the work of any other person.
=============================================================================
------------------------------------
------------------------------------
------------------------------------
------------------------------------
------------------------------------
------------------------------------
------------------------------------
------------------------------------
What your code should do when running:
1) Your code should ask the user for input to run in Random or Manual mode. Next, regardless
of the mode the user entered the code ask the user for the number of rows and columns of the
normal form. Your code should be able to handle sizes of 1x1 to 9x9 without any display issues. I
will be checking this.
Example:
Enter (R)andom or (M)anual payoffs enteries
R
Enter the number of rows: 5
Enter the number of cols: 7
RANDOM MODE
2) If the random mode is selected the application will display the strategy spaces and payoffs of
players 1 and 2. Note in random mode the random payoffs are integers that range from -99 to
99.
Example:
Player: Player1's strategies
{A1, A2, A3, A4, A5}
Player: Player1's payoffs
-79, 54, 33, 55, -27, 32, -97
59, -98, -59, -96, 41, 37, 46
19, -25, 89, -64, 54, -98, 91
14, 45, -59, 50, -5, 83, -48
28, 32, 33, -75, -13, -50, 44
Player: Player2's strategies
{B1, B2, B3, B4, B5, B6, B7}
Player: Player2's payoffs
-92, -6, 78, -60, -69, 2, 82
64, -56, -77, -71, -19, -81, -14
-8, -88, -69, -93, -42, -95, 23
-95, 49, 25, -31, -18, 18, 75
-11, -40, -10, -76, -22, 76, 75
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
3) The application will display the normal form of the game. Make sure your code can handle
normal forms of size 1x1 to 9x9 without alignment issues. Notice that player1 strategies are
dynamically name A1, A2 … and for player2 B1, B2 …
Example:
=======================================
Display Normal Form
=======================================
B1 B2 B3 B4 B5 B6 B7
A1 | (-79,-92) | ( 54,-6 ) | ( 33,78 ) | ( 55,-60) | (-27,-69) | ( 32,2 ) | (-97,82 ) |
A2 | ( 59,64 ) | (-98,-56) | (-59,-77) | (-96,-71) | ( 41,-19) | ( 37,-81) | ( 46,-14) |
A3 | ( 19,-8 ) | (-25,-88) | ( 89,-69) | (-64,-93) | ( 54,-42) | (-98,-95) | ( 91,23 ) |
A4 | ( 14,-95) | ( 45,49 ) | (-59,25 ) | ( 50,-31) | ( -5,-18) | ( 83,18 ) | (-48,75 ) |
A5 | ( 28,-11) | ( 32,-40) | ( 33,-10) | (-75,-76) | (-13,-22) | (-50,76 ) | ( 44,75 ) |
4) Display the Pure Nash Equili
ium by replacing the numerical value of the best response by
an ‘H’ in the normal form. Also output the Pure Nash Equili
ium(s). If there is no Pure Nash
Equili
ium still output the normal form with replacing the numerical value of the best
esponse by an ‘H’ and stated there are no Pure Nash Equili
ium.
Example:
=======================================
Nash Pure Equili
ium Locations
=======================================
B1 B2 B3 B4 B5 B6 B7
A1 | (-79,-92) | ( H,-6 ) | ( 33,78 ) | ( H,-60) | (-27,-69) | ( 32,2 ) | (-97,H ) |
A2 | ( H,H ) | (-98,-56) | (-59,-77) | (-96,-71) | ( 41,-19) | ( 37,-81) | ( 46,-14) |
A3 | ( 19,-8 ) | (-25,-88) | ( H,-69) | (-64,-93) | ( H,-42) | (-98,-95) | ( H,H ) |
A4 | ( 14,-95) | ( 45,49 ) | (-59,25 ) | ( 50,-31) | ( -5,-18) | ( H,18 ) | (-48,H ) |
A5 | ( 28,-11) | ( 32,-40) | ( 33,-10) | (-75,-76) | (-13,-22) | (-50,H ) | ( 44,75 ) |
Nash Pure Equili
ium(s): (A2, B1) (A3, B7)
----------------------------------------------
----------------------------------------------
-------------------------------------------
-------------------------------------------
----------------------------------------------
----------------------------------------------
-------------------------------------------
-------------------------------------------
------------------------------------------------------
------------------------------------------------------
4) Create random beliefs then calculate the Expected Payoffs and Best Response(s) for players 1
and 2. Pay attention to the formatting and notation of your output.
Example:
Player 1 Expected Payoffs with Player 2 Mixing
U(A1,(0.12, 0.18, 0.01, 0.19, 0.08,