Spaces:
Sleeping
Sleeping
Upload 6 files
Browse files- games/connect_four.py +16 -0
- games/kuhn_poker.py +16 -0
- games/matching_pennies.py +16 -0
- games/matrix_pd.py +16 -0
- games/matrix_rps.py +16 -0
- games/prisoners_dilemma.py +17 -0
games/connect_four.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""A module for loading and handling the Connect Four game logic.
|
2 |
+
|
3 |
+
This module uses OpenSpiel's implementation of the Connect Four game. It provides
|
4 |
+
utility functions to set up and retrieve the game instance, which can be used by
|
5 |
+
the simulation framework to simulate gameplay.
|
6 |
+
"""
|
7 |
+
|
8 |
+
import pyspiel
|
9 |
+
|
10 |
+
def get_connect_four_game():
|
11 |
+
"""Load the Connect Four game instance.
|
12 |
+
|
13 |
+
Returns:
|
14 |
+
pyspiel.Game: The Connect Four game instance from OpenSpiel.
|
15 |
+
"""
|
16 |
+
return pyspiel.load_game("connect_four")
|
games/kuhn_poker.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""A module for loading and handling the Kuhn Poker game logic.
|
2 |
+
|
3 |
+
This module uses OpenSpiel's implementation of the Kuhn Poker game. It provides
|
4 |
+
utility functions to set up and retrieve the game instance, which can be used by
|
5 |
+
the simulation framework to simulate gameplay.
|
6 |
+
"""
|
7 |
+
|
8 |
+
import pyspiel
|
9 |
+
|
10 |
+
def get_kuhn_poker_game():
|
11 |
+
"""Load the Kuhn Poker game instance.
|
12 |
+
|
13 |
+
Returns:
|
14 |
+
pyspiel.Game: The Kuhn Poker game instance from OpenSpiel.
|
15 |
+
"""
|
16 |
+
return pyspiel.load_game("kuhn_poker")
|
games/matching_pennies.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""A module for loading and handling the Matching Pennies (3-player) game logic.
|
2 |
+
|
3 |
+
This module uses OpenSpiel's implementation of the Matching Pennies (3-player) game.
|
4 |
+
It provides utility functions to set up and retrieve the game instance, which can be
|
5 |
+
used by the simulation framework to simulate gameplay.
|
6 |
+
"""
|
7 |
+
|
8 |
+
import pyspiel
|
9 |
+
|
10 |
+
def get_matching_pennies_game():
|
11 |
+
"""Load the Matching Pennies (3-player) game instance.
|
12 |
+
|
13 |
+
Returns:
|
14 |
+
pyspiel.Game: The Matching Pennies (3-player) game instance from OpenSpiel.
|
15 |
+
"""
|
16 |
+
return pyspiel.load_game("matching_pennies_3p")
|
games/matrix_pd.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""A module for loading and handling the Matrix Prisoner's Dilemma game logic.
|
2 |
+
|
3 |
+
This module uses OpenSpiel's implementation of the Matrix Prisoner's Dilemma (PD)
|
4 |
+
game. It provides utility functions to set up and retrieve the game instance, which
|
5 |
+
can be used by the simulation framework to simulate gameplay.
|
6 |
+
"""
|
7 |
+
|
8 |
+
import pyspiel
|
9 |
+
|
10 |
+
def get_matrix_pd_game():
|
11 |
+
"""Load the Matrix Prisoner's Dilemma game instance.
|
12 |
+
|
13 |
+
Returns:
|
14 |
+
pyspiel.Game: The Matrix PD game instance from OpenSpiel.
|
15 |
+
"""
|
16 |
+
return pyspiel.load_game("matrix_pd")
|
games/matrix_rps.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""A module for loading and handling the Matrix Rock-Paper-Scissors game logic.
|
2 |
+
|
3 |
+
This module uses OpenSpiel's implementation of the Matrix Rock-Paper-Scissors (RPS)
|
4 |
+
game. It provides utility functions to set up and retrieve the game instance, which
|
5 |
+
can be used by the simulation framework to simulate gameplay.
|
6 |
+
"""
|
7 |
+
|
8 |
+
import pyspiel
|
9 |
+
|
10 |
+
def get_matrix_rps_game():
|
11 |
+
"""Load the Matrix Rock-Paper-Scissors game instance.
|
12 |
+
|
13 |
+
Returns:
|
14 |
+
pyspiel.Game: The Matrix RPS game instance from OpenSpiel.
|
15 |
+
"""
|
16 |
+
return pyspiel.load_game("matrix_rps")
|
games/prisoners_dilemma.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""A module for loading and handling the Iterated Prisoner's Dilemma game logic.
|
2 |
+
|
3 |
+
This module uses OpenSpiel's implementation of the Python Iterated Prisoner's Dilemma
|
4 |
+
game. It provides utility functions to set up and retrieve the game instance, which can
|
5 |
+
be used by the simulation framework to simulate gameplay.
|
6 |
+
"""
|
7 |
+
|
8 |
+
import pyspiel
|
9 |
+
|
10 |
+
def get_prisoners_dilemma_game():
|
11 |
+
"""Load the Python Iterated Prisoner's Dilemma game instance.
|
12 |
+
|
13 |
+
Returns:
|
14 |
+
pyspiel.Game: The Iterated Prisoner's Dilemma game instance from OpenSpiel.
|
15 |
+
"""
|
16 |
+
return pyspiel.load_game("python_iterated_prisoners_dilemma")
|
17 |
+
|