Skip to content

Instantly share code, notes, and snippets.

View racecraftr's full-sized avatar
💭
neutral

Avi Gupta racecraftr

💭
neutral
View GitHub Profile
@racecraftr
racecraftr / sqrt_sketch.pde
Created October 13, 2018 20:47
Code for calculating a square root on processing
import java.util.Scanner;// this is to get the user input
String input = "";
int num = 0;
void setup() {
size(400,200);// click on the screen to start up the program
intro();
@racecraftr
racecraftr / FontStuff
Created October 13, 2018 22:19
a program that makes chars in the formation of that char (A will use the Letter A on different lines to make A)
package com.avi.font;
import java.util.HashMap;
import java.util.Map;
public class Letter {
public static final Letter A = new Letter ('A', new int[]{14, 17, 17, 31, 17, 17,17});
public static final Letter B = new Letter ('B', new int[]{15, 17, 17, 15, 17, 17,15});
public static final Letter C = new Letter ('C', new int[]{31, 1, 1, 1, 1, 1, 31});
public static final Letter D = new Letter ('D', new int[]{15, 17, 17, 17, 17, 17, 15});
@racecraftr
racecraftr / Sierpinskis_triangle_2.pde
Last active October 7, 2019 15:31
Makes the Sierpinski triangle.
class Point {
float x, y;
Point (float x, float y) {
this.x = x;
this.y = y;
}
}
class Triangle {
Point[] vertices = new Point[3];
Triangle(Point p1, Point p2, Point p3) {
// global constants
int wallAcross = 19;
int wallDown = 4;
int brickWidth = 50;
int brickHeight = 20;
/*
this is the class that makes the ball
the ints define the xy position, the radius of the ball
@racecraftr
racecraftr / colorMandelbrotSet.pde
Last active October 7, 2019 15:26
Makes a colorful mandelbrot set.
// you might have to wait a while to see the mandelbrot set.
// play around with the amount of iterations to get a different result every time!
size(600, 600);// sets the size.
noLoop();
background(0);// background is black.
colorMode(HSB, 360, 100, 100);// sets the color mode to HSB values.
float w = 4;// width of the set
float h = (w*height)/width;// height of the set
@racecraftr
racecraftr / cardioid.pde
Last active October 7, 2019 15:26
makes a colorful cardioid!
// declares the universal variables: r (radius) and theta (the angle)
float r;
float theta;
//sets up the program.
void setup(){
size(600, 600);//*
r = height * .25;// radius is 1/4 of the height. (this doesn't matter later)
theta = 0;//*
background(0);//*
@racecraftr
racecraftr / multiCardiPoint.pde
Last active October 7, 2019 15:26
make a cool cardioid!
// initalize the variables
float r, b;// r is the radius, b defines how many lobes it has
float theta;// theta is the angle
// sets up the program
void setup() {
size(600, 600);
r = height * .25;
b = 3;// the number of lobes will always be b-1. this will produce 2 lobes*
theta = 0;// initializes theta*
//initialize the variables
float r, b;// r is the radius, b defines the number of lobes it has
float theta;// theta is the angle
// set up the screen
void setup() {
size(600, 600);// *
r = height * .25;// doesn't matter later
b = 2;// the number of lobes = (b-1) *
theta = 0;//*
I want to <v> a <n> really badly, but Mom won't let me because it is<nl>"too <adj>."<tab>[10]
I want to tour a sunlamp really badly, but Mom won't let me because it is
"too miserly."
I want to unfasten a herbs really badly, but Mom won't let me because it is
"too untimely."
I want to exceed a blackness really badly, but Mom won't let me because it is
"too stunning."
I want to classify a stitch really badly, but Mom won't let me because it is
"too authentic."
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
private String getRandomLine(String path){
List<String> lines;
try{
lines = Files.readAllLines(Paths.get(path));
}