# Help to start color sequence in the game "Simon says" in Processing

**URL:** https://discourse.processing.org/t/help-to-start-color-sequence-in-the-game-simon-says-in-processing/882
**Category:** Coding Questions
**Created:** [June 11, 2018, 7:46pm UTC](https://discourse.processing.org/t/help-to-start-color-sequence-in-the-game-simon-says-in-processing/882 "2018-06-11T19:46:14Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Scorpion](https://avatars.discourse-cdn.com/v4/letter/s/6f9a4e/32.png) [@Scorpion](https://discourse.processing.org/u/Scorpion)
#### Post date: [June 11, 2018, 7:46pm UTC](https://discourse.processing.org/t/help-to-start-color-sequence-in-the-game-simon-says-in-processing/882/1 "2018-06-11T19:46:14Z")

</div>

I’m starting to make the game “Simon says” and I do not know how to start generating the “guessList”, that the random colors come out so that the user can then repeat the sequence, how do I continue? for the moment I have done this:

```auto
class Quadrant{

void darkQuadrant(){
//quadrant1
fill(100,0,0);
rect(0, 0, width/2, height/2);
//quadrant2
fill(0,0,100);
rect(width/2, 0, width/2, height/2);
//quadrant3
fill(0,100,0);
rect(0, height/2, width/2, height/2);
//quadrant4
fill(100,100,0);
rect(width/2, height/2, width/2, height/2);

}

/ ***********************AUXILIARY FUNCTIONS*******************  ******* /
// We define the quadrant 1 as a function not to repeat
void c1() {
fill(255,0,0);
rect(0, 0, width/2, height/2);
}
// We define the quadrant 2 as a function not to repeat
void c2() {
fill(0,0,255);
rect(width/2, 0, width/2, height/2);
}
// We define the quadrant 3 as a function not to repeat
void c3() {
fill(0,255,0);
rect(0, height/2, width/2, height/2);
}
// We define the quadrant 4 as a function not to repeat
void c4() {
fill(255,255,0);
rect(width/2, height/2, width/2, height/2);
}

}

class List{
int[] guessList={};
int[] userTest={};
int[] showSequence={};

void generateVector(){
guessList=append(guessList, int(random(1, 4)));
}

void mousePressed(){
if (mousePressed) {
  if (mouseX < width/2 && mouseY < height/2) {
    quadrant.c1();
    userTest=append(userTest,1);
  } else if(mouseX > width/2 && mouseY < height/2) {
    quadrant.c2();
    userTest=append(userTest,2); 
  } else if(mouseX < width/2 && mouseY > height/2) {
    quadrant.c3();
    userTest=append(userTest,3); 
  } else if(mouseX > width/2 && mouseY > height/2) {
    quadrant.c4();
    userTest=append(userTest,4); 
  }
 }
}

}

Quadrant quadrant=new Quadrant();
List list=new List();
void setup(){
size(600,600);
}

void draw(){
background(0);
quadrant.darkQuadrant();
list.generateVector();
list.mousePressed();
}

```

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [June 19, 2018, 12:15am UTC](https://discourse.processing.org/t/help-to-start-color-sequence-in-the-game-simon-says-in-processing/882/2 "2018-06-19T00:15:47Z")

</div>

In `setup`, you need to add numbers to your `List` object – `list.guessList[]`. In your code you do this with the method `generateVector()`.

So, in `setup`:

```
int guesses = 10;
for(int i=0; i<acertas; i++) {
  listas.generarVector()
}

```

Currently your code adds a new number every single frame of `draw`. Don’t do that.
