in reply to Re: Challenge: Ricochet Robots
in thread Challenge: Ricochet Robots

Yep you solved it and it took 6 min on my machine

here a (handmade) visualization from my solutions (some steps are in another order)

> The code is ugly, but works:

well mine is uglier (but I was at the start of my Perl career ;-)

I didn't analyze your code yet.

But I think yours is swapping much less than mine.°

Want a harder challenge? =)

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

PS: did you have fun? :)

UPDATE

°) nope, you need 2GB RAM mine only 0.5GB

Replies are listed 'Best First'.
Re^3: Challenge: Ricochet Robots
by choroba (Cardinal) on Feb 19, 2021 at 13:40 UTC
    > Want a harder challenge?

    Rather not. This was still manageable, but a harder one would be less fun. I have enough of them at work.

    > did you have fun?

    Yes, especially when I finished it! ;-)

    > you need 2GB RAM

    The original version that didn't produce the moves was less memory hungry. But the initial solution that stored the configuration as a string ate all my machine's memory and wasn't able to finish, so I had to introduce pack to make it more compact. I'd be interested in seeing an alternative solution.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      > > did you have fun?

      > Yes, especially when I finished it! ;-)

      Oh, at 3 am? Did it wake up your wife? ;-)

      > I have enough of them at work.

      Yeah me too.

      > I'd be interested in seeing an alternative solution.

      Don't wanna spoil the fun here. :)

      FWIW found a presentation in the internet from 2012 using most of the same principles though.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery