$ (init);
$('#deal').click(function () {
dealHand();
});
$('#reset').click(function () {
resetDeck();
});
var debugFlag = false;
var cardDeckImage = "url(http://jtpandelos.com/images/carddeck-small.png)";
var cardDeckImageX = 84;
var cardDeckImageY = 122;
// The 'cards' data structure represents the data needed for anunsorted
// deck of cards, this array should be constant and all follow on data
// structure reference an index intothisdata structure
var cards = new Array();
// The 'cardsInDeck' data structrue is a list of indices into the 'cards'
// data structure that represents all of the remamining card in a deck
var cardsInDeck = new Array();
// Define an 'object' to contain information needed to specify a
// particular card,including display offset and description
function Card(name, image, xIndex, yIndex)
{
this.name = name;
this.image = image;
this.xIndex = xIndex;
this.yIndex = yIndex;
this.position = "-" + ( xIndex * cardDeckImageX ) + "px -" + ( yIndex * cardDeckImageY ) + "px";
};
cards[0] = new Card('Ace of Clubs', cardDeckImage, 0, 0); cardsInDeck[0] = 0;
cards[1] = new Card('Two of Clubs', cardDeckImage, 1, 0); cardsInDeck[1] = 1;
cards[2] = new Card('Three of Clubs', cardDeckImage, 2, 0); cardsInDeck[2] = 2;
cards[3] = new Card('Four of Clubs', cardDeckImage, 3, 0); cardsInDeck[3] = 3;
cards[4] = new Card('Five of Clubs', cardDeckImage, 4, 0); cardsInDeck[4] = 4;
cards[5] = new Card('Six of Clubs', cardDeckImage, 5, 0); cardsInDeck[5] = 5;
cards[6] = new Card('Seven of Clubs', cardDeckImage, 6, 0); cardsInDeck[6] = 6;
cards[7] = new Card('Eight of Clubs', cardDeckImage, 7, 0); cardsInDeck[7] = 7;
cards[8] = new Card('Nine of Clubs', cardDeckImage, 8, 0); cardsInDeck[8] = 8;
cards[9] = new Card('Ten of Clubs', cardDeckImage, 9, 0); cardsInDeck[9] = 9;
cards[10] = new Card('Jack of Clubs', cardDeckImage, 10,...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.