Ce serveur Gitlab sera éteint le 30 juin 2020, pensez à migrer vos projets vers les serveurs gitlab-research.centralesupelec.fr et gitlab-student.centralesupelec.fr !

Commit ec70947a authored by Arnaud Chevalier's avatar Arnaud Chevalier

table state for server application

parent 5cf0c6bd
import requests
def getState:
\ No newline at end of file
......@@ -17,6 +17,7 @@ class Player:
self.__hasHadAction = bool(False)
self.__isPlaying = bool(False)
self.__isAllIn = bool(False)
self.__name = ""
def isPlaying(self):
......@@ -45,6 +46,10 @@ class Player:
def isAllIn(self):
return self.__isAllIn
def name(self):
return self.__name
def __putMoneyOnTable(self, amount):
if self.__isAllIn:
from flask import Flask
app = Flask()
import table
game = table.Table()
app = Flask()
game = table.Table()
@app.route("/game/") # TODO: add game ID
def gamestate():
def gameState():
response = app.response_class(
response = game.state(),
return response
@app.route("/game/action", methods=["POST"] ) # TODO: add GET posssible actions
@app.route("/game/action", methods=["POST"]) # TODO: add GET posssible actions
def action():
return response
......@@ -201,16 +201,25 @@ class Table(object):
print("Cant bet, action currently to player {}".format(self.activePlayer))
return False
# not ready yet
# State Table
def state(self):
"pot": self.pot,
"activePlayer": self.activePlayer,
"BB": self.blind,
"SB": self.smallBlind,
"button": self.button,
"boardCards": self.boardCards,
"currentBet": self.currentBet,
"handNbr": self.handNbr,
"gameState": self.gameState,
"players": [{
"name": player.name,
"chips": player.chips,
"isActive": player.isActive
"isActive": player.isActive,
"chipsOnTable": player.getChipsOnTable,
"uniqueId": player.uniqueId,
} for player in self.players]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment