Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Menteur
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PLN
Menteur
Commits
0eb3d339
Unverified
Commit
0eb3d339
authored
Apr 26, 2020
by
PLN (Algolia)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: TODOs
parent
d3c23dfc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
0 deletions
+21
-0
TODO.md
TODO.md
+3
-0
lobby.py
server/game/lobby.py
+17
-0
ws.py
server/ws.py
+1
-0
No files found.
TODO.md
View file @
0eb3d339
# Credits
-
Byron Knoll
\ No newline at end of file
server/game/lobby.py
View file @
0eb3d339
...
@@ -153,10 +153,15 @@ class LobbyManager(ClientManager):
...
@@ -153,10 +153,15 @@ class LobbyManager(ClientManager):
extras
[
"youBet"
]
=
False
extras
[
"youBet"
]
=
False
if
message
:
if
message
:
print
(
"Creating game task..."
)
game
=
asyncio
.
create_task
(
self
.
maybe_start_game
())
game
=
asyncio
.
create_task
(
self
.
maybe_start_game
())
print
(
"Sending message..."
)
await
self
.
send
(
sender
,
message
,
extras
)
await
self
.
send
(
sender
,
message
,
extras
)
print
(
"Awaiting game..."
)
await
game
await
game
print
(
"LOBBY: Message handled."
)
def
which_player
(
self
,
sid
)
->
Player
:
def
which_player
(
self
,
sid
)
->
Player
:
sender
:
Optional
[
Player
]
=
None
sender
:
Optional
[
Player
]
=
None
for
name
,
metadata
in
self
.
metadata
.
items
():
for
name
,
metadata
in
self
.
metadata
.
items
():
...
@@ -169,6 +174,18 @@ class LobbyManager(ClientManager):
...
@@ -169,6 +174,18 @@ class LobbyManager(ClientManager):
async
def
send_waiting_for
(
self
,
player
:
Player
):
async
def
send_waiting_for
(
self
,
player
:
Player
):
game
=
self
.
game_with
(
player
)
game
=
self
.
game_with
(
player
)
# FIXME: Seems to block here, game doesn't move past Asking for...
# BET
# MSGIN| c38442e3785f4c2eb13e95368bfaa151 (Sumatran Elephant): BET.
# Lobby| Player Sumatran Elephant just announced bet=Ace of ♥|Ace of ♣|Ace of ♦|Ace of ♠.
# LOBBY: Message handled.
# received event "message" from c38442e3785f4c2eb13e95368bfaa151 [/]
# INFO: received event "message" from c38442e3785f4c2eb13e95368bfaa151 [/]
# INFO: 127.0.0.1:51452 - "POST /socket.io/?EIO=3&transport=polling&t=N6J1ZS7&sid=3c5e8962c4db465aaf2fd916bea2acc9 HTTP/1.1" 200 OK
# [WS] Message MENTEUR
# MSGIN| 3c5e8962c4db465aaf2fd916bea2acc9 (Chihuahua): MENTEUR.
# LOBBY: Message handled.
# received
await
self
.
send
(
player
,
MessageToPlayer
.
YourTurn
,
extras
=
{
"bet"
:
game
.
current_bet
.
json
()})
await
self
.
send
(
player
,
MessageToPlayer
.
YourTurn
,
extras
=
{
"bet"
:
game
.
current_bet
.
json
()})
for
p
in
[
p
for
p
in
game
.
players
if
p
!=
player
]:
for
p
in
[
p
for
p
in
game
.
players
if
p
!=
player
]:
await
self
.
send
(
p
,
MessageToPlayer
.
Waiting
,
extras
=
{
"waitingFor"
:
p
.
name
})
await
self
.
send
(
p
,
MessageToPlayer
.
Waiting
,
extras
=
{
"waitingFor"
:
p
.
name
})
server/ws.py
View file @
0eb3d339
...
@@ -26,6 +26,7 @@ class ClientPlayer(Player):
...
@@ -26,6 +26,7 @@ class ClientPlayer(Player):
print
(
f
"Asking Client {self.name} for announce..."
)
print
(
f
"Asking Client {self.name} for announce..."
)
while
not
metadata
.
last_announce
and
metadata
.
fresh_announce
:
while
not
metadata
.
last_announce
and
metadata
.
fresh_announce
:
print
(
"While, send_waiting_for"
)
await
lobby
.
send_waiting_for
(
self
)
await
lobby
.
send_waiting_for
(
self
)
print
(
f
"Still waiting for {self.name}'s announce..."
)
print
(
f
"Still waiting for {self.name}'s announce..."
)
sleep
(
2
)
sleep
(
2
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment