Skip to content

Instantly share code, notes, and snippets.

View williamjsdavis's full-sized avatar

William Davis williamjsdavis

View GitHub Profile
@williamjsdavis
williamjsdavis / pyramid-solver.py
Created October 3, 2023 07:31
Pyramid Scheme python solver
# Solver for Buzfeed's "Pyramid Scheme" game
import networkx as nx
class PyramidSolver:
""" Solves pyramid puzzles of base length 5 """
def __init__(self,inputlist,filename_validwords):
self.inputlist = inputlist
self.letterlist = sum(inputlist, [])
self.pyramid_size = 5
@williamjsdavis
williamjsdavis / point-line.scm
Created December 27, 2022 23:09
Learning Scheme with points and lines
; Points and lines in Scheme
; Data types
(define (mk-segment start-point end-point)
(cons start-point end-point)
)
(define (mk-point x-value y-value)
(cons x-value y-value)
@williamjsdavis
williamjsdavis / reversal_sampling.ipynb
Created July 25, 2021 22:50
Investigating the relationship between reversal rate and low ADM observations
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@williamjsdavis
williamjsdavis / kl_example.m
Created June 4, 2021 04:20
GUI illustrating Kullback–Leibler divergence
%% 2D KL-divergence example
% William Davis, 02/06/21
clearvars,close all
%% Pre-calculating
% Distributions
P = makedist('Normal','mu',0,'sigma',2);
Qvar = @(m,s) makedist('Normal','mu',m,'sigma',s);
% Sampling
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@williamjsdavis
williamjsdavis / synchronisation.ipynb
Created April 23, 2021 03:03
Synchronisation examples using Julia
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.