I wrote up a basic model for a 52 card deck of playing cards in JavaScript (using beloved Prototype. I plan on using it to make some very simple card games in the near future. I thought it'd be interesting to post this before I actually used it anywhere so I could take a look at how much it changed after I actually implemented it.
There's not much to see at the moment. You can just shuffle and get a card dump:
<html> <head> <title>JavaScript Deck of Cards</title> <script src="/common/prototype.js" type="text/javascript"></script> <script src="deck_of_cards_v1.js" type="text/javascript"></script> </head> <body> <script> d = new Deck(); alert(d); d.shuffle(); alert(d); </script> </body> </html>
Download the code!
JavaScript Deck of Cards V1
Current Version
Tags: cards, javascript, prototype
[...] co-worker of mine sent me some advice on the JavaScript deck of cards I set up a while back. Everything he said was spot on. I made the suggested updates and and Jim, if [...]