PPBDP Network Simulator
Probabilistic Peer-punishment Based on the Difference of Payoff Network Simulator
This JavaScript based simulator can execute the basic model of the following study.
Ohdaira, T.,Evolution of cooperation by the introduction of the probabilistic peer-punishment based on the difference of payoff. Scientific Reports (Nature Publishing Group), vol.6, art. no.25413, doi: 10.1038/srep25413, 2016. [Link]
Usage
Select network type (Regular, Random, or Scale-free).
Select punishment type (PPBDP or NoPunish).
Click "Build Network".
Click "Start Simulation".
Notes
The average degree of the network is 4, and the network is consist of 1,000 players (nodes).
In the case of Random and Scale-free, the network property will change every time when clicking "Build Network" and is not the same as that of the above paper.
In the case of no punishment, punishers simply mean cooperators.
One simulation run is 300 timesteps, and 3 simulation runs will be executed by one click.
You can restart simulation on the same network by clicking "Start Simulation" after 3 simulation runs.
In each simulation run, you can click "Dynamic Draw On / OFF", and then every player on the network will be dynamically placed based on the spring-based graph layout algorithm (Eades spring model* with friction force).
* Eades, P., A heuristic for graph drawing. Congressus Numerantium, vol.42, pp.149-160, 1984.
In this "Dynamic Draw On" mode, you can arbitrarily choose (click) a player, move him/her according to the mouse cursor, and release him/her by right-click.
You can download the result csv file from "Result CSV File Output" link and also the adjacency matrix csv file from "Adjacency Matrix CSV File Output" link.
When you want to change the network type, click "Reset" and then return to the step 1.
Any questions or comments are welcome. Please send your comments by email (to: tetsushi77 [at] gmail.com).
Acknowledgements
I acknowledge the following websites in Japanese (accessed on February 27th, 2022) for the useful information regarding the creation of this JavaScript based simulator.
MDN Web Docs - Element.getBoundingClientRect() - Web API
https://developer.mozilla.org/ja/docs/Web/API/Element/getBoundingClientRectMDN Web Docs - Event.preventDefault() - Web API
https://developer.mozilla.org/ja/docs/Web/API/Event/preventDefaultMDN Web Docs - Math.exp() - JavaScript
https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Math/expMDN Web Docs - Math.pow() - JavaScript
https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Math/powMDN Web Docs - WindowOrWorkerGlobalScope.setTimeout() - Web API
https://developer.mozilla.org/ja/docs/Web/API/setTimeoutMDN Web Docs - マウス操作 - ゲーム開発
https://developer.mozilla.org/ja/docs/Games/Tutorials/2D_Breakout_game_pure_JavaScript/Mouse_controlsMDN Web Docs - 高度なアニメーション - Web API
https://developer.mozilla.org/ja/docs/Web/API/Canvas_API/Tutorial/Advanced_animationsMDN Web Docs - 文字を描く - Web API
https://developer.mozilla.org/ja/docs/Web/API/Canvas_API/Tutorial/Drawing_text