# Ayuda para empezar secuencia de colores en el juego “Simon dice” en Processing

**URL:** https://discourse.processing.org/t/ayuda-para-empezar-secuencia-de-colores-en-el-juego-simon-dice-en-processing/856
**Category:** Español
**Created:** [June 10, 2018, 8:11pm UTC](https://discourse.processing.org/t/ayuda-para-empezar-secuencia-de-colores-en-el-juego-simon-dice-en-processing/856 "2018-06-10T20:11:28Z")
**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 10, 2018, 8:11pm UTC](https://discourse.processing.org/t/ayuda-para-empezar-secuencia-de-colores-en-el-juego-simon-dice-en-processing/856/1 "2018-06-10T20:11:28Z")

</div>

Estoy empezando a hacer el juego “Simon dice” y no se como empezar a generar la “ListaparaAcertar”, que salgan los colores aleatorios para que el usuario pueda despues repetir la secuencia, ¿Cómo continuo? de momento he hecho esto:

```auto
class Cuadrantes{

void cuadrantesOscuros(){
//Cuadrante1
fill(100,0,0);
rect(0, 0, width/2, height/2);
//Cuadrante2
fill(0,0,100);
rect(width/2, 0, width/2, height/2);
//Cuadrante3
fill(0,100,0);
rect(0, height/2, width/2, height/2);
//Cuadrante4
fill(100,100,0);
rect(width/2, height/2, width/2, height/2);

}

/ ****************************FUNCIONES AUXILIARES************************** /
//Definimos el Cuadrante 1 como funcion para no repetir
void c1() {
fill(255,0,0);
rect(0, 0, width/2, height/2);
}
//Definimos el Cuadrante 2 como funcion para no repetir
void c2() {
fill(0,0,255);
rect(width/2, 0, width/2, height/2);
}
//Definimos el Cuadrante 3 como funcion para no repetir
void c3() {
fill(0,255,0);
rect(0, height/2, width/2, height/2);
}
//Definimos el Cuadrante 4 como funcion para no repetir
void c4() {
fill(255,255,0);
rect(width/2, height/2, width/2, height/2);
}

}

class Listas{
int[] listaAcertar={};
int[] intentoUsuario={};
int[] muestraSecuencia={};

void generarVector(){
listaAcertar=append(listaAcertar, int(random(1, 4)));
}

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

}

Cuadrantes cuadrantes=new Cuadrantes();
Listas listas=new Listas();
void setup(){
size(600,600);
}

void draw(){
background(0);
cuadrantes.cuadrantesOscuros();
listas.generarVector();
listas.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:05am UTC](https://discourse.processing.org/t/ayuda-para-empezar-secuencia-de-colores-en-el-juego-simon-dice-en-processing/856/2 "2018-06-19T00:05:19Z")

</div>

En `setup`, necesitas agregar números a tu objeto`Listas` - `listas.listaAcertar []`. Haga esto con el método `generadorVector()`.

Entonces, en `setup`:

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

```

Actualmente su código agrega un nuevo número a cada fotograma de `draw`. No hagas eso.
