Solved the 'joker' problem unique cards and classes of cards implemented

This commit is contained in:
bluesaxman 2020-05-20 17:01:26 -06:00
parent 902940774d
commit 9b23be4bbb
3 changed files with 47 additions and 4 deletions

View File

@ -14,7 +14,17 @@ An example of a deck definition file:
Using this you can make all kinds of decks.
A more advanced example uses an array of "decks" to build a single deck.
```
[{
"value":["A","2","3","4","5","6","7","8","9","10","J","Q","K"],
"shape":["♥","♣","♠","♦"]
},{
"color":["red ", "black "],
"joker":["joker"]
}]
```
Things not yet supported:
* Unique cards
* Multipul card classes
* Mixing decks

View File

@ -54,7 +54,15 @@ buttonAdd("#menu","upload","Upload Deck", function () {
var myFile = new FileReader();
myFile.onload = function (file) {
// Probably validate the file somehow befor eating it
window.deck = generateDeck(JSON.parse(file.target.result));
var ourFile = JSON.parse(file.target.result);
if ( Array.isArray(ourFile) ) {
window.deck = [];
ourFile.forEach(function (deck) {
window.deck = window.deck.concat(generateDeck(deck));
});
} else {
window.deck = generateDeck(JSON.parse(file.target.result));
}
window.hand = [];
updateEvent();
}

25
jokers.ddf Normal file
View File

@ -0,0 +1,25 @@
[{"value":[
"A",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"J",
"Q",
"K"],
"shape":[
"♥",
"♣",
"♠",
"♦"
]},
{
"color":["red ", "black "],
"joker":["joker"]
}
]