-
Notifications
You must be signed in to change notification settings - Fork 7
/
runtime.js
39 lines (31 loc) · 885 Bytes
/
runtime.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
const runtime = require('@skypager/node')
const loadSource = process.env.NODE_ENV !== 'production'
if (loadSource) {
require('@babel/register')()
}
require('babel-plugin-require-context-hook/register')()
const framework = loadSource
? require('./server')
: require('./lib')
/**
* @param {String} gameType
* @param {Object} options
* @param {Number|Object} players
* @param {Number} startingStack
* @param {Array<Number>} blinds
* @param {Object<String,Array<Card>} cards
*/
function gameFactory(gameType, options = {}) {
return runtime.game(gameType, {
players: 9,
blinds: [5, 10],
startingStack: 1000,
...options,
cacheHelper: false,
})
}
const gameRuntime = runtime.use(framework)
gameRuntime.createGame = gameFactory
gameRuntime.createScenario = (...args) =>
require('./test/scenarios').default(...args)
module.exports = gameRuntime