-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPegs.pde
43 lines (29 loc) · 990 Bytes
/
Pegs.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
class Pegs{
float levels, xPos, l = 400;
boolean[] occupied = new boolean[5]; // Boolean array for occupied spaces, NEVER USED
// Default constructor
public Pegs() {
levels = 10; // Giving the number of total discs allowed on a peg
for (boolean occup : occupied) { // Auto initializing the occupancy of the levels
occup = false;
}
xPos = 0;
}
// Constructor
public Pegs(float x) {
levels = 10; // Giving the number of total discs allowed on a peg
for (boolean occup : occupied) { // Auto initializing the occupancy of the levels
occup = false;
}
xPos = x;
}
// Method to update the level occupancy of the peg
void updatePeg() {
}
// Method to draw the peg
void showPeg() {
fill(84, 43, 0); // Brown colour for the peg
rectMode(CENTER);
rect(xPos, height - (l/2), 25, l);
}
}