# Dynamic Clustering

The idea is to record a "state" (or termed "situation") for each entry in your log. The state can contain any data that you deem valuable, such as lateral velocity, advancing velocity, or enemy distance. Save this along with your data. Then to use the data, you find a "distance" between current state and past states. Distance can be Euclidian ($\sqrt{(dist1 - dist2)^2 + (lat1 - lat2)^2 + \cdots}$) or another way, such as Manhattan distance ($|dist1 - dist2| + |lat1 - lat2| + \cdots$). Find some number of entries with the lowest distance, and use them for targeting, movement, or whatever you like.