programming question Fifo
in
Programming Questions
•
1 month ago
Hi all,
I have the following question:
I have an array of 12 numbers (0 or 1) related to a list of buttons called "paisajeButtons[]". I need to program something that allows me to click only 5 and erase the first one when I click the 6th.
I have an array of 5 positions in order called "clickOn[]"
From here everything is fine,
if I manually turn off one of the five button, it works at the first step, but it doesn't when I have the second unselect with 4 buttons on.
I'm trying this but not going well:
-
for (int i = 0; i < 12; i++) {if (counterButtons > 0 ) {if (paisajeButtons[i] == 0 && (clickOn[0] == i || clickOn[1] == i || clickOn[2] == i || clickOn[3] == i || clickOn[4] == i )) {println("mira si hay un cero en el botón = " + i);if (i == clickOn[0]) {println("quita el botón 0");clickOn[0] = clickOn[1];clickOn[1] = clickOn[2];clickOn[2] = clickOn[3];clickOn[3] = clickOn[4];clickOn[4] = -1;counterButtons --;}if (i == clickOn[1]) {println("quita el botón 1");clickOn[1] = clickOn[2];clickOn[2] = clickOn[3];clickOn[3] = clickOn[4];clickOn[4] = -1;counterButtons --;}if (i == clickOn[2]) {println("quita el botón 2");clickOn[2] = clickOn[3];clickOn[3] = clickOn[4];clickOn[4] = -1;counterButtons --;}if (i == clickOn[3]) {println("quita el botón 3");clickOn[3] = clickOn[4];clickOn[4] = -1;counterButtons --;}if (i == clickOn[4]) {println("quita el botón 4");clickOn[4] = -1;counterButtons --;}}}}
1