- Create a
Card(suit, number)constructor with data memberssuitand number. Make it so that it is impossible to change the suit and number of a card (yes, you will need to use closures). Create the following functions for this prototype:toString(): returns a string representation of the card, for example: AD, 4C, 2D.equal(otherCard): returns true if this card equalsotherCard.cmp(otherCard): returns -1 if the number of this card is less than otherCard, 1 if it is greater, and 0 if they are the same.
- Create
Deckconstructor with data memberscardswhich is initially an empty array. It should also have the following member functions:shuffle: shuffles the cards. Extra credit: what is the minimum number of swaps required to ensure that a deck is shuffled?addCards(x): takes as inputxwhich can either be an array of Cards, or a Deck, or just a Card, and adds it to the deck.deal(): returns a card from the top of the deck and removes it from the deck.
During a public meeting of the W3C CSS Working Group, Mozilla web standards
lead Tantek Çelik precipitated a crisis in Web Standards Land when he
complaine...


2 comments: