Skip to content

Instantly share code, notes, and snippets.

View Samuel-Retter's full-sized avatar

Samuel-Retter

View GitHub Profile
@Samuel-Retter
Samuel-Retter / Turtle_.idea_.name
Created January 1, 2016 20:49
Turtle graphics, L-ssytems, and fractals!
Turtle
@Samuel-Retter
Samuel-Retter / Comp_Geometry.py
Last active August 29, 2015 14:19
Demonstrates algorithms for solving several well-known problems in computational geometry including:1. Determining whether a polygon is convex2. Determining whether an ordered list of points represent a simple polygon3. Finding intersection points of line segments4. Finding the convex hull of a set of points5. Finding the minimum enclosing disc …
__author__ = 'Meir'
import random
import numpy as np
import pylab as pl
from matplotlib import collections as mc
from itertools import combinations, permutations
N = 50 # number of points
@Samuel-Retter
Samuel-Retter / Board.java
Last active August 29, 2015 14:17
Plays the game Othello against the user (quite competitively). The game was made with three classes: Board, OthelloGame, and Player.
/**
* Created by Meir on 1/21/2015.
*/
public class Board {
OthelloGame.CellState[][] data = new OthelloGame.CellState[SIZE][SIZE];
public static final int SIZE = OthelloGame.BOARD_SIZE;
public Board() {
@Samuel-Retter
Samuel-Retter / nqueensWithMatplotlib.py
Last active August 29, 2015 14:01
Solves the Nqueens puzzle (http://en.wikipedia.org/wiki/Eight_queens_puzzle) using simulated annealing. I provided links to images of some results in a comment.
__author__ = 'Samuel'
import time
from itertools import permutations
import random
import math
import matplotlib.pyplot as plt
e = math.e
n = 8 #default size of board, can be changed
@Samuel-Retter
Samuel-Retter / ConnectFour.py
Last active August 29, 2015 14:01
Plays the game of Connect Four against a human opponent.
__author__ = 'Samuel'
# Python 3.3
# Plays the game of Connect 4 against a human opponent
import random
# global constants
X = 'X'
O = 'O'
EMPTY = " "
@Samuel-Retter
Samuel-Retter / SteinerTreeFinder.py
Last active April 28, 2020 00:23
An iterative heuristic which attempts to fit a minimal Steiner tree (http://en.wikipedia.org/wiki/Steiner_tree_problem) to a given set of points. I provided links to images of some results in a comment.
__author__ = 'Samuel'
import random
import math
from itertools import combinations
import numpy as np
import pylab as pl
from matplotlib import collections as mc
from math import sin, cos, pi, factorial
import matplotlib.pyplot as plt