timtim17/stacking-cards — pull request #2 by timtim17 (2014-01-25 21:24:05+00:00)
Title: Code Rewrite

Fixes #1 .

game.js
```javascript
function regenerate() {
stack_container.innerHTML = "";

if (radio_stack_three.checked) {
stack_one = new Stack(generateRandomCard());
stack_two = new Stack(generateRandomCard());
stack_three = new Stack(generateRandomCard());

stack_one = stack_one.createStack(1);
stack_two = stack_two.createStack(2);
stack_three = stack_three.createStack(3);
} else if (radio_stack_two.checked) {
stack_one = new Stack(generateRandomCard());
stack_two = new Stack(generateRandomCard());
stack_three = null;

stack_one = stack_one.createStack(1);
stack_two = stack_two.createStack(2);
} else if (radio_stack_one.checked) {
stack_one = new Stack(generateRandomCard());
stack_two = null;
stack_three = null;

stack_one = stack_one.createStack(1);
}

deck.createStockDeck();

// Log the deck to make sure it is correct.
console.log(deck);

heldCard = generateRandomCard();
stack_held.setAttribute('src', heldCard.img);

}
```

Problem was a missing parameter in ```createStack()```.

Also add's a bunch of fixes and *optimizations* and get's the first bit working!