Skip to content

Instantly share code, notes, and snippets.

View cangevine's full-sized avatar

Colin Angevine cangevine

View GitHub Profile
abstract class Pokemon extends GameObject{
int currentHP;
int maxHP;
PImage leftImg, rightImg;
float yVel;
float GRAV = .5;
float xVel;
float xAcc;
void moveRight() {
@cangevine
cangevine / gist:b007a42d3255c31d69a1
Created October 2, 2014 02:40
Test your Stack implementation
// Notice: the Node should have a toString() method
// which returns the <content> instance variable
void setup() {
Node a = new Node("123");
Node b = new Node("456");
Node c = new Node("789");
Stack s = new Stack();
s.push(a);
String alphabet = "abcdefghijklmnopqrstuvwxyz";
void setup() {
String plaintext = "happy monday, everyone!";
String ciphertext = encrypt(plaintext, 1);
println(ciphertext);
}
void draw() {
}
float startAngle;
float angleVel;
float amp;
void setup() {
startAngle = 0;
angleVel = 0.4;
amp = 100;
size(500, 500);
}
void setup() {
size(500, 500);
}
void draw() {
background(255);
float period = 50;
float amplitude = 200;
Train t;
void setup() {
t = new Train();
size(500, 500);
}
void draw() {
background(255);
t.update();
@cangevine
cangevine / gist:9106964
Last active August 29, 2015 13:56
Race
public class Race {
public static void main(String[] args) {
Race r = new Race();
try {
r.beginRace();
} catch (InterruptedException e) {
System.out.println("Unable to execute race...");
}
System.out.println(rt.getWinnersList());
@cangevine
cangevine / gist:9106929
Last active August 29, 2015 13:56
Racer
interface Racer {
boolean crossedFinishLine();
void tick();
void setTrack(String[] t);
int getTrackLength();
int getPositionOnTrack();
int getMaxSpeed();
int getMaxHandling();
}
public class Register {
public static void main(String[] args) {
System.out.println("Welcome to the cash register!");
double cost = 9.76;
double totalPaid = 20.00;
double change = totalPaid - cost;
int dollars = (int) Math.floor(change);
public class Reverser {
public static void main(String[] args) {
String input = "1 2 3";
String output = "";
System.out.println("Input :: "+input);
while (input.length() > 0) {
String element = input.substring(input.length() - 1, input.length());
output += element;
input = input.substring(0, input.length() - 1);