Appearance
Here's some helpful links and notes on what we coverd this week
Git, Github, and Github Pages
Pseudocode
Pseudocode is a way of planning out our code by first writing what we want a program to do in a logical and programmatic way, but without the cruft of actual code syntax. We've been doing exercises in commenting out psuedocode-like comments in class exercises throughout the semester, but it's worth examining closer here.
For example, what if we wanted to write a program that drew a lot of circles?
// make a list of positions
// this list starts as an empty array that is then filled with vectors
// define a number variable as the maximum size of our list
// setup loop
// the vectors will be generated randomly based on the width and height of the canvas
// we'll generate vectors until the length of our list is equal to the maximum size we defined above
// draw loop
// for every position in our list, we'll draw a circle at that position
// IF the circle is on the left side of the canvas, it is colored purple
// OTHERWISE the circle is colored teal
From here, we can start stamping out the actual syntax of our program once we feel confident in the logic and structure of what we're outlining.
// make a list of positions
// this list starts as an empty array that is then filled with vectors
let circles = []
let max = 100
// setup loop
function setup() {
// we'll generate vectors until the length of our list is equal to the maximum size we defined above
for(let i = 0; i < max; i++){
// the vectors will be generated randomly based on the width and height of the canvas
circles.push(createVector)
}
}
// draw loop
function draw() {
background(88)
// for every position in our list, we'll draw a circle at that position
for(let i = 0; i < circles.length; i++) {
// IF the circle is on the left side of the canvas, it is colored purple
if(circles[i].x < width / 2) {
fill(180, 200, 45)
}
// OTHERWISE the circle is colored teal
else {
fill(45, 180, 200)
}
ellipse(circles[i].x, circles[i].y, 25, 25)
}
}
This is just one way to write pseudo code, so it's worth looking into what approach works for you. Here are examples of other people's approaches: