Skip to content

Instantly share code, notes, and snippets.

View cdarringer's full-sized avatar

Chris Darringer cdarringer

View GitHub Profile
# -*- coding: utf-8 -*-
"""
Simple compunding interest calculator.
Created on Sat May 7 12:48:37 2016
@author: Chris Darringer
"""
def main():
# read inputs
@cdarringer
cdarringer / pi.py
Last active August 29, 2015 14:17
Random number pi calculator
"""Calculate pi using a random number generator
Calculate pi with progressively increasing accuracy using a random
number generator and some basic properties about circles and area.
Happy "pi day"!
@cdarringer
cdarringer / animals.py
Created December 10, 2013 03:49
My daughter's first experiment with python
"""The Animal Guessing Game
dichotomous keys and python
author: Frances Darringer, age 9
"""
def main():
print "Hello, and welcome to the animal guess game!"
print "In this game, I will give you a list of 7 animals. They are: "
print "(1) Panda"
print "(2) Dolphin "
@cdarringer
cdarringer / life.py
Created November 20, 2013 04:47
This is your life (according to Conway)
"""This is your life (according to Conway)
Conway's Game of Life http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life
involved a grid of cells, some alive and some dead, and a set of rules that
determine whether a given cell "lives" to the next generation or dies.
This was my first real experiment with python, and exercised some of the
basic control functions, data structures, and features of the language.
The user can either select a random grid of cells or grid of cells
composed of the characters in their name.
@cdarringer
cdarringer / railroad_xing.ino
Created October 11, 2013 03:15
Arduino railroad crossing, as seen in the following video: http://www.youtube.com/watch?v=2RXiLh64U6o
/*
Railroad crossing controller
*/
#include <Servo.h>
// Constants
const int CYCLE_PERIOD_MS = 10;
const int SENSOR_DELTA_THRESHOLD = 20;