Skip to content

Instantly share code, notes, and snippets.

View knosmos's full-sized avatar
💭
making things work

Jieruei Chang knosmos

💭
making things work
View GitHub Profile
@knosmos
knosmos / xor_network.py
Created January 31, 2024 22:33
From-scratch neural network implemention
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))
@knosmos
knosmos / wordle_solver.py
Created January 28, 2022 17:59
Wordle guesser
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":
@knosmos
knosmos / delaunay.py
Last active January 6, 2022 15:24
Delaunay triangulation visualization with pygame
# 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)
@knosmos
knosmos / festive.py
Created January 1, 2022 01:50
A small curses python program to draw a festive blinking christmas tree
import curses, time, random
from curses import wrapper
snow = []
def draw(s, on):
global snow
s.clear()
# Star