Skip to content

Instantly share code, notes, and snippets.

View islamelnabarawy's full-sized avatar

Islam Elnabarawy islamelnabarawy

View GitHub Profile
@islamelnabarawy
islamelnabarawy / get_slurm_nodelist.py
Created October 9, 2018 03:57
SCOOP test code for SLURM
"""
Copyright 2018 Islam Elnabarawy
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@islamelnabarawy
islamelnabarawy / Minimap Camera Issue.ipynb
Last active November 10, 2017 05:36
A jupyter notebook showing an issue with using minimap for camera control
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@islamelnabarawy
islamelnabarawy / select_marines.py
Created October 27, 2017 16:38
find coordinates of individual marines in sc2 feature layer
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)]