From 79552f28858859aa9e4d103b88f1337d59af1784 Mon Sep 17 00:00:00 2001 From: DennyLei Date: Tue, 9 Sep 2025 10:40:52 -0700 Subject: [PATCH 1/3] Update Scales.pde --- Scales.pde | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/Scales.pde b/Scales.pde index 42795d2..f475fc8 100644 --- a/Scales.pde +++ b/Scales.pde @@ -1,11 +1,34 @@ void setup() { - size(500, 500); //feel free to change the size - noLoop(); //stops the draw() function from repeating + size(400, 600); + noLoop(); } void draw() { - //your code here + background(255); + + int cols = 100; + int rows = 100; + int step = 20; + + int gridWidth = (cols - 1) * step; + int gridHeight = (rows - 1) * step; + + int offsetX = (width - gridWidth) / 2; + int offsetY = (height - gridHeight) / 2; + + for (int i = 0; i < rows; i++) { + for (int j = 0; j < cols; j++) { + scale(offsetX + j*step, offsetY + i*step); + } + } } void scale(int x, int y) { - //your code here + stroke(x+y, 0, 0); + fill(0, 0, 150, 50+x+(int)(Math.random()*60)); + beginShape(); + vertex(415 - x, 250 - y); + bezierVertex(430 - x, 340 - y, 470 - x, 340 - y, 485 - x, 250 - y); + vertex(415 - x, 250 - y); + endShape(CLOSE); } + From faca9e5d6c6dbffcf1c936e8057f1b4cb5382dbb Mon Sep 17 00:00:00 2001 From: DennyLei Date: Wed, 10 Sep 2025 09:19:55 -0700 Subject: [PATCH 2/3] Update Scales.pde --- Scales.pde | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Scales.pde b/Scales.pde index f475fc8..57812d1 100644 --- a/Scales.pde +++ b/Scales.pde @@ -22,13 +22,15 @@ void draw() { } } void scale(int x, int y) { + int sixseven = (int)(Math.random()*7); stroke(x+y, 0, 0); fill(0, 0, 150, 50+x+(int)(Math.random()*60)); beginShape(); - vertex(415 - x, 250 - y); - bezierVertex(430 - x, 340 - y, 470 - x, 340 - y, 485 - x, 250 - y); - vertex(415 - x, 250 - y); + vertex(415 - x + sixseven, 250 - y); + bezierVertex(430 - x + sixseven, 340 - y, 470 - x+ sixseven , 340 - y, 485 - x +sixseven, 250 - y); + vertex(415 - x + sixseven, 250 - y); endShape(CLOSE); } + From 7156adf0f6d51f457bb15462952e1295f707b4b2 Mon Sep 17 00:00:00 2001 From: DennyLei Date: Wed, 24 Sep 2025 14:06:37 -0700 Subject: [PATCH 3/3] Update Scales.pde --- Scales.pde | 139 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 108 insertions(+), 31 deletions(-) diff --git a/Scales.pde b/Scales.pde index 57812d1..5d02b95 100644 --- a/Scales.pde +++ b/Scales.pde @@ -1,36 +1,113 @@ -void setup() { - size(400, 600); - noLoop(); +int count = 0; +int[] primes = { + 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, + 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, + 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, + 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, + 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, + 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, + 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, + 353, 359, 367, 373, 379, + 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, + 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, + 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, + 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, + 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, + 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, + 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, + 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, + 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, + 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, + 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, + 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, + 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, + 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, + 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, + 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, + 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, + 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, + 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, + 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, + 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, + 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, + 2237, 2239, 2243, 2251, 2267, 2269, 2273 +}; +void setup() +{ + size(1000,600); + noLoop(); + bob = new Die(0,0); } -void draw() { - background(255); - - int cols = 100; - int rows = 100; - int step = 20; - - int gridWidth = (cols - 1) * step; - int gridHeight = (rows - 1) * step; - - int offsetX = (width - gridWidth) / 2; - int offsetY = (height - gridHeight) / 2; - - for (int i = 0; i < rows; i++) { - for (int j = 0; j < cols; j++) { - scale(offsetX + j*step, offsetY + i*step); +Die bob; +void draw() +{ + background(0); + for(int i=0;i<=500;i+=50){ + for(int j=0;j<=950;j+=50){ + bob = new Die(j,i); + bob.show(); + bob.roll(); + } } + rect(0,550,1000,600); + fill(255,255,255); + textSize(50); + if (isPrimeCount(count)) { + text("Total:" + count + " is in the prime list!", 160,590,100); + } else { + text("Total:" + count + " is NOT in the prime list!", 160,590,100); } } -void scale(int x, int y) { - int sixseven = (int)(Math.random()*7); - stroke(x+y, 0, 0); - fill(0, 0, 150, 50+x+(int)(Math.random()*60)); - beginShape(); - vertex(415 - x + sixseven, 250 - y); - bezierVertex(430 - x + sixseven, 340 - y, 470 - x+ sixseven , 340 - y, 485 - x +sixseven, 250 - y); - vertex(415 - x + sixseven, 250 - y); - endShape(CLOSE); +void mousePressed() +{ + redraw(); + count = 0; +} +boolean isPrimeCount(int count) { + for (int i = 0; i < primes.length; i++) { + if (count == primes[i]) { + return true; + } + } + return false; +} +class Die +{ + int myX, myY, myX2, myY2, number; + + Die(int x, int y) + { + number = (int)(Math.random()*6)+1; + myX = x; + myY = y; + myX2 = x+50; + myY2 = y+50; + + } + void roll() + { + number = (int)(Math.random()*6)+1; + count += number; + } + void show() + { + fill(255-(int)(Math.random()*50),255-(int)(Math.random()*50),255-(int)(Math.random()*50)); + rect(myX, myY, myX2, myY2); + fill(0); + if(number%2==1){ + ellipse(myX+25,myY+25,(25)/2,(25)/2); + } + if(number >= 3){ + ellipse(myX+15,myY+35,(25)/2,(25)/2); + ellipse(myX+35,myY+15,(25)/2,(25)/2); + } + if(number >= 4){ + ellipse(myX+15,myY+15,(25)/2,(25)/2); + ellipse(myX+35,myY+35,(25)/2,(25)/2); + } + if(number == 6 || number == 2){ + ellipse(myX+15,myY+25,(25)/2,(25)/2); + ellipse(myX+35,myY+25,(25)/2,(25)/2); + } + } } - - -