Check match 3 games for possible walks



  • Good afternoon!

    Typical match 3 game: There's board 8x8 on which six different colours are located. Two pieces may be changed to the seats and if, after a change to the row, 3 pieces of the same colour shall be removed (if more, they shall also be removed). Otherwise, the figures are returned. The rows in which the matching of flowers is checked can only be horizontal and vertical.

    How do you want to see if there's any moves? He's interested in the algorithm. I've set up options when we can move. Units - single colour, 0 - other colours:

    00000000

    00000000

    00000000

    00101000

    00010000

    00101000

    00000000

    00000000

    ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪

    00000000

    00000000

    00000000

    01101100

    00010000

    01101100

    00000000

    00000000

    ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪

    00000000

    00010000

    00010000

    00000000

    11010110

    00000000

    00010000

    00010000

    ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪ ♪

    00000000

    00000000

    00101000

    00101000

    00010000

    00101000

    00101000

    00000000

    Thank you!



  • Simple neoptimum algorithm:

    • Going all the cells.
    • Check if there are roommates of the same colour at a distance of 1 cell around (direct and diagonal)
    • Checking whether there are roommates at a distance of two cells at a straight distance
    • If there is, check whether all three colours are on the template (two near and one shifted or zigzag) and whether the colour lying is not on the straight to get straight (if any cells can be blocked)

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2