From 30b14d7e8437d93a78737a4bf536ce8a7f65450a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 4 May 2012 16:04:58 +0200 Subject: Twirl.release_p : must release merged particles --- lib/evendoors/twirl.rb | 4 ++++ 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 -- cgit v1.1-2-g2b99