Blazor Web App for visualizing and analyzing Prisoner's dilemma battles
- Add stragy classes, that implement the IStrategy interface, to
Strategies
. They have to be defined in the namespace "Strategy". You can use sub namespaces. - Add a json file to
wwwroot/data/prisoners/
with a list of the strategies.
Example: For strategy classes Strategy.Year2023.Bear and Strategy.Tiger a file "animals.json"
[
{
"name": "Balu",
"strategy": "Year2023.Bear"
},
{
"name": "Shere Khan",
"strategy": "Tiger"
}
]
- Add a json file to
wwwroot/data/prisons/
to configure the battle parameters and refer to the prisoners json file.
Example:
zoo.json
{
"name": "Zoo",
"prisoners": "animals", # the prisoners json file without extension
"bothCooperate": 2,
"bothBetrayed": 4,
"betraying": 1,
"betrayed": 6,
"turns":50, # 0 for random
"msPerTurn": 0.5
}
- Add your new prison in
Game/PrionManager.cs
to thePrisons
dictionary:
public static readonly Dictionary<string, string> Prisons = new() {
{ "zoo", "The zoo fight" } # the prions file without extension
};