Update PyServer's add_tic_tac_toe method
parent
f9911507f4
commit
add05bc761
2
main.py
2
main.py
|
|
@ -20,7 +20,7 @@ def main():
|
||||||
import_name=__name__,
|
import_name=__name__,
|
||||||
)
|
)
|
||||||
|
|
||||||
player.add_tic_tac_toe({}, play_tic_tac_toe)
|
player.add_tic_tac_toe(on_move=play_tic_tac_toe, profile={})
|
||||||
|
|
||||||
player.start(port=5001)
|
player.start(port=5001)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -170,11 +170,15 @@ class PyServer:
|
||||||
# Add profile data
|
# Add profile data
|
||||||
self.__games[name] = profile
|
self.__games[name] = profile
|
||||||
|
|
||||||
def add_tic_tac_toe(self, profile: PayloadType, on_move: GameHandler) -> None:
|
def add_tic_tac_toe(self, on_move: GameHandler, profile: PayloadType = {}) -> None:
|
||||||
"""
|
"""
|
||||||
Convenience registration for tic-tac-toe.
|
Convenience registration for tic-tac-toe.
|
||||||
|
|
||||||
The game is exposed at `/tic-tac-toe`.
|
The game is exposed at `/tic-tac-toe`.
|
||||||
|
|
||||||
|
:param profile: The player's custom profile.
|
||||||
|
:type profile: dict[str, Any]
|
||||||
|
:param on_move:
|
||||||
"""
|
"""
|
||||||
self.add_game(
|
self.add_game(
|
||||||
name="tic-tac-toe",
|
name="tic-tac-toe",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue