Skip to content

Instantly share code, notes, and snippets.

View ulrichzwingli's full-sized avatar

ulrichzwingli

View GitHub Profile
@ulrichzwingli
ulrichzwingli / W2_A1.py
Created September 17, 2017 23:48
codeLiteracy_Week2_Assignment1
amIAlive = Yes # Binary answer to my existence
numOfRecipes = 3 # number of recipes i know how to cook
myFav = "Priyanka Chopra" # My Favourite Actor
myGPA = 8.3 # My GPA score in undergrad
myFavTvshows = ["24", "Game of Thrones", "Suits", "Fringe", "Black Mirror"]. # Favourite TV shows
baywatchCast = { "Director" : "Seth Gordon", "Lead Actor" : "Dwayne Johnson", "Villian" : "Priyanka Chopra"} # Cast and crew of Baywatch
@ulrichzwingli
ulrichzwingli / gist:9be4cdf777bd78fbe063a7a64758ac7b
Created September 23, 2017 09:27
Physical_computing_lightUp3Leds
// to illuminate 3 leds
int ledArray[ ] = {2,4,7};
void setup() {
for(int i = 0, i < 3, i++) {
pinMode(ledArray[i], OUTPUT);
}
}
void loop() {
@ulrichzwingli
ulrichzwingli / gist:9dc2ecf68ec2af4846767bed15ed9bee
Created September 25, 2017 13:58
code to dim LED as i change the resistance of the potentiometer
void setup() {
Serial.begin(9600);
pinMode(11, OUTPUT);
}
void loop() {
int state = analogRead(pin);
brightness = state*(255/1023);
@ulrichzwingli
ulrichzwingli / rollet.py
Created September 26, 2017 16:20
more of a Pseudo code for playing Beginners Rollet (with Limitations)
# allocating numbers to rollet categories
for rollet in range (36)
// initializing cell counts of categories to zero
rcc = 0, bcc = 0, ecc = 0, occ = 0, dz2c = 0, dz3c = 0, fh=0, sh=0, r1=0,r2=0,r3=0
if (rollet <=1 and rollet >= 10)
y = rollet % 2
if (y is 0):
bcc +=1, ecc +=1
black[bcc] = rollet
even[ecc] = rollet
@ulrichzwingli
ulrichzwingli / gist:06e8ef836aab7aaf921be73e9aaa992a
Created October 1, 2017 02:18
Physical computing : Combination Lock
/*
sketch to open a digital lock
*/
int attemptCount = 0;
int lastButtonState3 = 0;
int lastButtonState4 = 0;
int lastButtonState5 = 0;
int lastButtonState6 = 0;
int buttonState3;
int buttonState4;
@ulrichzwingli
ulrichzwingli / gist:6760d2b63ac5467393e1e726a53aec1f
Created October 1, 2017 02:26
Potentiometer variable resistance lighting up LEDs
int analog_range;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(8, OUTPUT);
pinMode(13, OUTPUT);
}
void loop() {
int analog_range;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(8, OUTPUT);
pinMode(13, OUTPUT);
}
void loop() {
score = 0
oddNumList=[] # declare an array
evenNumList=[]
firstHalfList=[]
secHalfList=[]
firstDozen=[]
secDozen=[]
thirdDozen=[]
row1=[]
row2=[]
@ulrichzwingli
ulrichzwingli / gist:0c29b15f358b9246123446bb44db79f8
Created October 2, 2017 17:38
Exploring Turtle : Random images
from turtle import *
import random
colors = ['orange', 'yellow', 'red', 'green', 'blue','cyan']
for n in range(50):
penup()
goto(random.randint(-400, 400), random.randint(-400, 400))
pendown()
distance = random.randint(10, 40)
score = 0
denomination = 0
oddNumList=[] # declare an array
evenNumList=[]
firstHalfList=[]
secHalfList=[]
firstDozen=[]
secDozen=[]
thirdDozen=[]
row1=[]