From ba582177613959ed67964cb04768a2aef41ae5dc Mon Sep 17 00:00:00 2001 From: itislucyyaaa <142839187+itislucyyaaa@users.noreply.github.com> Date: Thu, 5 Oct 2023 11:57:29 -0700 Subject: [PATCH 1/6] Update Dice.pde --- Dice.pde | 133 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 108 insertions(+), 25 deletions(-) diff --git a/Dice.pde b/Dice.pde index 2817de52..a4ee51eb 100644 --- a/Dice.pde +++ b/Dice.pde @@ -1,29 +1,112 @@ -void setup() -{ - noLoop(); +Die bob; +int c=0; +int total=0; + +void mousePressed(){ + total=0; + redraw(); } -void draw() -{ - //your code here + +void setup(){ + size(600,600); + background(227,165,198); + bob = new Die(40,40); + noLoop(); } -void mousePressed() -{ - redraw(); + +void draw(){ + fill(227,165,198); + noStroke(); + rect(300,550,200,80); + for (int b=40; b<=500; b+=130){ + for (int a=40; a<=500; a+=130){ + bob = new Die(a,b); + bob.show(); + bob.roll(); + total=total+c; + } + } + textSize(28); + text("total dots: "+total,300,570); } -class Die //models one single dice cube -{ - //variable declarations here - - Die(int x, int y) //constructor - { - //variable initializations here - } - void roll() - { - //your code here - } - void show() - { - //your code here - } + +class Die{ + boolean one = false; + boolean two = false; + boolean three = false; + boolean four = false; + boolean five = false; + boolean six = false; + int myX, myY; + int num=(int)(Math.random()*6+1); + void roll(){ + if (num == 1){ + one=true; + c=1; + }else if (num==2){ + two=true; + c=2; + }else if (num==3){ + three=true; + c=3; + }else if (num==4){ + four=true; + c=4; + }else if (num==5){ + five=true; + c=5; + }else if (num==6){ + six=true; + c=6; + } + } + void show(){ + stroke(255,255,255); + strokeWeight(8); + fill(227,165,198); + rect(myX,myY,100,100); + fill(255,255,255); + noStroke(); + if (one==true){ + //one + ellipse(myX+50,myY+50,20,20); + }else if (two==true){ + //two + ellipse(myX+30,myY+30,20,20); + ellipse(myX+70,myY+70,20,20); + }else if (three==true){ + //three + ellipse(myX+20,myY+20,20,20); + ellipse(myX+50,myY+50,20,20); + ellipse(myX+80,myY+80,20,20); + }else if (four==true){ + //four + ellipse(myX+20,myY+20,20,20); + ellipse(myX+80,myY+80,20,20); + ellipse(myX+20,myY+80,20,20); + ellipse(myX+80,myY+20,20,20); + } + else if (five==true){ + //five + ellipse(myX+50,myY+50,20,20); + ellipse(myX+20,myY+20,20,20); + ellipse(myX+80,myY+80,20,20); + ellipse(myX+20,myY+80,20,20); + ellipse(myX+80,myY+20,20,20); + } + else if (six==true){ + //six + ellipse(myX+30,myY+20,20,20); + ellipse(myX+70,myY+20,20,20); + ellipse(myX+30,myY+50,20,20); + ellipse(myX+70,myY+50,20,20); + ellipse(myX+30,myY+80,20,20); + ellipse(myX+70,myY+80,20,20); + } + } + Die(int x,int y){ + roll(); + myX = x; + myY = y; + } } From 0d06c945ea35c379e3901a708f2516c65e91499f Mon Sep 17 00:00:00 2001 From: itislucyyaaa <142839187+itislucyyaaa@users.noreply.github.com> Date: Thu, 5 Oct 2023 11:58:53 -0700 Subject: [PATCH 2/6] Update index.html --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 4f850efb..1a3fbcf6 100644 --- a/index.html +++ b/index.html @@ -15,7 +15,7 @@

Headline

From 317f7e3c1b40d88404c35385789c9ac66c831232 Mon Sep 17 00:00:00 2001 From: itislucyyaaa <142839187+itislucyyaaa@users.noreply.github.com> Date: Thu, 5 Oct 2023 12:03:13 -0700 Subject: [PATCH 3/6] Update Dice.pde --- Dice.pde | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dice.pde b/Dice.pde index a4ee51eb..a3cbe444 100644 --- a/Dice.pde +++ b/Dice.pde @@ -1,5 +1,5 @@ Die bob; -int c=0; +int c=0; int total=0; void mousePressed(){ From d1bcdf3f4aa9afb4c250b8ccfe348f5f447c90f0 Mon Sep 17 00:00:00 2001 From: itislucyyaaa <142839187+itislucyyaaa@users.noreply.github.com> Date: Thu, 5 Oct 2023 14:12:47 -0700 Subject: [PATCH 4/6] Update Dice.pde From 9b4db10fe741e46d57d3532d882845d77c43a58b Mon Sep 17 00:00:00 2001 From: itislucyyaaa <142839187+itislucyyaaa@users.noreply.github.com> Date: Thu, 5 Oct 2023 14:14:01 -0700 Subject: [PATCH 5/6] Update index.html --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 1a3fbcf6..d51d1911 100644 --- a/index.html +++ b/index.html @@ -8,7 +8,7 @@
-

Headline

+

Pink Dice

From 1da31925fffebf3cbf374fa0a9b75187c00a6443 Mon Sep 17 00:00:00 2001 From: itislucyyaaa <142839187+itislucyyaaa@users.noreply.github.com> Date: Thu, 5 Oct 2023 14:27:47 -0700 Subject: [PATCH 6/6] Update dice programming --- Dice.pde | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Dice.pde b/Dice.pde index a3cbe444..df816e8e 100644 --- a/Dice.pde +++ b/Dice.pde @@ -1,5 +1,5 @@ Die bob; -int c=0; +int d=0; int total=0; void mousePressed(){ @@ -23,7 +23,7 @@ void draw(){ bob = new Die(a,b); bob.show(); bob.roll(); - total=total+c; + total=total+d; } } textSize(28); @@ -42,22 +42,22 @@ class Die{ void roll(){ if (num == 1){ one=true; - c=1; + d=1; }else if (num==2){ two=true; - c=2; + d=2; }else if (num==3){ three=true; - c=3; + d=3; }else if (num==4){ four=true; - c=4; + d=4; }else if (num==5){ five=true; - c=5; + d=5; }else if (num==6){ six=true; - c=6; + d=6; } } void show(){