Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
hexbog.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
aed244e
)
no need for crazy array maniplulation
author
Jason Woofenden
<jason@jasonwoof.com>
Sun, 24 Nov 2013 10:57:09 +0000
(
05:57
-0500)
committer
Jason Woofenden
<jason@jasonwoof.com>
Sun, 24 Nov 2013 10:57:09 +0000
(
05:57
-0500)
main.coffee
patch
|
blob
|
history
diff --git
a/main.coffee
b/main.coffee
index
c5b9da3
..
89bc695
100644
(file)
--- a/
main.coffee
+++ b/
main.coffee
@@
-449,11
+449,14
@@
blip_selection = ->
for t in b.down
unsink t
else
for t in b.down
unsink t
else
- while b.flips > 0 and b.down.length > 0
+ down_count = b.down.length
+ while b.flips > 0 and down_count
b.flips -= 1
b.flips -= 1
- flipper = Math.floor(Math.random() * b.down.length)
+ flipper = Math.floor(Math.random() * down_count)
unsink b.down[flipper]
unsink b.down[flipper]
- b.down = [b.down[0...flipper]..., b.down[flipper+1...b.down.length]...]
+ down_count -= 1
+ # move the last tile back into range
+ b.down[flipper] = b.down[down_count]
if b.force > 0
for t in b.up
t.new_hp = t.hp + b.force
if b.force > 0
for t in b.up
t.new_hp = t.hp + b.force