Jump to content

Problem with algorithm

- - - - -

  • Please log in to reply
2 replies to this topic

#1
Noa

Noa

    Newbie

  • Members
  • Pip
  • 2 posts
Hello,
I'm writing a project for school (C#), and I could use some help :-)
I need the computer to be able to solve a whole link-a-pix game board by itself.
Basically, I need a function that can find possible connections between two numbers on a board, when there are certain limitations, several possible connections and only one of the numbers is given (the second could be one of several others).
Can you help me?
Thanks,
Noa

#2
Momerath

Momerath

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 242 posts
  • Pick a starting block.
  • Make a list of possible moves from that position adding them to a 'moves-to-check' list.
  • For each of the moves in the moves-to-check list
    • Is this move a solution? If so add the moves-made to the solution-list
    • If not, does the move violate any of the restrictions (max length and not a solution)?
      • If not, make a list of possible moves from this position and add them to a 'next-moves-to-check'

  • Are there items in the next-moves-to-check list?
      If yes, then set moves-to-check to next-moves-to-check and loop back to 3.

Once this is done all possible solutions should be in your solution-list. If you use a queue structure you only need one 'moves-to-check' list.

#3
Noa

Noa

    Newbie

  • Members
  • Pip
  • 2 posts
I'll try it out...
Thank you!




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users