The user can create a JSON string that represents a game (checkers, solitare, dominion, smash up, etc). Then the engine creates cards, tokens, dice, etc. It does not enforce rules but it supports multi player and some rules about visibility to other players. Its intended use case is for testing out new games or expansions before printing them.
It's a little bit early in the project though, so you'd have to run it from source if you want a demo.
yeah, not even close i would say.
but the use of JSON is nice.
var suit = i / 13 | 0;
That's such a clean way to get a 0, 1, 2 or 3 from each card's `i` and I never would have thought of it.
suit = int(i / 13)
suit = (int)(i / 13)
suit = math.floor(i / 13)
Are much easier to understand for someone not familiar with the code.And on the flip side with JS's lack of number types, any code that looks like it's doing type casts (rather than math) looks out of place. If one must mess around with JS number types then all you can really do is give hints to the optimizing compiler, in which case "|0" is the standard way to hint that you want a small int.
Obviously what looks clean is a matter of opinion, but FWIW.
Math.floor(value) can return some weirder values such as: NaN (for anything that isn't a number), and Infinity, -Infinity, -0. And Math.floor(-1e-300); is -1 so care needs to be taken with floating values near zero.
which has the advantage of working with any size of deck. important since in brazillian truco you leave most of the numbers out ;)
~~(i/13)Similar to seeing `!!` and thinking true/false coercion.
Now you just need to add a dropdown to select what drinking game you want to play.. ring of fire anyone?..
Inspecting the cards, you can see that they are using the unicode character for spade/heart/etc. But in the browser itself you get nothing but smileys.
Perhaps the font they're using doesn't have those code points?
Edit: Yes, that's the case. Font is not specified, so it comes in as "inherit" by default, using whatever the browser feels like. On Mac Chrome, that must use smileys to represent unknown characters. Switching the document font to Arial in CSS fixes the issue and makes the cards look like cards.
You're seeing the Last Resort fallback font, which shows a symbol representative of the codepoint range, and the range's name, so you can identify what type of font you need. Since the suits are in the smiley block, you see a smiley. If you had no Latin alphabet font, you'd see an A.
Seems kinda wasteful.
https://desandro.github.io/3dtransforms/examples/card-01.htm...
#card.flipped { -webkit-transform: rotateY( 180deg ); -moz-transform: rotateY( 180deg ); -o-transform: rotateY( 180deg ); transform: rotateY( 180deg ); }
Only thing about is that it easily looks like crap. I mean if you don't curl & flip the card looks too solid..but I'll check it out.
It would be difficult to practice sleight of hand.
Additionally, with three elements (possible just one if you're crazily good at CSS), it'd be possible to have flippable cards. Still just using CSS3.
Edit: Can someone explain these downvotes for me?
Go figure :)
My own CSS playing cards with proper card faces from 3 years ago is here:
I suppose that's more for a second library that can manage stacks of cards, dealing and interacting with dealt cards, etc.
Nice work by the way!
Press "Räjäytä" (means "explode" in Finnish) ;)
I made an endless random card (and die roll) generator: http://staticresource.com/shuffle.html just tap anywhere to draw a new card.
Seeing what you've done with your Deck of Cards is a big inspiration!
I thought we needed to make a separate repository for github pages first. My other repo doesn't show at all.
I used 52-framed movieClip as a card, where frames were values.
And then every suit graphic was one movieClip as well with 4 frames: spade, heart, club and diamond
Worked great! Not so easy to do with HTML though. Lots of figuring out coordinates manually.
particularly awesome is "sort", which i think really nicely simulates a (reverse) shuffle; it seemed like i could see the top edge of the cards lift as they rotated along the bottom edge
same when clicking on the top card of a stack, it jumps ~40px.