Skip to content

Instantly share code, notes, and snippets.

View Siunami's full-sized avatar

Matthew Siu Siunami

View GitHub Profile
@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) {
@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 / 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;
/*
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};