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 6cdb8ae6 authored by Arnaud Chevalier's avatar Arnaud Chevalier

refactor of table and other classe in a more object oriented style

parent 1111df65
......@@ -2,7 +2,6 @@ var server;
var gameId = window.location.href.substring((window.location.origin + window.location.pathname).length + 8);
function catchUp(tableState) {
setBoard(tableState.boardCards);
setHoleCards(tableState.holeCards, tableState.players);
setPlayers(tableState.players);
......
from flask_socketio import SocketIO
class Game:
def __init__(self, table, server):
self.table = table
......
......@@ -24,8 +24,8 @@ class Player:
self.__hasHadAction = bool(False)
self.__state = PlayerState.PLAYING
self.__name = name
self.potId = -1
self.won = False
self.__potId = -1
self.__won = False
# GETTERS & SETTERS
@property
......@@ -68,6 +68,22 @@ class Player:
def name(self):
return self.__name
@property
def potId(self):
return self.__potId
@potId.setter
def potId(self, id):
self.__potId = id
@property
def won(self):
return self.__won
@won.setter
def won(self, won):
self.__won = won
def isComparable(self):
return self.__hand.isLoaded()
......@@ -99,7 +115,7 @@ class Player:
self.__state = PlayerState.BUSTED
self.__hand = Hand()
self.potIt = -1
self.won = False
self.__won = False
# self.__position = pos # Players are caracterized by uid, no need ATM
def computeHand(self, boardCards):
......
This diff is collapsed.
......@@ -12,7 +12,7 @@
<div id="newGame">
<article>Choose a playing mode</article>
<label><input type="radio" name="mode" value="0" checked>
Game</label>
Cash game</label>
<br>
<label>
<input type="radio" name="mode" value="1">
......
......@@ -21,36 +21,36 @@ t.addPlayer(player5)
t.startHand()
print(t.players[0].hasHadAction)
print(t.players[1].hasHadAction)
print(t.players[2].hasHadAction)
print(len(t.players))
print(t.__players[0].hasHadAction)
print(t.__players[1].hasHadAction)
print(t.__players[2].hasHadAction)
print(len(t.__players))
t.call(t.activePlayer)
t.call(t.__activePlayer)
t.fold(t.activePlayer)
t.fold(t.__activePlayer)
t.call(t.activePlayer)
t.call(t.__activePlayer)
t.call(t.activePlayer)
t.call(t.__activePlayer)
t.bet(t.activePlayer, 4)
t.bet(t.__activePlayer, 4)
t.call(t.activePlayer)
t.call(t.__activePlayer)
t.fold(t.activePlayer)
t.fold(t.__activePlayer)
t.call(t.activePlayer)
t.call(t.__activePlayer)
t.bet(t.activePlayer, 5)
t.bet(t.__activePlayer, 5)
t.call(t.activePlayer)
t.call(t.__activePlayer)
t.call(t.activePlayer)
t.call(t.__activePlayer)
t.bet(t.activePlayer, 5)
t.bet(t.__activePlayer, 5)
t.call(t.activePlayer)
t.call(t.__activePlayer)
t.call(t.activePlayer)
t.call(t.__activePlayer)
......@@ -21,54 +21,54 @@ t.addPlayer(player5)
t.startHand()
print(t.players[0].hasHadAction)
print(t.players[1].hasHadAction)
print(t.players[2].hasHadAction)
print(len(t.players))
print(t.__players[0].hasHadAction)
print(t.__players[1].hasHadAction)
print(t.__players[2].hasHadAction)
print(len(t.__players))
t.bet(t.activePlayer, 3)
t.bet(t.activePlayer, 4)
t.bet(t.activePlayer, 5)
t.bet(t.activePlayer, 6)
t.bet(t.activePlayer, 7)
t.bet(t.activePlayer, 8)
t.call(t.activePlayer)
t.call(t.activePlayer)
t.call(t.activePlayer)
t.call(t.activePlayer)
t.bet(t.activePlayer, 3)
t.bet(t.activePlayer, 4)
t.bet(t.activePlayer, 5)
t.bet(t.activePlayer, 6)
t.bet(t.activePlayer, 7)
t.call(t.activePlayer)
t.call(t.activePlayer)
t.call(t.activePlayer)
t.call(t.activePlayer)
t.bet(t.activePlayer, 3)
t.bet(t.activePlayer, 4)
t.bet(t.activePlayer, 5)
t.bet(t.activePlayer, 6)
t.bet(t.activePlayer, 7)
t.call(t.activePlayer)
t.call(t.activePlayer)
t.call(t.activePlayer)
t.call(t.activePlayer)
t.bet(t.activePlayer, 3)
t.bet(t.activePlayer, 4)
t.bet(t.activePlayer, 5)
t.bet(t.activePlayer, 6)
t.bet(t.activePlayer, 7)
t.bet(t.activePlayer, 8)
t.bet(t.activePlayer, 9)
t.bet(t.activePlayer, 10)
t.bet(t.activePlayer, 11)
t.bet(t.activePlayer, 12)
t.bet(t.__activePlayer, 3)
t.bet(t.__activePlayer, 4)
t.bet(t.__activePlayer, 5)
t.bet(t.__activePlayer, 6)
t.bet(t.__activePlayer, 7)
t.bet(t.__activePlayer, 8)
t.call(t.__activePlayer)
t.call(t.__activePlayer)
t.call(t.__activePlayer)
t.call(t.__activePlayer)
t.bet(t.__activePlayer, 3)
t.bet(t.__activePlayer, 4)
t.bet(t.__activePlayer, 5)
t.bet(t.__activePlayer, 6)
t.bet(t.__activePlayer, 7)
t.call(t.__activePlayer)
t.call(t.__activePlayer)
t.call(t.__activePlayer)
t.call(t.__activePlayer)
t.bet(t.__activePlayer, 3)
t.bet(t.__activePlayer, 4)
t.bet(t.__activePlayer, 5)
t.bet(t.__activePlayer, 6)
t.bet(t.__activePlayer, 7)
t.call(t.__activePlayer)
t.call(t.__activePlayer)
t.call(t.__activePlayer)
t.call(t.__activePlayer)
t.bet(t.__activePlayer, 3)
t.bet(t.__activePlayer, 4)
t.bet(t.__activePlayer, 5)
t.bet(t.__activePlayer, 6)
t.bet(t.__activePlayer, 7)
t.bet(t.__activePlayer, 8)
t.bet(t.__activePlayer, 9)
t.bet(t.__activePlayer, 10)
t.bet(t.__activePlayer, 11)
t.bet(t.__activePlayer, 12)
t.fold(t.activePlayer)
t.call(t.activePlayer)
t.fold(t.activePlayer)
t.call(t.activePlayer)
t.fold(t.__activePlayer)
t.call(t.__activePlayer)
t.fold(t.__activePlayer)
t.call(t.__activePlayer)
......
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