
// this is what a deck should look like
  // [ {id: a0, orientation: 0}, {id: a1, orientation: 0}, ... ] 



// takes a `spec` argument
// the spec is an object, it contains letter keys (ie a, b c)
  // and values are an array that contain integers representing the number of 
  // each card in the deck. 
// if that is confusing just look at the `cards` object below and it might make sense...
var Deck = function(spec){
  this.deck = [];
  for (var key in spec){
    for (var i = 0; i < spec[key].length; i++) {
      this.deck.push(new Tile ( key + spec[key][i] ));
    }
  }
};

Deck.prototype.shuffle = function() {
  // fisher yates shuffle yolo
  // operates on this.deck
  if (this.deck.length === 0) {
    console.log('you dun goofed');
  }
  var currentIndex = this.deck.length, temporaryValue, randomIndex;
  while (0 !== currentIndex){
    randomIndex = Math.floor( Math.random () * currentIndex);
    currentIndex -= 1;
    temporaryValue = this.deck[currentIndex];
    this.deck[currentIndex] = this.deck[randomIndex];
    this.deck[randomIndex] = temporaryValue;
  }
};

// all of the cards
// verbose, but easily extendable for expansion packs
// the key is the id-letter
// the int in the array is part of the id, and represents how many
  // of a given card there is
var cards = {
  a: [0, 1],
  b: [0, 2, 3, 4],
  c: [0],
  d: [0, 1, 2, 3],
  e: [0, 1, 2, 3, 4],
  f: [0, 1],
  g: [0],
  h: [0, 1, 2],
  i: [0, 1],
  j: [0, 1, 2],
  k: [0, 1, 2],
  l: [0, 1, 2],
  m: [0, 1],
  n: [0, 1, 2],
  o: [0, 1],
  p: [0, 1, 2],
  q: [0],
  r: [0, 1, 2],
  s: [0, 1],
  t: [0],
  u: [0, 1, 2, 3, 4, 5, 6, 7],
  v: [0, 1, 2, 3, 4, 5, 6, 7, 8],
  w: [0, 1, 2, 3],
  x: [0]
};
@@ -1,12 +1,42 @@
+var Tile = require('./tile');%0A
 %0A// this is 
@@ -131,18 +131,16 @@
 ... %5D %0A%0A
-%0A%0A
 // takes
@@ -214,14 +214,17 @@
 s (i
-e
+.e.
  a, b
+,
  c)%0A
@@ -232,16 +232,20 @@
  // and 
+its 
 values a
@@ -251,16 +251,14 @@
 are 
-an 
 array
+s
  tha
@@ -614,48 +614,8 @@
 %7D;%0A%0A
-Deck.prototype.shuffle = function() %7B%0A  
 // f
@@ -639,18 +639,16 @@
 le yolo%0A
-  
 // opera
@@ -664,16 +664,54 @@
 is.deck%0A
+Deck.prototype.shuffle = function() %7B%0A
   if (th
@@ -1116,14 +1116,15 @@
 %0A// 
-all of
+returns
  the
@@ -1132,584 +1132,116 @@
 card
-s%0A// verbose, but easily extendable for expansion packs%0A// the key is the id-letter%0A// the int in the array is part of the id, and represents how many%0A  // of a given card there is%0Avar cards = %7B%0A  a: %5B0, 1%5D,%0A  b: %5B0, 2, 3, 4%5D,%0A  c: %5B0%5D,%0A  d: %5B0, 1, 2, 3%5D,%0A  e: %5B0, 1, 2, 3, 4%5D,%0A  f: %5B0, 1%5D,%0A  g: %5B0%5D,%0A  h: %5B0, 1, 2%5D,%0A  i: %5B0, 1%5D,%0A  j: %5B0, 1, 2%5D,%0A  k: %5B0, 1, 2%5D,%0A  l: %5B0, 1, 2%5D,%0A  m: %5B0, 1%5D,%0A  n: %5B0, 1, 2%5D,%0A  o: %5B0, 1%5D,%0A  p: %5B0, 1, 2%5D,%0A  q: %5B0%5D,%0A  r: %5B0, 1, 2%5D,%0A  s: %5B0, 1%5D,%0A  t: %5B0%5D,%0A  u: %5B0, 1, 2, 3, 4, 5, 6, 7%5D,%0A  v: %5B0, 1, 2, 3, 4, 5, 6, 7, 8%5D,%0A  w: %5B0, 1, 2, 3%5D,%0A  x: %5B0%5D%0A%7D
+ from the top of the deck%0ADeck.prototype.pop = function() %7B%0A  return this.deck.pop();%0A%7D;%0A%0Amodule.exports = Deck
 ;

remove deck spec to its own file, reorganize code