text: // Standard headers
  #include <stdio.h>
  #include <stdlib.h>
  #include <time.h>
  
  // Internal headers
  #include "direction.h"
  #include "position.h"
  #include "spy.h"
  
  // Main header
  #include "defender.h"
  
  // Macros
  #define UNUSED(x) (void)(x) // Auxiliary to avoid error of unused parameter
  
  /*----------------------------------------------------------------------------*/
  /*                              PUBLIC FUNCTIONS                              */
  /*----------------------------------------------------------------------------*/
  
  direction_t random_defender_move () {
  
  	// define basic structures used in function
  	static int intervals_length = 9;
  	static float intervals[9] = {
  		0, 0.05, 0.25, 0.45, 0.5, 0.55, 0.75, 0.95, 1
  	};
  	static direction_t moves[8] = {
  		DIR_RIGHT,
  		DIR_UP_RIGHT,
  		DIR_DOWN_RIGHT,
  		DIR_UP,
  		DIR_DOWN,
  		DIR_UP_LEFT,
  		DIR_DOWN_LEFT,
  		DIR_LEFT
  	};
  
  	// check if srand is initialized
  	static int initialized_srand = 0;
  	if (! initialized_srand) {
  		srand(time(NULL));
  		initialized_srand = 1;
  	}
  
  	// get random number
  	float random_number = ((float) rand())/((float) RAND_MAX);
  
  	for (int i = 1; i < intervals_length - 1; i++) {
          if (random_number >= intervals[i] && random_number < intervals[i+1]) {
              return moves[i];
          }
  	}
  
  	return (direction_t) DIR_STAY;
  }
  
  direction_t execute_defender_strategy(
  	position_t defender_position, Spy attacker_spy) {
  
  	UNUSED(defender_position);
  	UNUSED(attacker_spy);
  
  	return random_defender_move();
  }
  
  /*----------------------------------------------------------------------------*/
  