So I'm working on a game that's similar in mechanics to Bejeweled--you know the type, where you swap adjacent tiles in a grid to match groups of same-type tiles together. So here's my question: if I have an MxM grid of tiles, and there are N different tile types, how do I calculate a "random" placement of tiles such that the number of groups of 3 same-type tiles starts out minimized?
At the moment, I'm just completely randomly placing them, but this results in many groupings from the start, which removes all skill from the game. I don't even know where to begin coming up with an algorithm to minimize those initial groups. If it helps or matters, right now there are specifically 5 tile types in a 10x10 grid.