Check this code, I didn’t have all of your code for testing it
for (int f = 0; (f <= 7); f++)
{
for (int c = 0; (c <= 7); c++)
{
if ((((((c % 2) != 0) && ((f % 2) == 0)) || (((c % 2) == 0) && ((f % 2) != 0))) && (f < 3)))
{
BE.Ficha fi = new BE.Ficha();
fi.Color = 1;
fi.Fila = f;
fi.Columna = c;
fi.Dama = false;
tab.Fichas.Add(fi);
}
else if ((((((c % 2) == 0) && ((f % 2) != 0)) || (((c % 2) != 0) && ((f % 2) == 0))) && (f > 4)))
{
BE.Ficha fi = new BE.Ficha();
fi.Color = -1;
fi.Fila = f;
fi.Columna = c;
fi.Dama = false;
tab.Fichas.Add(fi);
}
}
}
2
solved How to use MOD function in C# [closed]