Permalink
Browse files

When there are multiple ships we want to copy the object, not copy the

references.
  • Loading branch information...
1 parent baa69f4 commit a31b95dac4bb18a06e9bc374a8c44e0f926e8c0b @icefox committed Aug 25, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 index.js
View
@@ -432,7 +432,7 @@ function test_ship(stock) {
ship = ship.concat(base);
var defense = [];
for (var i = 0; i < max_ships; ++i) {
- defense.push(ship);
+ defense.push(ship.slice(0));
}
var r = battle(offense, defense);
r = Math.floor(r);

0 comments on commit a31b95d

Please sign in to comment.