-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
35 lines (23 loc) · 860 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const cards = require('./lib/cards.js');
const shuffler = require('./lib/shuffler.js');
const Game = require('./lib/Game.js');
let shuffledCards = shuffler(cards.casinoDeck);
const game = new Game(shuffledCards);
let i = 0;
let histObj;
while(game.dealRound() !== false){
console.log(`Game ${i}`);
histObj = game.history[i];
console.log(`Winner: ${histObj.winner}`);
console.log("Player hand: ");
console.log(histObj.playerHand.cards);
console.log(`Player total: ${histObj.playerHand.total}`);
console.log();
console.log("Banker hand: ");
console.log(histObj.bankerHand.cards);
console.log(`Banker total: ${histObj.bankerHand.total}`);
console.log('=================================');
i++;
};
console.log(`Card penetration for this shoe: ${1-(game.stopAt/game.cards.length)}%`);
process.exit();