# Why is the above grammar not showing up?

**URL:** <https://discourse.processing.org/t/why-is-the-above-grammar-not-showing-up/7341>\
**Category:** Coding Questions\
**Created:** [January 9, 2019, 2:19am UTC](https://discourse.processing.org/t/why-is-the-above-grammar-not-showing-up/7341 "2019-01-09T02:19:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![alk5603](https://avatars.discourse-cdn.com/v4/letter/a/f14d63/32.png) [@alk5603](https://discourse.processing.org/u/alk5603)\
**Post date:** [January 9, 2019, 2:19am UTC](https://discourse.processing.org/t/why-is-the-above-grammar-not-showing-up/7341/1 "2019-01-09T02:19:23Z")

</div>

var mass = [];  
var positionX = [];  
var positionY = [];  
var velocityX = [];  
var velocityY = [];

/////////////////////////////////////////////////////////////////////////////////////////////////////

function setup() {  
createCanvas(windowWidth, windowHeight);  
noStroke();  
fill(255, 3, 0, 170);  
}

/////////////////////////////////////////////////////////////////////////////////////////////////////

function draw() {  
background(32);

for (var particleA = 0; particleA \< mass.length; particleA++) {  
var accelerationX = 0, accelerationY = 0;

```
for (var particleB = 0; particleB < mass.length; particleB++) {
  if (particleA != particleB) {
    var distanceX = positionX[particleB] - positionX[particleA];
    var distanceY = positionY[particleB] - positionY[particleA];

    var distance = sqrt(distanceX * distanceX + distanceY * distanceY);
    if (distance < 1) distance = 1;

    var force = (distance - 300) * mass[particleB] / distance;
    accelerationX += force * distanceX;
    accelerationY += force * distanceY;
  }
}

velocityX[particleA] = velocityX[particleA] * 0.99 + accelerationX * mass[particleA];
velocityY[particleA] = velocityY[particleA] * 0.99 + accelerationY * mass[particleA];

```

}

for (var particle = 0; particle \< mass.length; particle++) {  
positionX[particle] += velocityX[particle];  
positionY[particle] += velocityY[particle];

```
ellipse(positionX[particle], positionY[particle], mass[particle] * 1000, mass[particle] * 1000);

```

}  
}

/////////////////////////////////////////////////////////////////////////////////////////////////////

function addNewParticle() {  
mass.push(random(0.003, 0.03));  
positionX.push(mouseX);  
positionY.push(mouseY);  
velocityX.push(0);  
velocityY.push(0);  
}

/////////////////////////////////////////////////////////////////////////////////////////////////////

function mouseClicked() {  
addNewParticle();  
}

/////////////////////////////////////////////////////////////////////////////////////////////////////

function mouseDragged() {  
addNewParticle();  
}

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [January 9, 2019, 2:38am UTC](https://discourse.processing.org/t/why-is-the-above-grammar-not-showing-up/7341/2 "2019-01-09T02:38:46Z")

</div>

pls to make the code readable/usable  
paste it again using the

> \</\>

code formatter

or much better,  
open a account and run it at

> **[p5.js Web Editor](https://editor.p5js.org/)**
>
> A web editor for p5.js, a JavaScript library with the goal of making coding accessible to artists, designers, educators, and beginners.

also some more words about the problem,  
what is ?grammar?

---

<div class="post-metadata">

**Author:** ![alk5603](https://avatars.discourse-cdn.com/v4/letter/a/f14d63/32.png) [@alk5603](https://discourse.processing.org/u/alk5603)\
**Post date:** [January 9, 2019, 3:28am UTC](https://discourse.processing.org/t/why-is-the-above-grammar-not-showing-up/7341/3 "2019-01-09T03:28:08Z")

</div>

Thanks for the big reply

---

<div class="post-metadata">

**Author:** ![dan850](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@dan850](https://discourse.processing.org/u/dan850)\
**Post date:** [January 9, 2019, 8:23am UTC](https://discourse.processing.org/t/why-is-the-above-grammar-not-showing-up/7341/4 "2019-01-09T08:23:43Z")

</div>

@alk5603 Did the reply make sense? Let us know if you need anymore assistance. Best of Luck!

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [January 9, 2019, 12:43pm UTC](https://discourse.processing.org/t/why-is-the-above-grammar-not-showing-up/7341/5 "2019-01-09T12:43:49Z")

</div>

> [@alk5603](#):
>
> Thanks for the big reply

sorry, but i am serious about that,  
in month you open 12 threads, some with posting unreadable code like this,  
i not want to check on how many times already you have been asked to format your code.

so please…  
repair above code pasting, once you learned how to do,  
you might see that it is so easy ( and fast ? under a second ? )

and again?  
pls. tell us in other words where you see a problem ? code/line

- what happen
- what error msg.
- possibly a screenshot?
