chessboard // expected declaration before '}' token error.

Hello friends,

So i have been working on this project of mine. Basicly im trying to make my own version of the square off chessboard ( https://squareoffnow.com/ )

i’m trying to write my own chess engine for arduino, since i cant seem to find one online.

I do have some code written down, but i keep getting this one error that i just can’t seem to fix. the error states: “expected declaration before ‘}’ token error.”

does anyone here know what i am doing wrong? i have left my code down under here. the red part is where i am getting the error.

thanks in advance!

ps. if anyone does know a working chess engine for arduino, i would love it if you could share it with me! i would save me a big headache!

#ifndef DEFS_H
#define DEFS_H

typedef unsigned long long U64;

#define NAME “wilson”
#define BRD_SQ_NUM 120

#define MAXGAMEMOVES 1800

enum { EMPTY, wP,wN,wB,wR,wQ,wK,bP,bN,bB,bR,bQ,bK };
enum { FILE_A,FILE_B,FILE_C,FILE_D,FILE_E,FILE_F,FILE_G,FILE_H,FILE_NONE };
enum { RANK_1,RANK_2,RANK_3,RANK_4,RANK_5,RANK_6,RANK_7,RANK_8,RANK_NONE};

enum {WHITE, BLACK, BOTH};

enum {
AA1 = 21,B1,C1,D1,E1,F1,G1,H1,
AA2 = 31,B2,C2,D2,E2,F2,G2,H2,
AA3 = 41,B3,C3,D3,E3,F3,G3,H3,
AA4 = 51,B4,C4,D4,E4,F4,G4,H4,
AA5 = 61,B5,C5,D5,E5,F5,G5,H5,
AA6 = 71,B6,C6,D6,E6,F6,G6,H6,
AA7 = 81,B7,C7,D7,E7,F7,G7,H7,
AA8 = 91,B8,C8,D8,E8,F8,G8,H8,NO_SQ
};

enum { FALSE, TRUE };

enum { WKCA = 1, WQCA = 2, BKCA=4, BQCA=8};

typedef struct {

int move;
int castePerm;
int enPas;
int fiftyMove;
U64 posKey;

} S_UNDO;

typedef struct {

int pieces [BRD_SQ_NUM];
U64 pawns[3];

int kingSq[2];

int side;
int enPas;
int fiftyMove;

int ply;
int hisPly;

int castlePerm;

U64 posKey;

int pceNum [13];
int bigPce [3];
int majPce[3];
int minPce [3];

S_UNDO history[MAXGAMEMOVES];

} S_BOARD;

// macros //
#define FR2SQ(f,r) ( (21 + (f)) + ( (r)*10))

//globals
extern int sq120ToSq64 [BRD_SQ_NUM];
extern int sq64ToSq120[64];

//functions

extern void allInIt ();

#endif

defs.h (1.36 KB)

init.c (606 Bytes)

makefile.ino (24 Bytes)

testserver.ino (130 Bytes)

wilson.ino (104 Bytes)

It would be easier to help you if you post the entire error message(s). Your paraphrasing leaves out important information like the file that contains the error and the line number. Use the copy error button (lower right in the IDE) and paste into code tags.

Post code in code tags, not quote.

this is the full error:

Arduino: 1.6.9 (Windows 10), Board:"Arduino/Genuino Uno"

In file included from C:\Users\sander\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.19\cores\arduino/Arduino.h:32:0,

                 from sketch\own_code.ino.cpp:1:

C:\Users\sander\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.19\cores\arduino/binary.h:31:12: error: expected identifier before numeric constant

 #define B1 1

            ^

sketch\defs.h:18:12: note: in expansion of macro 'B1'

   AA1 = 21,B1,C1,D1,E1,F1,G1,H1,

            ^

C:\Users\sander\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.19\cores\arduino/binary.h:31:12: error: expected '}' before numeric constant

 #define B1 1

            ^

sketch\defs.h:18:12: note: in expansion of macro 'B1'

   AA1 = 21,B1,C1,D1,E1,F1,G1,H1,

            ^

C:\Users\sander\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.19\cores\arduino/binary.h:31:12: error: expected unqualified-id before numeric constant

 #define B1 1

            ^

sketch\defs.h:18:12: note: in expansion of macro 'B1'

   AA1 = 21,B1,C1,D1,E1,F1,G1,H1,

            ^

In file included from C:\Users\sander\Desktop\chessboard\my own code\own_code\wilson.ino:2:0:

defs.h:26: error: expected declaration before '}' token

 };

 ^

exit status 1
expected declaration before '}' token

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

thanks again for your time!

The name 'B1' is already in use by the Arduino software. They defined a name for every combination of binary digits from 1 bit to 8 bits long: B0, B1, B00, B01, B10, B11, B000, B001, B010,... B11111110, B11111111