-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample-usage.js
53 lines (41 loc) · 1.78 KB
/
sample-usage.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* eslint-disable max-len */
/* eslint-disable no-console */
const RoadmapGenerator = require('./src/roadmaps/roadmapGenerator');
const BaccaratGameEngine = require('./src/gameEngine/baccaratGameEngine');
const roadmapGenerator = new RoadmapGenerator();
// Create game engine (8 decks default)
const gameEngine = new BaccaratGameEngine();
gameEngine.shoe.createDecks();
gameEngine.shoe.shuffle();
let burnCard = gameEngine.burnCards();
console.log('burnCard = ', JSON.stringify(burnCard), "\n");
const gameResults = [];
for (let i = 0; i < 20; i += 1) {
if (gameEngine.isBurnNeeded) {
gameEngine.shoe.shuffle();
// Burn card is the first card drawn that determined the burn cards to use.
let burnCard = gameEngine.burnCards();
console.log('burnCard = ', JSON.stringify(burnCard), '\n');
}
const hand = gameEngine.dealGame();
console.log('Hand = ', JSON.stringify(hand));
const result = gameEngine.resultsEngine.calculateGameResult(hand);
// if (result.pair !== "none") {
// console.log('result = ', JSON.stringify(result));
// }
gameResults.push(result);
const beadPlate = roadmapGenerator.beadPlate(gameResults, {
columns: 20,
rows: 6,
});
// i === 19 && console.log('beadPlate = ', JSON.stringify(beadPlate));
const bigRoad = roadmapGenerator.bigRoad(gameResults);
i === 19 && console.log('bigRoad = ', JSON.stringify(bigRoad));
// const bigEye = roadmapGenerator.bigEyeRoad(bigRoad);
// console.log('bigEye = ', JSON.stringify(bigEye));
// const smallRoad = roadmapGenerator.smallRoad(bigRoad);
// console.log('smallRoad = ', JSON.stringify(smallRoad));
// const cockroachPig = roadmapGenerator.cockroachPig(bigRoad);
// console.log('cockroachPig = ', JSON.stringify(cockroachPig));
}
console.log('gameResults = ', JSON.stringify(gameResults));