Trying to create a path algorithm

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

1. obwil

Joined:
Nov 2, 2021
Messages:
3
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 :

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?

obwil, Nov 2, 2021

2. MathLover1

Joined:
Jun 27, 2021
Messages:
2,989
2,883
MathLover1, Nov 2, 2021
nycmathguy likes this.

3. obwil

Joined:
Nov 2, 2021
Messages:
3
2

obwil, Nov 2, 2021
nycmathguy likes this.
4. nycmathguy

Joined:
Jun 27, 2021
Messages:
5,386
420

mathhelpforum.com

freemathhelp.com

mathhelpboard.com

mathforums.com

Good luck.

nycmathguy, Nov 3, 2021

Joined:
Nov 2, 2021
Messages:
3