Skip to content

Commit eedcb3c

Browse files
author
Liming Xie
committed
add showdown for holdem
1 parent 5d6bfaa commit eedcb3c

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

dump.rdb

843 Bytes
Binary file not shown.

lib/holdem_game.js

+6-8
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ HoldemGame.prototype.dealSharedCards = function(n) {
279279

280280
room.notifyAll('deal', {
281281
deals: deals,
282-
delay: 2
282+
delay: 1
283283
});
284284
};
285285

@@ -473,13 +473,13 @@ HoldemGame.prototype.gamerMoveTurn = function(move) {
473473
if(deal_card) {
474474
setTimeout(function(){
475475
room.notify(gamer.uid, 'prompt', room.cmdsForGamer(gamer) );
476-
}, 3000);
476+
}, 1000);
477477

478478
} else {
479479
if(room.state < SHOWDOWN) {
480480
room.notify(gamer.uid, 'prompt', room.cmdsForGamer(gamer) );
481481
} else {
482-
room.gameOver();
482+
room.gamerShowDown();
483483
}
484484
}
485485

@@ -551,12 +551,10 @@ HoldemGame.prototype.simpleWin = function() {
551551
};
552552

553553
HoldemGame.prototype.gamerShowDown = function() {
554-
room.state = SHOWDOWN;
555-
556554
var room = this;
557555
var in_gamers = room.in_gamers, finals = [], gamers_bychips = [];
558556
var i, gamer, maxFive, someone_allin = false;
559-
for(i=0; i<in_gmaers.length; i++) {
557+
for(i=0; i<in_gamers.length; i++) {
560558
gamer = in_gamers[i];
561559
gamers_bychips.push( gamer );
562560

@@ -570,7 +568,7 @@ HoldemGame.prototype.gamerShowDown = function() {
570568
}
571569
}
572570

573-
final_gamers.sort( function(a,b){ return b.maxFiveRank - a.maxFiveRank; } );
571+
finals.sort( function(a,b){ return b.maxFiveRank - a.maxFiveRank; } );
574572

575573
if(someone_allin) {
576574
// if someone allin, the pot distribution will be complex
@@ -607,7 +605,7 @@ HoldemGame.prototype.gamerShowDown = function() {
607605
* 最终由CDE胜出平分本局彩池$1000时,则DE各分到$330,而多出的$10将分配给最靠近A的赢家C,C于本局可分到$340。
608606
*/
609607
for(i=0; i<finals.length-1; i++) {
610-
if(finals[i].maxFiveRank > finals[i+1].maxFinalRank) {
608+
if(finals[i].maxFiveRank > finals[i+1].maxFiveRank) {
611609
var losers = finals.splice(i+1, Number.MAX_VALUE);
612610
while(losers.length > 0) {
613611
var loser = losers.shift();

www/main.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,10 @@ function updateCmds( cmds ){
383383
switch(words[0]) {
384384
case 'range':
385385
input.attr('type', 'range');
386-
if(words[1]) input.attr('min', parseInt(words[1]));
386+
if(words[1]) {
387+
var min = parseInt(words[1]);
388+
input.attr('min', min).val(min);
389+
}
387390
if(words[2]) input.attr('max', parseInt(words[2]));
388391
break;
389392
case 'number':

wwwsrc/main.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,10 @@ function updateCmds( cmds ){
382382
switch(words[0]) {
383383
case 'range':
384384
input.attr('type', 'range');
385-
if(words[1]) input.attr('min', parseInt(words[1]));
385+
if(words[1]) {
386+
var min = parseInt(words[1]);
387+
input.attr('min', min).val(min);
388+
}
386389
if(words[2]) input.attr('max', parseInt(words[2]));
387390
break;
388391
case 'number':

0 commit comments

Comments
 (0)