diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-05-04 16:04:58 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-05-04 16:04:58 +0200 |
commit | 30b14d7e8437d93a78737a4bf536ce8a7f65450a (patch) | |
tree | 33225ec6f2f3bbb768e493c53e49167d6457e84b | |
parent | 73029ab1d755f1b52c64ffc3a6c2778f1c7ff527 (diff) | |
download | edoors-ruby-30b14d7e8437d93a78737a4bf536ce8a7f65450a.zip edoors-ruby-30b14d7e8437d93a78737a4bf536ce8a7f65450a.tar.gz |
Twirl.release_p : must release merged particles
-rw-r--r-- | lib/evendoors/twirl.rb | 4 | ||||
-rw-r--r-- | test/test_evendoors.rb | 10 |
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/evendoors/twirl.rb b/lib/evendoors/twirl.rb index 5aa7d25..8742220 100644 --- a/lib/evendoors/twirl.rb +++ b/lib/evendoors/twirl.rb @@ -17,6 +17,10 @@ module EvenDoors attr_accessor :debug # def release_p p + # hope there is no circular loop + while p2=p.merged_shift + release_p p2 + end ( @pool[p.class] ||= [] ) << p end # diff --git a/test/test_evendoors.rb b/test/test_evendoors.rb index fc76959..28d64a6 100644 --- a/test/test_evendoors.rb +++ b/test/test_evendoors.rb @@ -47,9 +47,13 @@ class ConcatBoard < EvenDoors::Board if p.action==EvenDoors::ACT_ERROR # else - p2 = p.merged_shift - p.set_data 'line', (p.data('line')+' '+p2.data('line')) - release_p p2 + # MANUALLY + # p2 = p.merged_shift + # p.set_data 'line', (p.data('line')+' '+p2.data('line')) + # release_p p2 + # + # Or let the system do it + p.set_data 'line', (p.data('line')+' '+p.merged(0).data('line')) send_p p end end |