Task

Create a data structure and the associated methods to define and manipulate a deck of   playing cards.

The deck should contain 52 unique cards.

The methods must include the ability to:

   make a new deck
   shuffle (randomize) the deck
   deal from the deck
   print the current contents of a deck 
Each card must have a pip value and a suit value which constitute the unique value of the card.

Related tasks:

 Card shuffles
 Deal cards_for_FreeCell
 War Card_Game
 Poker hand_analyser
 Go Fish


make "suits {Diamonds Hearts Clubs Spades}
make "pips {Ace Two Three Four Five Six Seven Eight Nine Ten Jack Queen King}
 
to card :n
  output (sentence item 1 + modulo :n 13 :pips  "of  item 1 + int quotient :n 13 :suits)
end
 
to new.deck
  make "deck listtoarray iseq 0 51
  make "top 1
end
 
to swap :i :j :a
  localmake "t item :i :a
  setitem :i :a item :j :a
  setitem :j :a :t
end
to shuffle.deck
  for [i [count :deck] 2] [swap 1 + random :i :i :deck]
end
 
to show.deck
  for [i :top [count :deck]] [show card item :i :deck]
end
 
to deal.card
  show card item :top :deck
  make "top :top + 1
end
 
new.deck
shuffle.deck
repeat 5 [deal.card]