-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.js
44 lines (41 loc) · 1.23 KB
/
run.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
#!/usr/bin/env node
"use strict";
const _ = require("lodash");
const prefDeckJs = require("preferans-deck-js");
const PrefDeck = prefDeckJs.default;
const PrefDeckCard = prefDeckJs.PrefDeckCard;
const PrefDeckPile = prefDeckJs.PrefDeckPile;
const Ajv = require("ajv");
const ajv = new Ajv({useDefaults: true});
const _validateCard = ajv.compile({
type: "object",
properties: {
value: {type: "string"},
suit: {type: "string"},
label: {type: "string"},
ppn: {type: "string", "maxLength": 1},
string: {type: "string"},
unicode: {type: "string"}
},
additionalProperties: false,
required: ["value", "suit", "label", "ppn", "string", "unicode"]
});
console.log(_validateCard({newRefa: false}));
console.log(PrefDeckCard.ppnToCard("P"));
console.log(_validateCard(PrefDeckCard.ppnToCard("P")));
console.log(_validateCard({
value: '7',
suit: 'club',
label: '7club',
ppn: 'P',
string: '7Club',
unicode: '7♣'
}));
let card = PrefDeckCard.ppnToCard("7");
console.log(card.unicode);
let deck = new PrefDeck();
let deal = deck.deal;
console.log("Hand 1:", deal.hand1.unicode);
console.log("Hand 2:", deal.hand2.unicode);
console.log("Hand 3:", deal.hand3.unicode);
console.log(" Talon:", deal.talon.talon1.unicode, deal.talon.talon2.unicode);