# I would love some help on this code I am extremely stuck

**URL:** <https://discourse.processing.org/t/i-would-love-some-help-on-this-code-i-am-extremely-stuck/29858>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [May 4, 2021, 7:49pm UTC](https://discourse.processing.org/t/i-would-love-some-help-on-this-code-i-am-extremely-stuck/29858 "2021-05-04T19:49:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yoda9633](https://avatars.discourse-cdn.com/v4/letter/y/ecccb3/32.png) [@yoda9633](https://discourse.processing.org/u/yoda9633)\
**Post date:** [May 4, 2021, 7:49pm UTC](https://discourse.processing.org/t/i-would-love-some-help-on-this-code-i-am-extremely-stuck/29858/1 "2021-05-04T19:49:28Z")

</div>

![Screen Shot 2021-05-04 at 11.03.11 AM](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/ff4e8541a0190713ea365a57a7af4cd0d32bc1c3.png)

I can’t get the square to go with the coordinate. I don’t know why its not syncing.

---

<div class="post-metadata">

**Author:** ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)\
**Post date:** [May 4, 2021, 8:08pm UTC](https://discourse.processing.org/t/i-would-love-some-help-on-this-code-i-am-extremely-stuck/29858/2 "2021-05-04T20:08:50Z")

</div>

Break the problem down into steps.

You know you have four cases.

So for the first step, determine which one of the four cases you have.

Then, once you know which case it is, draw a square in the right place.

* * *

It’s impossible to help you more without seeing your current code.

---

<div class="post-metadata">

**Author:** ![yoda9633](https://avatars.discourse-cdn.com/v4/letter/y/ecccb3/32.png) [@yoda9633](https://discourse.processing.org/u/yoda9633)\
**Post date:** [May 4, 2021, 8:17pm UTC](https://discourse.processing.org/t/i-would-love-some-help-on-this-code-i-am-extremely-stuck/29858/3 "2021-05-04T20:17:54Z")

</div>

![Screen Shot 2021-05-04 at 2.16.52 PM](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/d/dda56dfd4e94aa442d2dc077edb05cd32d10a8a9.png)

This is my code right now am I doing the var xCoor Correctly?

---

<div class="post-metadata">

**Author:** ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)\
**Post date:** [May 4, 2021, 9:39pm UTC](https://discourse.processing.org/t/i-would-love-some-help-on-this-code-i-am-extremely-stuck/29858/4 "2021-05-04T21:39:10Z")

</div>

I think you’ve misunderstood the task.

The `xCoor` and `yCoor` values are NOT the position of the yellow square. They are a point that could be anywhere. Your job is to determine which quadrant the point `(xCoor, yCoor)` is in, and then highlight that quadrant in yellow.

Your code should look like this:

```auto
var xCoor = random(400);
var yCoor = random(400); // Notice I have filled these in with a random value.

function setup() {
  createCanvas(400,400);
  background(0);
}

void draw() {
  // Step 1: Determine which case is happening this time.
  // TODO - Work out which quadrant the random point is in.

  // Step 2: Draw a yellow square in the right place.
  // TODO - Draw one of the four possible cases.
  // NOTE: The correct position for the yellow square is NOT (xCoor, yCoor) !
}

```
