Python code for game theory modeling