2020-09-22 04:57:56 -07:00
|
|
|
import java.util.*;
|
|
|
|
|
2020-09-16 06:45:50 -07:00
|
|
|
int size = 250;
|
|
|
|
int weight = 20;
|
2020-09-22 04:57:56 -07:00
|
|
|
int cellSize = 20;
|
|
|
|
int gridSize = 5;
|
2020-09-16 06:45:50 -07:00
|
|
|
int repetitions = int(random(5));
|
|
|
|
int dir = int(random(0, 2));
|
|
|
|
|
|
|
|
void setup() {
|
|
|
|
size(500, 500);
|
|
|
|
}
|
|
|
|
|
|
|
|
void draw() {
|
|
|
|
background(255);
|
|
|
|
stroke(0);
|
|
|
|
fill(255);
|
|
|
|
strokeWeight(weight);
|
|
|
|
float centerW = (width/2)-(size/2);
|
|
|
|
float centerH = (height/2)-(size/2);
|
|
|
|
rect(centerW, centerH, size, size);
|
|
|
|
strokeCap(SQUARE);
|
|
|
|
stroke(0);
|
|
|
|
strokeWeight(weight/2);
|
|
|
|
//fill(255);
|
2020-09-22 04:57:56 -07:00
|
|
|
//float startX = centerW + weight;
|
|
|
|
//float startY = centerH + weight;
|
|
|
|
//line(startX, startY, startX + (gridSize*repetitions*(1-dir)), startY + (gridSize*repetitions*dir));
|
|
|
|
}
|
|
|
|
|
|
|
|
class Grid {
|
|
|
|
grid = int[gridSize][gridSize];
|
|
|
|
|
|
|
|
void fillGrid() {
|
|
|
|
// pick a random empty cell
|
|
|
|
int X = int(random(0, gridSize));
|
|
|
|
int Y = int(random(0, gridSize));
|
|
|
|
// pick a length for the line
|
|
|
|
int len = int(random(0, 5));
|
|
|
|
// choose a direction to extend the 'head' of the line from
|
|
|
|
int dir = int(random(0, 4));
|
|
|
|
|
|
|
|
// repeat until length of line is reached
|
|
|
|
// repeat until grid is filled
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class Line {
|
|
|
|
LinkedList line = new LinkedList();
|
|
|
|
|
|
|
|
void add(int point) {
|
|
|
|
line.add(point);
|
|
|
|
}
|
|
|
|
|
|
|
|
void draw() {
|
|
|
|
// for each point in the list
|
|
|
|
// draw a line for each adjacent point
|
|
|
|
// translate it to the screen position
|
|
|
|
}
|
2020-09-16 06:45:50 -07:00
|
|
|
}
|