Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! Clones, Extensions, Modding » FreeStars » Efficient Algorithm for Scanning planets/fleets/etc.
Re: Efficient Algorithm for Scanning planets/fleets/etc. Wed, 07 February 2007 19:20 Go to previous messageGo to previous message
NingunOtro is currently offline NingunOtro

 
Master Chief Petty Officer

Messages: 105
Registered: September 2005
Location: Brussels, Belgium
That is a very basic algorithm without any kind of optimisation, I would not call it an algorithm at all.

Why not try something like this:


1. Set visibility status of each object to none for all races

2. For objects = 1 to z

3. For races n still present = 1 to n

4. if object property of race n then set visibility for that object to perfect and jump to next race in 3.

5. For observing token a of race n having the biggest penscan diameter to a having the lowest diameter

6. if object within range of observing token a then set visibility for that object to perfect and jump to next race in 3.

Next observing token with penscan 5.

7. if visibility of object not perfect then

8. For observing token a of race n having the biggest non-penscan diameter to a having the lowest diameter

9. if object within range of observing token a then set visibility for that object to partial and jump to next race in 3.

Next observing token with non-penscan 8.

endif 7.

Next race 3.

Next object 2.


This way you schedule the evaluations for every object in a way that you handle the most significant and the most probable first, and you discard every object from further evaluations as soon as the first match is found, as subsecuent matches with other observing tokens will add no additional information.

Effectively, once an object has been penscanned, no additional penscan or non-penscan is going to add any more info, so we try to tag as many as possible as soon as possible by evaluating the observing tokens with the biggest scanners first.

As soon as we run out of observing tokens any non spotted object remains with visibility=none.
As soon as we run out of objects any remaining observing tokens can remain unevaluated as they will add nothing to what is aleady known.

This should keep your calculations well below 392.184.

[Edit: Of course range modifiers should be taken into account, either inherent to the observing tokens, the objects or dependent on location as when orbiting a star]


[Updated on: Wed, 07 February 2007 19:33]




If we were esteemed intelligent 'enough', they would have contacted us.
If we can not find them, either we are not smart enough, or they are smarter at hiding.

Report message to a moderator

 
Read Message icon5.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: New stars! server clone proposal
Next Topic: 3D tool
Goto Forum:
  


Current Time: Mon Apr 29 09:19:41 EDT 2024