White space cleanup and some constification
[Project_algorithmic_C.git] / lib / othello.c
index 4f1b83ec52cd1b8cda16f1696b85c56a9e499b4b..4e03069f0ee50981863601fb178ef5f93c49f1d3 100644 (file)
@@ -24,7 +24,7 @@
 #include "debug.h"
 
 unsigned int current_player(unsigned int round_count) {
-   
+
     if (round_count % 2 != 0) {
         return player_two;
     } else {
@@ -46,11 +46,11 @@ unsigned int current_opponent(unsigned int current_player) {
  * |
  * y
  * |
- * v 
+ * v
  * The origin O has (1, 1) coordinates */
 
 unsigned int get_box_value(int y, int x, unsigned int pawn_array[board_size][board_size]) {
-   
+
     return pawn_array[y-1][x-1];
 }
 
@@ -87,7 +87,7 @@ void set_pawn(int y, int x, unsigned int type, unsigned int pawn_array[board_siz
 
 /* reverse the pawn at (y, x) coordinates if it exists */
 static void reverse_pawn(int y, int x, unsigned int pawn_array[board_size][board_size]) {
-     
+
     if (is_box_type(y, x, pawn_array, black)) {
         set_pawn(y, x, white, pawn_array);
     } else if (is_box_type(y, x, pawn_array, white)) {
@@ -199,7 +199,7 @@ static unsigned int count_pawn_to_reverse_one_direction(int y, int x, int direct
     return nb_pawns_reversed;
 }
 
-/* revert the pawns if needed in one direction */ 
+/* revert the pawns if needed in one direction */
 static unsigned int reverse_one_direction(int y, int x, int direction, unsigned int current_player, unsigned int pawn_array[board_size][board_size], bool dry_run) {
     unsigned int nb_pawns_reversed = 0;
     int moving_y = y, moving_x = x;
@@ -221,11 +221,11 @@ static unsigned int reverse_one_direction(int y, int x, int direction, unsigned
 /* loop optimized version of valid_shot changing nothing to the pawns 2D array */
 static bool is_legal_shot(int y, int x, unsigned int current_player, unsigned int pawn_array[board_size][board_size]) {
     unsigned int nb_pawns_reversed = 0;
-    
+
     if (!is_valid_coordinates(y, x) || !is_box_type(y, x, pawn_array, empty)) {
         return false;
     }
-    
+
     for (unsigned int direction = north; direction <= north_west; direction++) {
         nb_pawns_reversed += reverse_one_direction(y, x, direction, current_player, pawn_array, true);
         if (nb_pawns_reversed > 0) {
@@ -245,7 +245,7 @@ unsigned int valid_shot(int y, int x, unsigned int current_player, unsigned int
     for (unsigned int direction = north; direction <= north_west; direction++) {
         nb_pawns_reversed += reverse_one_direction(y, x, direction, current_player, pawn_array, false);
     }
-    
+
     if (nb_pawns_reversed == 0) {
         return 0;
     }