Skip to content

Instantly share code, notes, and snippets.

@MontyThibault
MontyThibault / unify.js
Created January 20, 2020 20:10
Pure JS implementation of syntactic first-order unification (See: https://en.wikipedia.org/wiki/Unification_(computer_science))
const assert = require('assert');
const _ = require('lodash');
const {is_identifier, is_variable, merge_identifiers, string_to_units} = require('./identifiers');
const {term_to_string} = require('./display');
@MontyThibault
MontyThibault / gist:5477403
Created April 28, 2013 16:26
Crude artificial life program written in Python and Pygame.
#WARNING: Horribly messy code below - use caution
#Artificial life program written in python and pygame
import pygame, random, colorsys, math
resolution = 100
blockSize = 6
mutationRate = 0.00022
environment = 100
@MontyThibault
MontyThibault / example.js
Last active October 9, 2022 10:45
Simplified Octree/Quadtree Partitioning in THREE.js
// Create the tree
var box = new THREE.Box3(new THREE.Vector3(-25, -25, -25), new THREE.Vector3(25, 25, 25));
var tree = new Octree(box, {
maxDepth: 10,
splitThreshold: 5,
joinThreshold: 3
});
scene.add(tree);
// Add children the same way you would any other regular object.
@MontyThibault
MontyThibault / showdata.py
Last active January 12, 2016 20:21
Python: ShowData
# This function prints out all of the values and sub-values in any variable, including
# lists, tuples and classes. It's not very efficient, so use it for testing/debugging
# purposes only. Examples are below:
#-------------------------------------------------------------------------------------
# ShowData(range(10))
# (list)
# (int) 0