A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: Find All Possibility with As

Threaded View

  1. #1
    Member
    Join Date
    Nov 2009
    Posts
    43

    Unhappy Find All Possibility with As

    Hello everybody. I just hope, that somebody can help me.
    I need to do a bit involved program for works automatically.
    So the program do the next:

    I have 6 buttons and a 4 and 9 litre barrels.
    With buttons you can do the next:
    A - Fill the second barrel.
    B - Fill the first.
    C - Empty second.
    D - Empty first.
    E - Decant from second to first, as many as it possible.
    F - Decant from first to second, as many as it possible.

    And the task is, to find the shortest way for the next:
    1 - In the end I have 1 litre in one of the barrels.
    2 - In the end I have 3 litres in one of the barrels.
    3 - In the end I have 6 litres in one of the barrels.
    4 - In the end I have 2 litres in one of the barrels.
    5 - In the end I have 7 litres in one of the barrels.

    I find all them with only my simply logic. But I need to make my programme, to find them automatically. It needs to find the shortest way for the solutions, and need to list the pressed buttons as you will see in the swf.
    (The solutions: A E D E / B F B F B F / A E D E D E A E / A E D E D E A E D E / B F B F B F C F B F)

    I need to do a permutation like cycle. I wrote the simply permutation, but it doesn't help, because the choices are repeatable.
    I think I need to do somehow a permutation with repeatable characters, and when it finds criterion than jump on the next, and it stops when one of the litre marker match with the number that you wrote in the input text field, near the button, that start the cycle. But I don't know how to start a script like this.

    Here is the swf and source for it>
    Swf in Html
    Source Fla


    Thanks forward your answer, tips or suggestions.
    Last edited by Creephun; 11-21-2009 at 09:26 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center