hey everybody,
i am getting this error : a function-definition is not allowed here before '{' token
i have no clue what to do about this.
the very first line of the code is where i am getting this error.
i didnt paste my whole code, as it is to long. i also checked everything, and i have the same amount of "{" as "}".
can anyone help me out? thanks!
void printLastMovs(){
if (mn > 1) {
Serial.print(mn - 1, 0);
}
else {
Serial.print("chess by sander");
}
}
void setup() {
Serial.begin(9600);
Serial.println("chess by sander");
lastH[0] = 0;
// playSerialMode(); /* Debug mode using Serial Monitor */
}
void loop() {
int r;
// Print last movements
printLastMovs();
// Take move from human
x1 = x2 = y1 = y2 = -1;
takeMove();
Serial.print("thinking"); /* Turn for ARDUINO */
K = *c - 16 * c[1] + 799, L = c[2] - 16 * c[3] + 799; /* parse entered move */
N = 0;
T = 0x3F; /* T=Computer Play strength */
// bkp(); /* Save the board just in case */
r = D(-I, I, Q, O, 1, 3); /* Check & do the human movement */
if ( !(r > -I + 1) ) {
Serial.print("Lose ");
gameOver();
}
if (k == 0x10) { /* The flag turn must change to 0x08 */
oneNote(NOTE_F4, 8);
oneNote(NOTE_C4, 8);
oneNote(NOTE_C4, 8);
Serial.print(" ");
return;
}
strcpy(lastH, c); /* Valid human movement */
mn++; /* Next move */
searchDataBase(); /* Search in database */
if (c[0]) { /* Movement found */
Serial.print(c);
Serial.print(" *");
K = *c - 16 * c[1] + 799, L = c[2] - 16 * c[3] + 799; /* parse move found */
N = 0;
T = 0x3F; /* T=Computer Play strength */
r = D(-I, I, Q, O, 1, 3); /* Check & do*/
if ( !(r > -I + 1) ) gameOver();
if (k == 0x08) {
Serial.print("ERR DB");
Serial.print("game over");
gameOver();
}
strcpy(lastM, c); /* Valid ARDUINO movement */
delay(1000);
return;
}
K = I;
N = 0;
T = 0x3F; /* T=Computer Play strength */
r = D(-I, I, Q, O, 1, 3); /* Think & do*/
if ( !(r > -I + 1) ) {
Serial.print("Lose*");
gameOver();
}
if (k == 0x08) { /* Some times the algorithm do not */
Serial.print("ERR 3 "); /* the turn flag */
gameOver(); /* 1. b1c3 c7c5? 2. f2f4? */
}
strcpy(lastM, c); /* Valid ARDUINO movement */
strcpy(c, "a1a1"); /* Execute a invalid move to check score again */
r = D(-I, I, Q, O, 1, 3);
if ( !(r > -I + 1) ) {
Serial.print(lastM);
Serial.print(" ");
gameOver();
}
if (k == 0x08) { /* execute the move and do not change */
Serial.print("ERR 3 "); /* the turn flag */
gameOver(); /* 1. b1c3 c7c5? 2. f2f4? */
}
}