top | item 35531989

Deck.of.cards

781 points| edent | 3 years ago |deck.of.cards | reply

112 comments

order
[+] pkstn|3 years ago|reply
Wow, thanks for sharing my Deck.of.Cards project! Just to let you guys know, this one is the old version. Newer version is in the root https://deck.of.cards

Old one has nicer animation treats, but the new one has multiplayer as well :)

[+] graypegg|3 years ago|reply
I played a game of solitaire but as I was moving my kings onto their suit's stack at the end I triggered the joker easter egg and the entire deck got put back into one pile :(
[+] wpietri|3 years ago|reply
Mentioning this got me to play a game of solitaire with it as well. The primitiveness of it felt oddly fun. An yes, I did the exact same thing when went to put my last king back.
[+] allenu|3 years ago|reply
Really cool stuff. I like how "heavy" the cards feel during the animation.

I've been working on something similar, but for arbitrary index card notes and played around with some very basic animations. You can see a quick video of it here [1]. After I got a basic prototype working, there was just something satisfying about collecting all the cards, shuffling them, and then re-distributing them into a grid.

I noticed that deck.of.cards doesn't have a flip animation, but maybe that's a good thing. The typical animation you see when a card is just flipped by rotating about one of the axes just "feels" wrong to me. It breaks the illusion somehow, but maybe there's a better way to do it.

[1] https://mastodon.social/@allenu/109952125506805902

Edit: You may need to hover over the GIF in the link to get the animation to start. Kind of unexpected behavior.

[+] social_quotient|3 years ago|reply
What do you think makes them feel heavy? I agree but I can’t put my finger on what it might be.
[+] jesse__|3 years ago|reply
Nicely polished, I like it.

EDIT: Turns out the following behavior is intentional, but I'll leave the statement here so the child comments make sense.

I wanted to point out what may be a bug .. if I quickly drag a face-down card off the deck and release the LMB right away, it flips face-up, however if I leave the mouse button depressed for ~0.5s, it stays face-down. Maybe this is intentional, but I feel like it's a bit of a weird behavior either way.

Chrome 111/Windows.

Anyway, thanks for sharing :)

[+] cypherpunks01|3 years ago|reply
I think it's a feature, works really nicely on a phone - if you tap, flick the card and quickly release, it lands face up as if you're throwing the card on the table as you deal. Whereas if you drag it more slowly into place, it will remain face down as if you are sliding it on the table. Feels pretty natural on touchscreen.
[+] throwbadubadu|3 years ago|reply
200 ms to be precise, definitely feature (a reasonable one) and not a bug (:

card.js confirms:

if (isFlippable && Date.now() - starttime < 200) { // flip sides

[+] alexthehurst|3 years ago|reply
I tried setting up a game of solitaire (on desktop with a mouse) and it got tedious really fast. What I wished for right away was:

- Ability to drag a selection region and move multiple cards together (like, say, the deck) - Ability to align cards to each other (I found myself testing modifier keys while dragging to see if this was a hidden feature, but alas.)

[+] ajanuary|3 years ago|reply
I think rather than dragging a region, which might get fiddly, I’d like to be able to hold down on a card and have it make a deck with all of the other cards it’s overlapping.
[+] RheingoldRiver|3 years ago|reply
Also, the cards in the should-be-face-down deck seem to sometimes be face-up when I remove the top card. I played with it a bit before dealing cards, though, like "fan," "sort," "poker," etc, so I'm thinking maybe it doesn't properly reset the face-down-ness when you click "shuffle."

FWIW I don't think the Kings easter egg is a good idea as-is. Maybe require a modifier key like "Click the kings while holding down the `K` key." Otherwise someone might have to click all kings while playing Free Cell and have their game ruined, that's no fun.

[+] InitialLastName|3 years ago|reply
Also necessary:

- The ability to shuffle the cards without the jokers.

[+] jordan_curve|3 years ago|reply
Does anyone know how one might go about implementing a feature like multiple select?

I had a project doing something similar a while back and got pretty stuck on figuring out how to go about it

[+] jkingsman|3 years ago|reply
Oh man this would be awesome to have as a shared web space where I could play arbitrary card games with friends like a hyper restricted Tabletop Simulator.

Nice and slick as is, though

[+] usrusr|3 years ago|reply
That, but through a federated local bluetooth mesh instead of a server is something that I'd appreciate a lot. Restricted to in-person opportunities, but liberating from not only the need for a deck but also from the need for a reasonably suitable table surface. And obviously a play on the "everybody just starting at their phones instead of interacting" trope.
[+] shp0ngle|3 years ago|reply
If you remove the "/old" from the URL, you can do just that
[+] ehcjrvakzjtbe|3 years ago|reply
Cockatrice can do that, configured for magic by default if i remember correctly. Youll have to cough up image files for different card sets.

There is a client and a server, so not super easy, but not hard if you have any sysadmin experience. I had a server up for almost a year once

https://github.com/Cockatrice/Cockatrice

[+] dminor|3 years ago|reply
I've been hacking on something like that to learn Phoenix, will post it to HN when it's usable
[+] mortenjorck|3 years ago|reply
Something like that could be a fantastic foundation for prototyping deck-based (e.g. Hanabi, Exploding Kittens) board games. With a little automation, you could go from the latest design file to a virtually playable deck in seconds.
[+] Caitlynmeeks|3 years ago|reply
Aw i was hoping it was gonna go to Gregg Turkington's Deck of Cards project

https://www.heinetwork.tv/episode/deck-of-cards-teaser/

[+] lexandstuff|3 years ago|reply
I think the website linked might be a tip of the hat to the Turkington cut of Deck of Cards. It wouldn't be the first time; I've seen many other websites posted here that mention "codes", which insiders know are references to another of Gregg's characters, the great agent Kinkton from Decker Classified (15 minutes run time).
[+] bodge5000|3 years ago|reply
Disappointed to see the website doesn't even feature a jitterbug mode as a tip of the hat to The Wizard of Oz (1h 52m)
[+] Heyso|3 years ago|reply
So.. that's just a card moving simulator ? I am missing something crazy or why does this have that many points on Hacker news ?
[+] moolcool|3 years ago|reply
I don't know how people hate on Flash. A teenager could make great games that ran at 60fps on a Pentium II. Today we're impressed that you can slide some cards around with Javascript.
[+] joss82|3 years ago|reply
Simulating playing cards is surprisingly hard.

Doing so flawlessly at consistent 60fps in a mobile browser is quite the feat, don't you think?

[+] spyremeown|3 years ago|reply
Don't you think it's just neat? I think it's neat.
[+] taylorbuley|3 years ago|reply
Anyone else rather hunt through source code to find the king easter egg than to actually click only kings and nothing in between?
[+] skeaker|3 years ago|reply
Even easier, just hit the By Suit button at the top and all the kings will be sorted along the right side.
[+] karaterobot|3 years ago|reply
Very satisfying animations.

It needs some form of multi-card selection, so that I can grab a stack of cards and move, shuffle, or flip them as a group. I tried to play a game of solitaire, then got to the part where you can reuse the cards in your discard pile, and realized that there was no way to have it shuffle those cards, or even to just flip them all over.

[+] notfed|3 years ago|reply
I like that this essentially can simulate any card game.

(Feedback: can't click "sort" on mobile due to placement of git banner.)

[+] newaccount74|3 years ago|reply
Except card games where you hide your cards from other players (ie. almost all of them)
[+] andirk|3 years ago|reply
.cards is a TLD? What is the pretend use case for that?
[+] booleandilemma|3 years ago|reply
Wow, beautiful and polished looking on Firefox.

It would be cool if when I clicked and dragged a card and let go of the mouse button, the cards slid a bit, to simulate them sliding them across the table.

I could see some people not liking that though, best to make it configurable.

[+] mproud|3 years ago|reply
My family would often play cards when we get together. During the height of the pandemic, we would often play on https://playingcards.io.
[+] owenpalmer|3 years ago|reply
Super cool, works well on mobile
[+] HDMI_Cable|3 years ago|reply
One (very small) nitpick on mobile: it’s very hard to press the ‘Sort’ button, as the ‘Fork me on GitHub’ logo covers most of the button. Other than that, this is great!
[+] brianfpeters|3 years ago|reply
https://www.f2f.games/

multiplayer card games on android. Keep you own hand private. See the cards on the table. Took more than a weekend, but I knew nothing of android or kotlin at the time.

[+] martyvis|3 years ago|reply
I tried to launch the links, but when Google Play Store comes it says it is for older versions of Android only (I'm on the latest, 13 )