Spring 2014, ECE 4180 project, Georgia Institute of Technolgoy. This is the human driver (RF controller) program for the Robotics Cat and Mouse program.
Dependencies: ADXL345_I2C_NEST HMC6352 IMUfilter ITG3200_NEST USBHost mbed-rtos mbed
Fork of Project by
Diff: GameCode.h
- Revision:
- 5:210cd333f770
- Child:
- 6:3fb9f96765f6
diff -r b2a30c313297 -r 210cd333f770 GameCode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GameCode.h Wed Apr 30 05:53:51 2014 +0000 @@ -0,0 +1,21 @@ +#define THRESHOLD 500 + +Serial pc(USBTX, USBRX); + +bool gameOver = false; + +bool isGameOver(double x_hum, double y_hum, double x_cpu, double y_cpu) +{ + pc.printf("AI:(%f, %f), HUM: (%f, %f)\n\r", x_cpu, y_cpu, x_hum, y_hum); + if(abs(x_hum - x_cpu) < THRESHOLD && abs(y_hum - y_cpu) < THRESHOLD) { + return true; + } else { + return false; + } +} + +void endGame() +{ + pc.printf("GAME OVER\n\r"); + exit(1); +} \ No newline at end of file