Making the program more streamlined!

hey, this following code is working, except its clumsy, and works fine for this specific application, but having to rewrite it every time i make a minor change is annoying…

 void levelWinOld() {
  if (state==1) { ledColour=96; ba=255; to=255; fr=255; bo=255; }
  if (state==2) { ledColour=96; ri=255; to=255; le=255; bo=255; }
  if (state==3) { ledColour=96; ri=255; ba=255; le=255; fr=255; }
  if (state==4) { ledColour=96; ba=255; to=255; fr=255; bo=255; }
  if (state==5) { ledColour=96; ri=255; to=255; le=255; bo=255; }
  if (state==6) { ledColour=96; ri=255; ba=255; le=255; fr=255; }
  ledColourOld = ledColour;
  puzzleSteps++;
  gameEnd=0;
} // end of levelWin

up the top.

int sideState[6][4] = {
                    {ba, to, fr, bo},
                    {ri, to, le, bo},
                    {ri, ba, le, fr},
                    {ba, to, fr, bo},
                    {ri, to, le, bo},
                    {ri, ba, le, fr}
                  };

and the conversion;

void levelWin() {
  ledColour = 96;
  for (int i=0; i<3; i++) {
  sideState[state-1][i] = {255};
  } 
  ledColourOld = ledColour;
  gameEnd=0;
} // end of levelWin

i know i dont have the if statement in there, but the way my mind has this worked out, is that for every state that is active (1 out of 6) then the will be 255, otherwise it will be 0
deleting post

In LevelWinOld()....
Assuming you want the 'other' cells to retain their current values...
and assuming ledColour is modified somewhere else...
(you only show parts of the code)

:::
ledColour=96;
switch (state) {
  case 1:
  case 4:
     ba=255; to=255; fr=255; bo=255; break;
  case 2:
  case 5:
     ri=255; to=255; le=255; bo=255; break;
  case 3:
  case 6:
     ri=255; ba=255; le=255; fr=255; break;
}
:::

Is this what you wanted?
p.s. indent the call to sideState() in levelWin(). !

Post your code.

I bet if you removed

a) all the code that has been commented-out,
b) excess whitespace
c) useless comments,

it would fit between code tags.

Of course, if you formatted it so that it was legible, that would push it over the code box limit, but you could still attach it.