-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck.js
34 lines (28 loc) · 816 Bytes
/
check.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
const Deck = require('./Deck.js');
const fs = require('fs');
console.time("check");
let checkLegality = (deck) => {
if (deck.format !== 'historic') {
console.log(deck.isLegal ?
`Decklist is legal for ${deck.format}!`
:`Illegal decklist for ${deck.format}!`
);
} else {
if (deck.isLegal) {
for (let i=0; i<deck.legalStandards.length; i++) {
console.log(`Deck is legal for ${deck.legalStandards[i]} standard.`)
}
}
}
console.log(`Deck hash: ${deck.hash}`);
}
fs.readFile('decklist2.txt', 'utf8', function(err, decklist) {
if (err) throw err;
let format = 'modern';
let deck = new Deck.Deck(decklist, format)
checkLegality(deck);
// format = 'commander';
// deck.check(undefined, format);
// checkLegality(deck);
});
console.timeEnd("check");