/* persistent */ float lmul, rmul; /* convenient color constants */ #define BLACK 0 #define WHITE 1 #define RED 0 #define GREEN 1 int MYCOLOR; /* motor ports */ #define LEFT1 2 #define LEFT2 3 #define RIGHT1 0 #define RIGHT2 1 #define LFORWARD -1 #define RFORWARD 1 /* color sensor ports (analog) */ #define COLOR_NW 31 #define COLOR_SW 28 #define COLOR_NE 25 #define COLOR_SE 22 /* cos(10 degrees), to determine directional accuracy */ #define COS10DEG 0.985 /* RF grid resolution */ #define UNITSPERFT 100 #define MAXDIST (UNITSPERFT*10) #define STOPDIST 50.0 /* Angles for turns */ #define LEFT_TURN 90.0 #define RIGHT_TURN -90.0 /* Board goes from (-3ft, -4ft) to (3ft, 4ft). */ /* Starting locations */ #define START_BX 0 #define START_BY (UNITSPERFT*5/4) #define START_WX 0 #define START_WY (-UNITSPERFT*5/4) /* Scoring area centers */ #define SCORE_BLX (UNITSPERFT/2) #define SCORE_BLY ((-UNITSPERFT*4)+(UNITSPERFT/2)) #define SCORE_BCX 0 #define SCORE_BCY ((UNITSPERFT*4)-(UNITSPERFT/2)) #define SCORE_BRX ((UNITSPERFT*3)-(UNITSPERFT/2)) #define SCORE_BRY ((-UNITSPERFT*4)+(UNITSPERFT/2)) #define SCORE_WLX (UNITSPERFT/2) #define SCORE_WLY ((UNITSPERFT*4)-(UNITSPERFT/2)) #define SCORE_WCX 0 #define SCORE_WCY ((-UNITSPERFT*4)+(UNITSPERFT/2)) #define SCORE_WRX ((UNITSPERFT*3)-(UNITSPERFT/2)) #define SCORE_WRY ((UNITSPERFT*4)-(UNITSPERFT/2))