Built with blockbuilder.org
View random-walk
var colors = ["red", "blue", "green", "yellow"]; | |
var directions = [up, down, left, right]; | |
while (remainingDots() > 0) { | |
directions[Math.floor(Math.random()*directions.length)](); | |
setColor(colors[Math.floor(Math.random()*colors.length)]); | |
} |
View gist:4e0c3af1bc2aa2c0532e
def determine_winner(board): | |
""" board takes the form of a String | |
with the indices representing each | |
of these squares: | |
0 | 1 | 2 | |
---+---+--- | |
3 | 4 | 5 | |
---+---+--- | |
6 | 7 | 8 |
View seconds.ino
const int numPins = 12; | |
const int pins[] = {2,3,4,5,6,7,8,9,10,11,12,13}; | |
void setup() { | |
for (int i = 0; i < numPins; ++i) { | |
pinMode(pins[i], OUTPUT); | |
} | |
} | |
int litPin = 0; |
View stillness.ino
const int numPins = 12; | |
const int pins[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; | |
const int motionSensePin = A0; | |
void setup() { | |
for (int i = 0; i < numPins; ++i) { | |
pinMode(pins[i], OUTPUT); | |
} | |
pinMode(motionSensePin, INPUT); |
View modified cap sense
#include <CapacitiveSensor.h> | |
/* | |
* CapitiveSense Library Demo Sketch | |
* Paul Badger 2008 | |
* Uses a high value resistor e.g. 10M between send pin and receive pin | |
* Resistor effects sensitivity, experiment with values, 50K - 50M. Larger resistor values yield larger sensor values. | |
* Receive pin is the sensor pin - try different amounts of foil/metal on this pin | |
*/ |
View .block
license: mit |
View cycling-hue.js
background(255); | |
noStroke(); | |
var h = 0; | |
while(true) { | |
background(255); | |
colorMode(HSB); | |
fill(h, 100, 100); | |
ellipse(width/2, height/2, 100, 100); |
View random-circles.js
background(255); | |
strokeWeight(3); | |
colorMode(HSB); | |
while (true) { | |
var h = random(360) | |
stroke(h, 50, 90); | |
fill(h, 50, 100); | |
var r = random(30, 60); |
OlderNewer