|
@@ -63,11 +63,11 @@ class randomFree {
|
|
|
p1.on('broadcast', broadcast);
|
|
|
p2.on('broadcast', broadcast);
|
|
|
|
|
|
- const gameOver = (stack) => {
|
|
|
+ const gameOver = (data) => {
|
|
|
// TODO this should be emitted ONLY if all 9 moves have been played
|
|
|
//TODO verify move stack (compare with hashed cards)
|
|
|
- let gameMachine = new GameMachine(stack.setup);
|
|
|
- let winner = gameMachine.runMatch(stack.moves);
|
|
|
+ let gameMachine = new GameMachine(data.setup);
|
|
|
+ let winner = gameMachine.runMatch(data.stack.moves);
|
|
|
|
|
|
nsp.in(channel).emit('winner', winner);
|
|
|
};
|
|
@@ -127,7 +127,7 @@ class randomFree {
|
|
|
let hashedCard = cryptoSHA256(playerCard.toString() + salt);
|
|
|
playerCardsArray.push(playerCard);
|
|
|
saltArray.push(salt);
|
|
|
- hashedCardsArray.push(hashedCard.toString());
|
|
|
+ hashedCardsArray.push(hashedCard.toString());
|
|
|
}
|
|
|
return {playerCardsArray, saltArray, hashedCardsArray};
|
|
|
}
|