/*
- Unit 1: careful, precise review of critical topics
variables - 2d arrays
- Unit 2: Recursion
- Unit 3: Object-oriented programming (OOP)
organizing around classes, and what different "objects" can do
quiz in each of 3 units
*/
// Lesson #01 - Graphing
/*
Review of variables, types, calculations, if-statements
Functions (include inputs and outputs)
float winLf = -10, winRt = 10, winTop = 10, winBot = -10;
// expressing boundaries of our window's graphing coordinate system
// variable
// - placeholder to refer to info
// - stores data
// - always known (sometimes with default value)
// float, double - decimals
// int, byte, long, short - integers
//boolean - true/false
// char - one single character
// object types:
// arrays
// String
// classes
float px = winLf, py = 0;
int choice = 0;
void setup() {
// defining setup here - defines what happens
// when it is called
// (in this case, automatic call)
size(600,600);
colorMode(HSB, 360, 100, 100, 100);
// H - Hue - color of rainbow
// S - Saturation - colorful/faded
// B - Brightness
int i = 8;
int fourI = 4 * i;
i *= 4;
println(i % 3);
println((float) i / 3);
println( i / 3.0);
println(i / 3f);
boolean firstClass = true;
if (firstClass) {
println("welcome!");
}
else if (i > 10) {
println("here's " + i);
}
else {
println("?");
}
}
void draw() {
background(0);
fill(0, 10, 255);
noStroke();
rect(0, 0, width, height);
drawAxes();
drawGraph();
drawPoint();
}
void drawAxes() {
}
void drawGraph() {
}
void drawPoint() {
py = myFunc(px);
// px's value will be retrived, and sent in to the inpit variabl of function (x)
// input value / argument
}
float myFunc(float x) {
if (choice == 0) return 5 * sin(x);
if (choice == 1) return x * x / 5 - 5;
return x;
// anything returned earlier prevents any further code being run
}
/*
Lesson04a_Arrays
void setup() {
int[] nums;
// array - stores multiple elements of a single type
// type: int[] "int array" "array of ints"
String[] additions = new String[num.length / 2];
int numIndex = 0;
for (int i = 0; i < additions.length; i++) {
additions[i] = nums[2*i + "+" + nums[2 + i + 1];
numIndex += 2;
int[] old = numss;
nums = new int[old.length * 2];
for (int i = 0; i < nums.length; i++) {
nums[i] = old[i % old.length];
}
println(nums[8]);
nums = new int[]{3, 1, 4};
}
}
*/