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

display player state all in folded

parent 1a8501c0
......@@ -68,6 +68,19 @@ div.name-chips[disabled=disabled] {
top:0;
}
.player-state {
width:102px;
height:50px;
float:left;
position:absolute;
left: 20;
top:30;
color:darkblue;
font-family:sans-serif;
font-weight: bold;
text-align: center;
}
.holecard1 {
position:absolute;
left:0;
......
......@@ -270,7 +270,7 @@ function setActionButtons(tableState) {
amount.setAttribute("value", tableState["bettingRange"][0]);
amount.setAttribute("min", tableState["bettingRange"][0]);
amount.setAttribute("max", tableState["bettingRange"][1]);
amount.setAttribute("step", tableState["BB"]);
amount.setAttribute("step", "1");
var actions = ["fold", "bet", "call", "check"];
var availableActions = tableState["availableActions"];
for (var i = 0; i < actions.length; i++) {
......@@ -375,9 +375,15 @@ function setPlayers(players) {
namediv.text(players[i]["name"]);
setPlayerStack(players[i].chips, i + 1);
setBet(players[i].chipsOnTable, i + 1);
setState(players[i]["state"], i + 1);
}
}
function setState(state, seat) {
var stateDiv = $('#seat' + seat).children('.player-state');
stateDiv.text(state);
}
function setPlayerStack(amount, seat) {
chipsdiv = $('#seat' + seat).children('.name-chips').children('.chips');
if (amount == null)
......
......@@ -155,3 +155,12 @@ class Player:
return json.dumps({
"cards": [card.cardStr() for card in self.__cards]
})
# returns player state (all in, playing, folded)
def state(self):
if not self.__isPlaying:
return "FOLDED"
elif self.__isAllIn:
return "ALL IN"
else:
return ""
......@@ -340,6 +340,7 @@ class Table(object):
"chips": player.remainingChips,
"isActive": player.isPlaying,
"chipsOnTable": player.getChipsOnTable,
"state": player.state(),
} for player in self.players],
"holeCards": self._getHoleCards(userId),
"availableActions": self._availableActions(userId),
......
......@@ -14,6 +14,7 @@
<div class="card holecard1"></div>
<div class="card holecard2"></div>
</div>
<div class="player-state"></div>
<div class="name-chips" disabled="disabled">
<div class="player-name">Player 1</div>
<div class="chips">$1000.00</div>
......@@ -25,6 +26,7 @@
<div class="card holecard1"></div>
<div class="card holecard2"></div>
</div>
<div class="player-state"></div>
<div class="name-chips" disabled="disabled">
<div class="player-name">Player 2</div>
<div class="chips">$1000.00</div>
......@@ -37,6 +39,7 @@
<div class="card holecard1"></div>
<div class="card holecard2"></div>
</div>
<div class="player-state"></div>
<div class="name-chips" disabled="disabled">
<div class="player-name">Player 3</div>
<div class="chips">$1000.00</div>
......@@ -50,6 +53,7 @@
<div class="card holecard1"></div>
<div class="card holecard2"></div>
</div>
<div class="player-state"></div>
<div class="name-chips" disabled="disabled">
<div class="player-name">Player 4</div>
<div class="chips">$1000.00</div>
......@@ -63,6 +67,7 @@
<div class="card holecard1"></div>
<div class="card holecard2"></div>
</div>
<div class="player-state"></div>
<div class="name-chips" disabled="disabled">
<div class="player-name">Player 5</div>
<div class="chips">$1000.00</div>
......@@ -76,6 +81,7 @@
<div class="card holecard1"></div>
<div class="card holecard2"></div>
</div>
<div class="player-state"></div>
<div class="name-chips" disabled="disabled">
<div class="player-name">Player 6</div>
<div class="chips">$1000.00</div>
......
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