Skip to content

Instantly share code, notes, and snippets.

View mathemakitten's full-sized avatar
🐳
have a whaly nice day

helen ngo mathemakitten

🐳
have a whaly nice day
View GitHub Profile
@mathemakitten
mathemakitten / tictactoe.py
Last active July 29, 2019 00:29
Tic Tac Toe
# Tic Tac Toe
# Initialize Board class and define methods
class Board:
def __init__(self):
""" This is the state of the game, where 0 = occupied by O, 1 = occupied by X, None = empty """
self.game_state = [[None, None, None], [None, None, None], [None, None, None]]
self.board_full = False
self.dictionary = {0: 'O', 1: 'X', None: ' '}
@mathemakitten
mathemakitten / neural_network.py
Created July 22, 2019 02:24
Simple neural network implementation
# Implementing a neural network from scratch
# Input: X, a matrix of predictors
# Input: y, a matrix of labels
# Return: A matrix of predictions
# Architecture: Two layers feedforward neural network
import numpy as np
# Activation function σ(x)
def sigmoid(x):