in reply to [code challenge] knights move

Replies are listed 'Best First'.
Re^2: [code challenge] knights move
by LanX (Saint) on Jun 21, 2015 at 22:30 UTC
    Well you provided code but no output.

    And at least one of your allowed moves looks wrong (0-8) or I'm not understanding you're coding system.

    How long does your code run?

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

      Just run it. :)

      0-8 means start in upper left corner and go down two and right one. Double check the code, The 0 is the skip from the start of string, and the 8 is the gap (in bytes) between the squares to be swapped.

      This program runs in just under seven seconds on my machine, an AMD Athlon(tm) Dual Core Processor 5050e running at 2.8GHz.

        > Just run it. :)

        my mobile has no Perl installed (yet)

        ...but my Netbook does and I'm back home now.

        Congrats it's the best known solution, almost exactly the sequence given in the book. (found manually though)

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Je suis Charlie!

      A knight has eight moves, but only four are "forward", which is desired for the regexes.

      move gap S E.. 1 S.. E 5 S . E. 6 S . .E 8