This is the Mexican Standoff prototype made by Francisco Martin and Andrew Smith. Please refer to the following link for instructions on hardware hookup: https://developer.mbed.org/users/fomartin/notebook/mexican-standoff-reaction-game/

Dependencies:   SDFileSystem mbed-rtos mbed wave_player 4DGL-uLCD-SE PinDetect

Revision:
0:75716bd37804
Child:
1:4976bbb3376f
diff -r 000000000000 -r 75716bd37804 States/States.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/States/States.h	Mon Mar 14 03:04:08 2016 +0000
@@ -0,0 +1,84 @@
+#include "uLCD_4DGL.h"
+#include "PinDetect.h"
+#include <stdlib.h>
+#include <time.h>
+#include "music.h"
+#include "SDFileSystem.h"
+
+class Startup
+{
+    public:
+        //CONSTRUCTOR
+        Startup(uLCD_4DGL &uLCD, PinDetect &upButton, PinDetect &downButton, PinDetect &leftButton, PinDetect &rightButton);
+        
+        //MEMBER FUNCTIONS
+        int select(uLCD_4DGL &uLCD, PinDetect &upButton, PinDetect &downButton, PinDetect &leftButton, PinDetect &rightButton,
+                    Music &music);
+        void scores(uLCD_4DGL &uLCD, SDFileSystem &sd);
+    
+    private:
+        int option;
+};
+
+class Rules
+{
+    public:
+        Rules(uLCD_4DGL &uLCD, PinDetect &upButton, PinDetect &downButton, PinDetect &leftButton, PinDetect &rightButton);
+};
+
+enum Prompt{HoldFire, Either, Down, Up};
+
+//
+class Gameplay
+{
+    public:
+        // CONSTRUCTOR 
+        Gameplay(uLCD_4DGL &uLCD, int numberOfPlayers, 
+                  PinDetect &Button0, PinDetect &Button1, 
+                  PinDetect &Button2, PinDetect &Button3);
+       
+        // GET FUNCTIONS
+        int getPoints(int player);
+        int getWinningPlayer();
+        
+        // SET FUNCTIONS
+        void setPoints(int player, int points, uLCD_4DGL &uLCD);
+    
+    private:
+        int *points;
+        int numPlayers;
+        int winningPlayer;
+        
+        void drawGun(uLCD_4DGL &uLCD, int x, int y, bool facingRight);
+        void displayUpArrow(uLCD_4DGL &uLCD);
+        void displayDownArrow(uLCD_4DGL &uLCD);
+        void displayCircle(uLCD_4DGL &uLCD);
+        void displayXs(uLCD_4DGL &uLCD);
+        void clearPrompt(uLCD_4DGL &uLCD);
+        
+        void countdown(uLCD_4DGL &uLCD);
+        void clearCountdown(uLCD_4DGL &uLCD);
+        
+        void renderScore(uLCD_4DGL &uLCD);
+        void resetPoints(uLCD_4DGL &uLCD);
+};
+
+class GameOver
+{
+        public: 
+            GameOver(uLCD_4DGL &uLCD, PinDetect &Button0, PinDetect &Button1, 
+                                        PinDetect &Button2, PinDetect &Button3, 
+                                        int winningPlayer);
+};
+
+class CPU
+{
+    private:
+        int difficulty;
+    public:
+        CPU();
+        CPU(int difficulty);
+    
+        float shootTime();
+        bool shootAnswer(Prompt correctAnswer);
+};
\ No newline at end of file