Knight's tour in perl ithreads

Discussion in 'Perl Misc' started by Walter Roberson, Feb 2, 2004.

  1. For my amusement / edification, I implimented the generalized
    chess "Knight's Tour" problem in perl ithreads with message
    passing.

    The current version is certainly not the most efficient possible,
    and it probably has an off-by-one error in what it thinks of
    as a complete solution (I haven't run it long enough to -produce-
    a complete solution... it's not the fastest program in the world.)
    It's also not intended as a paragon of clean perl coding.

    If someone happens to be interested in amusing themselves with
    it, or interested in examining an example of threads and message
    passing at work, then send me email and I'll send you the source.

    [The source isn't terribly long, but I don't have active WWW
    pages at the moment or I'd just post a link to it.]


    Here's some sample output on the 5x5 board (which isn't solvable btw):

    Found partial solution length 23. It's 0 7 4 13 24 17 10 1 8 19 22 15 6 3 14 23 16 5 2 9 18 11 0
    :1 :2 :3 :4 :5 :
    -+----+----+----+----+----+
    1 |23 |8 |19 |14 |3 |
    -+----+----+----+----+----+
    2 |18 |13 |2 |9 |20 |
    -+----+----+----+----+----+
    3 |7 |22 |0 |4 |15 |
    -+----+----+----+----+----+
    4 |12 |17 |6 |21 |10 |
    -+----+----+----+----+----+
    5 |0 |0 |11 |16 |5 |
    -+----+----+----+----+----+
    Found partial solution length 23. It's 0 11 20 17 24 13 6 15 22 19 8 1 10 21 18 9 2 5 16 23 14 7 4
    :1 :2 :3 :4 :5 :
    -+----+----+----+----+----+
    1 |1 |12 |17 |0 |23 |
    -+----+----+----+----+----+
    2 |18 |7 |22 |11 |16 |
    -+----+----+----+----+----+
    3 |13 |2 |0 |6 |21 |
    -+----+----+----+----+----+
    4 |8 |19 |4 |15 |10 |
    -+----+----+----+----+----+
    5 |3 |14 |9 |20 |5 |
    -+----+----+----+----+----+

    --
    Rump-Titty-Titty-Tum-TAH-Tee -- Fritz Lieber
     
    Walter Roberson, Feb 2, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Taewoon Kwon

    Qustion about ithreads join

    Taewoon Kwon, Sep 10, 2004, in forum: Perl
    Replies:
    1
    Views:
    432
    Joe Smith
    Sep 15, 2004
  2. Replies:
    9
    Views:
    531
    Kai-Uwe Bux
    Jan 30, 2006
  3. tourinnepal
    Replies:
    0
    Views:
    282
    tourinnepal
    Jan 30, 2010
  4. Robin Rytich
    Replies:
    0
    Views:
    693
    Robin Rytich
    Mar 10, 2010
  5. Gabriel Genellina

    Knight's tour Warndorff's algorithm problem

    Gabriel Genellina, Mar 10, 2010, in forum: Python
    Replies:
    4
    Views:
    1,122
    Terry Reedy
    Mar 11, 2010
Loading...

Share This Page