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 02a5720b authored by Yildius's avatar Yildius

Can fold, call, and bet fixed amount

parent e9423438
......@@ -490,6 +490,21 @@ function foldClicked() {
function callClicked() {
$('#history').append("\n you clicked call");
var url = '/api/game/' + gameId + "/action"
console.log(url);
$.ajax({
type: 'POST',
url: url,
data: {
'name': 'call'
},
dataType: 'json',
success: function (msg) {
$("#history").text(JSON.stringify(msg))
catchUp(msg)
}
})
/*
$.ajax({
url: '/api/game/' + gameId,
method: "POST",
......@@ -501,10 +516,27 @@ function callClicked() {
$("#history").text(JSON.stringify(msg))
}
})
*/
}
function raiseClicked() {
$('#history').append("\n you clicked raise");
var url = '/api/game/' + gameId + "/action"
console.log(url);
$.ajax({
type: 'POST',
url: url,
data: {
'name': 'bet',
'amount': 2
},
dataType: 'json',
success: function (msg) {
$("#history").text(JSON.stringify(msg))
catchUp(msg)
}
})
/*
$.ajax({
url: '/api/game/' + gameId,
method: "POST",
......@@ -516,6 +548,7 @@ function raiseClicked() {
$("#history").text(JSON.stringify(msg))
}
})
*/
}
function resetTable() {
......
......@@ -59,16 +59,16 @@ class Player:
def __putMoneyOnTable(self, amount):
amountBet = 0
if self.__isAllIn:
print("Player {} is already All In".format(self.__uniqueId))
print("Player {} is already All In".format(self.__name))
return 0
if amount >= self.__chips:
print("Player {} is All In".format(self.__uniqueId))
print("Player {} is All In".format(self.__name))
self.__isAllIn = True
amountBet = self.__chips
self.__chipsOnTable += self.__chips
self.__chips = 0
else:
print("Player {} bet {}".format(self.__uniqueId, amount))
print("Player {} bet {}".format(self.__name, amount))
self.__isAllIn = False
amountBet = amount
self.__chips -= amount
......
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