Trying to create a path algorithm

Discussion in 'Other Advanced Math' started by obwil, Nov 2, 2021.

  1. obwil

    obwil

    Joined:
    Nov 2, 2021
    Messages:
    3
    Likes Received:
    2
    Hello everyone,

    I work on a game in which you have to fill a grid with a minimum of moves.

    Here are the rules :
    • Starting on the cell with a black square, we move on the grid horizontally or vertically.
    • When we move on a cell we invert its color (white cell becomes blue and blue cell becomes white).
    • We can move on a cell multiple times and each time we invert its color.
    When I generate a grid I need to know the minimum number of moves and every solution.

    My method is to suppose that the minimum of move is the number of white cells plus n = 0 blue cells ans to find solutions. If I don't then I try with n+1 blue cell etc.. For each hypothesis I create every possible path, and I have to gradually analyze them with an algorithm which will tell me if they are good or not.

    My problem is that I don't know how to create the algorithm I need.

    Let's take this grid for example :

    [​IMG]

    To fill it the shortest way I have found (by trying) that the path has to go through 4 blue cells. There is several possible paths and all of them go through 4 blue cells, which become white and they go through them again.

    I am trying to create that algorithm which will analyse the grid and will tell me how many blue cells has to be gone through, but I don't know where to begin.

    Do you think this is a problem mathematics can solve? If yes, which field?

    Thanks for reading me.
     
    obwil, Nov 2, 2021
    #1
  2. obwil

    MathLover1

    Joined:
    Jun 27, 2021
    Messages:
    2,989
    Likes Received:
    2,884
    MathLover1, Nov 2, 2021
    #2
    nycmathguy likes this.
  3. obwil

    obwil

    Joined:
    Nov 2, 2021
    Messages:
    3
    Likes Received:
    2
    Ok thank you for your reply
     
    obwil, Nov 2, 2021
    #3
    nycmathguy likes this.
  4. obwil

    nycmathguy

    Joined:
    Jun 27, 2021
    Messages:
    5,386
    Likes Received:
    422
    Here is a group of 4 better math forums that can help you with advanced mathematics:

    mathhelpforum.com

    freemathhelp.com

    mathhelpboard.com

    mathforums.com

    Good luck.
     
    nycmathguy, Nov 3, 2021
    #4
  5. obwil

    obwil

    Joined:
    Nov 2, 2021
    Messages:
    3
    Likes Received:
    2
    Thank you very much!
     
    obwil, Nov 3, 2021
    #5
    nycmathguy likes this.
Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.
Loading...