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 Ganesh Subramaniam

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GameCode.h Source File

GameCode.h

00001 #define THRESHOLD 1000
00002 
00003 Serial pc(USBTX, USBRX);
00004 void stop();
00005 
00006 bool gameOver = false;
00007 
00008 bool isGameOver(double x_hum, double y_hum, double x_cpu, double y_cpu)
00009 {
00010     pc.printf("AI:(%f, %f), HUM: (%f, %f)\n\r", x_cpu, y_cpu, x_hum, y_hum);
00011     if(abs(x_hum - x_cpu) < THRESHOLD && abs(y_hum - y_cpu) < THRESHOLD) {
00012         return true;
00013     } else {
00014         return false;
00015     }
00016 }
00017 
00018 void endGame()
00019 {
00020     pc.printf("GAME OVER\n\r");
00021     stop();
00022     exit(1);
00023 }