Created
October 27, 2017 16:38
-
-
Save islamelnabarawy/e70c337028f92d12de00c9ece03cf865 to your computer and use it in GitHub Desktop.
find coordinates of individual marines in sc2 feature layer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
player_relative = obs.observation["screen"][_PLAYER_RELATIVE] | |
player_y, player_x = (player_relative == _PLAYER_FRIENDLY).nonzero() | |
player_points = np.array(list(zip(player_x, player_y))) | |
player_dist = np.linalg.norm(player_points, axis=1) | |
sort_ix = np.argsort(player_dist) | |
player_points = player_points[sort_ix, :] | |
player_dist = player_dist[sort_ix] | |
ix = int(len(player_dist) / 2) - 1 | |
points = [np.array(player_points[:ix]).mean(axis=0), np.array(player_points[ix + 1:]).mean(axis=0)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment