r/javascript • • Sep 02 '15

HTML5 Deck of Cards. 100% vanilla JS.

http://pakastin.github.io/deck-of-cards/
368 Upvotes

185 comments sorted by

View all comments

5

u/robotslacker Sep 02 '15

This is cool! Nice work. It'd be pretty cool if you had an API that would allow people to build their own card games off of this.

4

u/pkstn Sep 02 '15 edited Sep 02 '15

Not a bad idea. I could add some new methods to the current API.

Basically now you can do the following:

var deck = Deck()

deck.shuffle()

deck.sort()

deck.bysuit()

deck.fan()

(check out example.js)

That's about it.. But it is pretty easy to fork the project and just add own modules.. But let's see. Might be fun to create a card game engine and see what people would make out of it.

2

u/robotslacker Sep 02 '15

Yeah you might be on to something -- it wouldn't be limited to games with traditional card decks either if the cards were skinnable and you could add different attributes to it, etc.

5

u/pkstn Sep 02 '15

Maybe I should create another more barebones project for that..

2

u/robotslacker Sep 03 '15

I'll give ya my blessing. :)

Can help out too as I've been looking for a side project to work on.

1

u/pkstn Sep 06 '15

I've been gradually refactoring + opening the API. Feel free to fork + pull request if you have something in mind..