Message text I have a few more little ideas 
-=# LOOPS #=-
Your "FOLLOWING" idea is excellent, should speed up things a lot. It should also make checking for loops faster. I had another idea in mind before reading your reply, but I now suspect yours is better.
My idea WAS: To check for loops, instead of the "LOOP NUMBER" counter, it's much better to use a "LOOP FLAG". It starts at 0 at step (D), and is increased to 1 only if at least one ship "MOVES" or "IS BLOCKED". If at the end of procedure (D) the "LOOP FLAG" is still at 0, it means that there surely is a loop (all ships are WAITING for each other!)
But, I repeat, your "FOLLOWING" idea may be better, I think.
-=# COLLISION SCORE #=-
Also this idea of yours (to separate the possible "collision zones") is very good.
To make things compatible, you might evaluate the "MOVE STRENGTH" using my criterion, and then separate the ships in different lists of "possibly colliding ships", looping ONLY inside single groups!
-=# FOULING #=-
On a second thought, fouling might not be as bad as I feared. In my procedure, one just has to (X.1) mark all hexes where a ship was attempting to enter, but couldn't as "CRASH" (X.2) mark the stopped ship as "CRASHING", and which "CRASH!" hex it was attempting to enter
at the end of the step (one of the four, I mean), you just (Y) consider one "CRASH" hex (Y.1) the ships ivolved are those marked as "CRASHING" in this hex, and (Y.2) also the ship in this hex is CRASHING (either because it successfully entered there, or because it just stayed there, it doesn't matter) (Y.3) repeat from (Y) for all "CRASH" hexes
Again, your optimisation ideas should greatly improve the speed!
-=# BUG #=-
My algorithm had a little bug (you surely noticed...): ALL STEPS (A-F) must be repeated 4 times, not only steps (D-F) |
|
|