This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
# Functions | |
def sigmoid(x): # Sigmoidal activation function | |
return 1 / (1 + np.exp(-x)) | |
def sigmoid_prime(x): # Derivative of sigmoid | |
return sigmoid(x) * (1 - sigmoid(x)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
words = open("words.txt").read().split("\n") | |
def partition(word, words): | |
# Get how many words will remain for each possible response | |
partitions = [] | |
for a in "MCW": | |
for b in "MCW": | |
for c in "MCW": | |
for d in "MCW": | |
for e in "MCW": |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bower-Watson for Delaunay triangulation | |
# Mitchell's best-candidate algorithm for semi-random points | |
import math, random | |
import pygame, pygame.gfxdraw | |
from pygame.locals import * | |
pygame.init() | |
screen = pygame.display.set_mode((600,600)) | |
pygame.display.set_caption('Delaunay Triangulation') | |
pygame.mouse.set_visible(False) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import curses, time, random | |
from curses import wrapper | |
snow = [] | |
def draw(s, on): | |
global snow | |
s.clear() | |
# Star |