Skip to content

Instantly share code, notes, and snippets.

Avatar
🛒
get it? it's a "shoffing cart"

shoffing

🛒
get it? it's a "shoffing cart"
View GitHub Profile
View air.py
import pygame
import random
class Node:
def __init__(self, x, y, air=0.0, wall=False):
self.x = x
self.y = y
self.air = air
self.wall = wall
@shoffing
shoffing / agent.py
Last active Jan 6, 2019
Bot to play codenames as an agent
View agent.py
import numpy as np
# Distance function
dist = lambda a, b: np.linalg.norm(a - b)
# Load word2vec data file (gl0ve)
w2v = {}
with open("glove/glove.6B.50d.txt", "r", encoding="utf-8") as w2v_file:
for word_enc in w2v_file:
word = word_enc[:word_enc.index(" ")]
View extract_attacks.js
const demofile = require('demofile');
const fs = require('fs');
const _ = require('lodash');
// Replace with your own demo files
const INFERNO_DEMOS = [
'/Users/shoffing/inferno-demos/astralis-vs-liquid-inferno.dem',
'/Users/shoffing/inferno-demos/fnatic-vs-complexity-inferno.dem',
'/Users/shoffing/inferno-demos/g2-vs-cloud9-inferno.dem',
'/Users/shoffing/inferno-demos/g2-vs-mibr-inferno.dem',
@shoffing
shoffing / inferno_damage_faceit_2018.json
Created Sep 20, 2018
JSON file containing all instances of damage dealt (that I found) during FACEIT major 2018. Also includes bomb plants.
View inferno_damage_faceit_2018.json
This file has been truncated, but you can view the full file.
View render_inferno.js
const fs = require('fs');
const _ = require('lodash');
const D3Node = require('d3-node');
const ATTACKS_FILE = 'inferno.json';
const DAMAGE_ALPHA_SCALE = 0.9;
const BORDER = 2048;
const data = JSON.parse(fs.readFileSync(ATTACKS_FILE));
const attacks = data.attacks;
@shoffing
shoffing / read_demo.js
Created Sep 19, 2018
reads csgo demos and extracts initial spawns, bomb plants, and attacks
View read_demo.js
const demofile = require('demofile');
const fs = require('fs');
const _ = require('lodash');
const DEMO_FILE = 'astralis-vs-liquid-inferno.dem';
let distance3 = (p1, p2) => {
return Math.sqrt( Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2) + Math.pow(p2.z - p1.z, 2) );
};
@shoffing
shoffing / MinMaxByExtensions.cs
Last active May 29, 2018
Adds the functional extension methods MinBy and MaxBy to IEnumerables.
View MinMaxByExtensions.cs
using System;
namespace System.Collections.Generic
{
public static class MinMaxBy
{
public static T MinBy<T>(this IEnumerable<T> list, Func<T, IComparable> selector)
{
IComparable lowest = null;
T result = default(T);
View 8x8 Parameter Testing
NUM SOLS PER GEN,% SELECTION,% CHILDREN,% RANDOM,MUTATION,CROSSOVER BUFFER,PRESERVE,AVERAGE T2S
10,0.2,0.8,-2.22E-16,0.05,0,0,0.023999989
10,0.2,0.6,0.2,0.05,0.1,1,0.024999976
10,0.2,0.7,0.1,0.05,0,0,0.024999976
10,0.2,0.8,-2.22E-16,0.05,0.15,1,0.025250137
10,0.3,0.6,0.1,0.05,0.15,2,0.0255
15,0.2,0.8,-2.22E-16,0.05,0.05,2,0.025500059
10,0.2,0.6,0.2,0.05,0.05,1,0.025749981
10,0.2,0.7,0.1,0.05,0.1,0,0.025750041
10,0.2,0.8,-2.22E-16,0.05,0.05,0,0.026250064
View testing.py
import random
import time
import copy
# Parameters
NUM_COLORS = 4
NUM_ROWS = 17
NUM_COLS = 17
View DemoShip.lua
local turnLeft = false
function Update()
-- Store our angular velocity in a variable to make it easier to use
local angVel = gyro:AngVel()
if ranger:Range() > 0 then
-- We see another ship, stop spinning, start ramming,
-- and remember which way to turn if we lose it again