Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Collective risk game
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Liyao Zhu
Collective risk game
Commits
c135d7aa
Commit
c135d7aa
authored
Apr 5, 2019
by
Liyao Zhu
Browse files
Options
Downloads
Patches
Plain Diff
game build1
parent
b7fa7bb1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
game.py
+27
-1
27 additions, 1 deletion
game.py
with
27 additions
and
1 deletion
game.py
+
27
−
1
View file @
c135d7aa
...
...
@@ -9,4 +9,30 @@ import utilis
class
game
():
def
__init__
(
self
):
datamap
=
utilis
.
read
()
self
.
N
=
datamap
[
'
N
'
]
\ No newline at end of file
self
.
N
=
datamap
[
'
N
'
]
# N-Player Game
self
.
M
=
datamap
[
'
M
'
]
# Randomly choose M players to play the game (normally 2)
self
.
RF
=
datamap
[
'
RF
'
]
# Parsed number of risk function chosen for the game
self
.
alpha
=
datamap
[
'
alpha
'
]
# Loss fraction
self
.
R
=
datamap
[
'
R
'
]
# Rounds of a game
self
.
threshold
=
0
# Threshold
def
lossfrac
(
self
,
alpha
):
"""
the percentage of wealth that players are going to lose if collective-risk happens
"""
for
risk
in
range
(
0
,
1
):
return
risk
def
riskfunc
(
self
,
RF
,
contribution
,
anything
):
"""
the probability of collective-risk happening, given contribution
"""
if
RF
==
1
:
return
# probably parse more parameters here
elif
RF
==
2
:
return
1
return
0
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment