Skip to content

Commit d8fda72

Browse files
author
Jamezs Gladney
committed
progress, weird AI data passing
1 parent 1b114e2 commit d8fda72

3 files changed

Lines changed: 137 additions & 116 deletions

File tree

server/ai-instance.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ function DuelConnection(roompass) {
533533
duelConnections.end();
534534
});
535535
duelConnections.on('data', function (data) {
536-
console.log('data');
536+
//console.log('data');
537537

538538
});
539539
return duelConnections;
@@ -560,13 +560,17 @@ function CommandParser(state, network) {
560560
eventEmitter = new events.EventEmitter();
561561

562562
return function (input) {
563-
console.log('trying', input);
563+
if (!input.STOC_GAME_MSG) {
564+
console.log('trying', input);
565+
}
566+
564567
if (input.STOC_UNKNOWN) {
565568
responseRequired = false;
566569
//bug this command is never to be hit.
567570
}
568571
if (input.STOC_GAME_MSG) {
569572
//case deeper, actuall gameplay
573+
console.log(input);
570574
switch (input.STOC_GAME_MSG.command) {
571575
case ('MSG_HINT'):
572576
break;
@@ -620,6 +624,7 @@ function CommandParser(state, network) {
620624
break;
621625

622626
case ('MSG_SELECT_IDLECMD'):
627+
console.log(input);
623628
break;
624629

625630
case ('MSG_MOVE'):
@@ -680,7 +685,13 @@ function CommandParser(state, network) {
680685
}
681686
if (input.STOC_HAND_RESULT) {
682687
responseRequired = false;
683-
network.write(makeCTOS('CTOS_TP_RESULT', 0));
688+
689+
if (input.res1 === input.res2) {
690+
network.write(makeCTOS('CTOS_HAND_RESULT', rps()));
691+
} else {
692+
network.write(makeCTOS('CTOS_TP_RESULT', 0));
693+
}
694+
684695
//get hand result
685696
}
686697
if (input.STOC_TP_RESULT) {
@@ -730,6 +741,7 @@ function CommandParser(state, network) {
730741
//player name enterd in slot
731742

732743
}
744+
733745
if (input.STOC_HS_PLAYER_CHANGE) {
734746
//player slot update
735747
//state.lobby[input.loc] = input.player;
@@ -748,6 +760,7 @@ function CommandParser(state, network) {
748760
if (responseRequired) {
749761
return protoResponse;
750762
}
763+
console.log('fall', input);
751764
};
752765

753766
}
@@ -795,9 +808,9 @@ function Duel(roompass, botUsername) {
795808
commands = processTask(task);
796809

797810
// process AI
798-
console.log(task);
811+
//console.log(task);
799812
for (l; commands.length > l; l++) {
800-
console.log('sending in frame');
813+
console.log('sending in frame', l, commands.length);
801814
duel.commandParser(commands[l]);
802815
}
803816

server/http/js/card.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/*jslint bitwise: true*/
2+
3+
var enums = enums || require('../../libs/enums.js');
24
function makeCard(buffer, start, controller) {
35
'use strict';
46
if (buffer.length < 4) {

0 commit comments

Comments
 (0)