Programming Thread

Viewing single post

Started by the-pi-guy, Mar 13, 2016, 10:39 PM

previous topic - next topic


Thinking about it, I described it ambiguously before.

But basically it'd be like chess, if chess players could go more than once based on their speed so if M and N were 28 and 13, the turns would be calculated as:
28, 28, 13, 28, 28, 13

What solution did you go with?
The idea is that you build up a timeline:

Suppose M and N were m/s, then you could take 1 meter / (M) to get seconds.

You do this for the list of units, you sort them in ascending order.  

A.) The first unit in that list would go first. So you remove that one, and add it to the queue.

B.) Then multiply that time by whatever cycle that unit is on. So you calculate when they would make their k+1 move. You add this back into the list, in the place where it stays ordered.

Then you repeat steps A and B until you have the goal number of lookahead steps.