Skip to content

Instantly share code, notes, and snippets.

View benjaminfspector's full-sized avatar

Benjamin Spector benjaminfspector

  • Palo Alto, CA
View GitHub Profile
@benjaminfspector
benjaminfspector / Improving the Halite Random Bot (C++)
Last active October 29, 2016 14:43
Halite Random Improvement Sample Code (C++)
This Gist contains the sample code for improving the sample Halite random bot in C++.
@benjaminfspector
benjaminfspector / Improving the Halite Random Bot (Java)
Last active March 14, 2017 06:06
Halite Random Improvement Sample Code (Java)
This Gist contains the sample code for improving the sample Halite random bot in Java.
@benjaminfspector
benjaminfspector / Improving the Halite Random Bot (Python 3)
Last active November 13, 2016 04:25
Halite Random Improvement Sample Code (Python 3)
This Gist contains the sample code for improving the sample Halite random bot in Python 3.
@benjaminfspector
benjaminfspector / PerimBot.py
Created December 18, 2016 22:16
Grid-Based Expansion for halite.io
# Note: Uses a modified version of @erdman's starter package, also contained in this gist.
import hlt
from hlt import *
import random
myID, game_map = hlt.get_init()
debug = open('debug.log', 'w')
@benjaminfspector
benjaminfspector / GetGinis.py
Last active January 6, 2017 13:14
Gini Coefficient Code
"""
Takes a folder as its argument. Searches for all files (must be .hlt!) in that folder,
calculates their Gini coefficients, and then creates a json file ('ReplayGinis.json')
which contains the replay names and their associated Gini coefficients.
"""
import sys, json, numpy, os
out = open('ReplayGinis.json', 'w')
out.write('{')
for filename in os.listdir(sys.argv[1]):