Hello.
I'm trying to write a game code which is :
A matrix of (NxM)
Enemies - a numbers of enemies placed on the map
Bombs - I can detonate sets of cells limited by a number(sets different).
The enemies move their positions after each set detonated and I want the best way to kill them all.
I only need a point to where I should look, some advice. I don't want code example or anything.
The only efficient way to kill the enemies is if you know where they are. Otherwise it's just a probability problem. Assuming you throw B bombs at each step, in different locations on the map (bombs at a particular step cannot land in the same point), the probability to hit any one point is B/(NxM), so you would likely kill ExB/(NxM) enemies the first step. Then the enemies move, I assume randomly. I also assumed that they can move to the spots where you already bombed. You have E- ExB/(NxM) enemies, so you would kill (E- ExB/(NxM))xB/(NxM) in step 2. And so on.
So all you need is a good random number generator, that uniformly covers the interval from1 to NxM. You should test it, to see that it coveres all points, including at the edges, with the same probability