I hope this is the correct place to post this, as I don’t study maths. But I do need help calculating the possible permutations of a grid based game I’m currently programming. This isn’t to help out with the game logic, but rather to help me understand how many different combinations of each puzzle I can get by randomising the placement of the tiles.

I think that to someone with a good understanding of maths, this should be a pretty basic problem to solve. I would give it a shot myself, but I didn’t study further maths and I really want a correct answer/algorithm.

Okay so this is the scenario:

I have a 5x5 grid of coloured tiles. There are 5 different colours of tiles. By default, the tiles are ordered into rows of 5. My question is, if every tile can go to any position in the 5x5 grid, how many possible permutations of the grid are there? (also taking into account that tiles of the same colour count as the same tile, so 'red tile A’ is exactly the same as ‘red tile B’ as far as the game mechanics are concerned)

It would be useful to know what you think the permutations figure is for this specific grid but also the calculation you used to arrive at that answer. The reason for this is that the size of the grid may change in the future and I’d like to be able to use the same algorithm to calculate its permutations. It's also likely that I will have other layouts which aren't arranged into rows, and may have different quantities of each block, so if anyone could point me in the right direction with this, it would be greatly appreciated!

Thanks for any advice!!

Below is an example screenshot of what I mean, you can ignore the numbers as they are just for debugging purposes.