Skip to content

Instantly share code, notes, and snippets.

View Siunami's full-sized avatar

Matthew Siu Siunami

View GitHub Profile
/*
Created by Matthew Siu on 2017-1-17.
http://www.matthewsiu.com/
https://github.com/Siunami
https://www.linkedin.com/in/matthewwilsonsiu
*/
// BEGIN WITH PIN 5
// This can be changed to any starting values desired
int pinState[10] = {LOW, LOW, LOW, LOW, HIGH, LOW, LOW, LOW, LOW, LOW};
@Siunami
Siunami / explodingdots.pde
Last active January 29, 2017 01:59
Processing Sketch
public class Shooter {
float x;
float y;
color colour = color(random(0,255), random(0,255), random(0,255));
float xspeed = random(-10,10);
float yspeed = random(-10,10);
Shooter(float x, float y) {
this.x = x;
this.y = y;
@Siunami
Siunami / LQueue.C
Last active February 1, 2017 00:50
CPSC 221 UBC: Move a queue value to the front
// Input is a queue
// Ex : 100,200,300,400,500
// key = an element in the queue
void Queue::move_to_front(const QueueElement & key) {
Node *curr = myFront;
Node *temp = myFront;
int moreVal = true;
cout << "Debug: " << endl;
cout << curr->data << endl;
@Siunami
Siunami / LQueue.C
Created February 1, 2017 19:49
Merge_two_queues function
Queue Queue::merge_two_queues(Queue & q){
NodePointer queue1 = myFront;
NodePointer queue2 = q.myFront;
Queue newQueue;
while (queue1 != NULL || queue2 != NULL){
if (queue1 == NULL){
newQueue.enqueue(queue2->data);
queue2 = queue2->next;
} else if (queue2 == NULL) {
0x11097196F2a9b613Fde623fEF2162edfE6037d24
@Siunami
Siunami / Mouse Interaction Gallery.js
Last active December 27, 2017 20:25
A series of creative experiences using the mouse
import java.util.Calendar;
class Node extends PVector {
PVector velocity = new PVector();
float minX=5, minY=5, maxX=width-5,maxY=height-5;
float damping = 0.000001;
int r,g,b;
int trailLength = 5;
@Siunami
Siunami / Bombs.js
Last active December 27, 2017 20:24
var WIDTH = 600;
var HEIGHT = 400;
function setup() {
createCanvas(WIDTH,HEIGHT);
}
var bombs = [];
var particles = [];
@Siunami
Siunami / GenerativeTree.js
Created December 27, 2017 20:29
Click to drop a seed that grows into a tree
//TODO:
// Fix leaves so that they are actually on the tree.
// Right now leaves blow in the wind
var WIDTH = 500;
var HEIGHT = 600;
function setup() {
createCanvas(WIDTH,HEIGHT);
smooth();
// Daniel Shiffman
// http://codingtra.in
// http://patreon.com/codingtrain
// Code for: https://youtu.be/BjoM9oKOAKY
function Particle() {
this.pos = createVector(random(width), random(height));
this.vel = createVector(0, 0);
this.acc = createVector(0, 0);
this.maxspeed = 2;