ELEC2645 (2018/19) / Mbed 2 deprecated el17szs

Dependencies:   mbed

Revision:
29:f7a2d2a755ec
Parent:
28:d0b0a64a832d
Child:
30:43aace0fdbdf
--- a/Cricket/Cricket.h	Tue May 07 17:50:58 2019 +0000
+++ b/Cricket/Cricket.h	Tue May 07 18:38:54 2019 +0000
@@ -81,54 +81,109 @@
     * @param &lcd @details reference pointer for the LCD
     */
     void check_victory(N5110 &lcd);
-    
+    /**
+    * @brief Method called after each round, checks if it is a new round or new game
+    * @param runs @details Integer value which stores the runs scored during the round
+    * @param &pad @details Takes a reference pointer to a Gamepad object
+    */
     void game(N5110 &lcd,Gamepad &pad); 
+    /**
+    * @brief Prints the introduction screen when the game is first loaded up
+    * @param &lcd @details reference pointer for the LCD
+    */
     void intro(N5110 &lcd);
+     /**
+    * @brief Method which checks if the game is won, lost and updates the game status
+    * @param &lcd @details reference pointer for the LCD
+    */
     bool game_status(N5110 &lcd);
+    
     void info_screen(N5110 &lcd, int target);
-      
+     /**
+    * @brief Sets the positions for where the ball can be hit
+    */ 
     void init_positions();
+     /**
+    * @brief Resets the variables for each round
+    */ 
     void round_reset();
+     /**
+    * @brief Resets the variables for the start of each game
+    */ 
     void game_reset();
+     /**
+    * @brief Method which checks if a fielder is present in the direciton of ball hit
+    * @param dir @details Direction variable which stores the direction of the ball 
+    * @returns an integer value fielder no if a fielder is present, -1 if no fielder
+    */ 
     int check_fielder(Direction dir);
+     /**
+    * @brief Method which checks if a fielder is present in the direciton of ball hit
+    * @returns a boolean value,true if ball count is equal to ball limit and false if it's < ball limit
+    */ 
     bool check_ball_count(N5110 &lcd);
 private:
+    //Ball object variable
     Ball ball;
+    //Bat object variable
     Bat bat;
+    //Scoreboard object variable
     Scoreboard scoreboard;
+    //UX object variable
     UX ux;
     
+    //Fielder Positions struct which holds the x & y cordinates and no_
     struct fielder_positions{
         Direction dir;
         int x;
         int y;
         int no;
     };
+    //Array which stores the positions for the ball to be hit
     fielder_positions positions[7];
+    /*Struct created for fielders that are in the outfield
+      stores the fielder cordinates on the LCD and the position no.
+    */
     struct Fielder{
         Direction dir;
         int x;
         int y;
         int position;
     };
+    //Fielder array that stores the no. of fielders and it's characteristics
     Fielder field[5];
-
+    // Direction object to store the ball direction
     Direction _ball_direction;
+    /*integer variable which checks if the ball has been bowled 
+        it is used as a flag */
     int _check_bowled;
+    //Integer variable sued as counter positions initialised in the field
     int _init_field_counter;
+    // Integer value used as a counter for the no. of fielders
     int _fielders_count;
+    //Integer variable used as a flag to indicate start of new round
     int _new_round;
+    //Integer array to store no. of fielders during set_field()
     int field_numbers[10];
+    /*Integer variable used as an array index for the position in the outfield where 
+    the ball has been hit*/
     int _position_no;
-    int ballHit;
+    //inteno. of balls that are to be played during each game
     int _ball_limit;
+    //Integer variable used as a flag to indicate start of new game
     int _new_game;
+    //Integer variable used as a flag to indicate that ball has reached destinatio fielder
     int _check_update;
+    //Integer variable used to check if the ball has been hit
     int _check_hit;
+    //Integer variable used as a flag to indicate that ball has been hit
     int _set_hit;
+    //Integer variable used to check if the hit is lofted
+    int _loft_check;
+    //Integer variable used as a flag to indicate that the hit is lofted
     int _set_loft;
+    //integer variable used to indicate that the direciton has been set
     int _direction_set;
-    int _loft_check;
-    //int d;
+    
 };
 #endif
\ No newline at end of file