From c6affd8c219c9e063e0148e27d477cfb06a73762 Mon Sep 17 00:00:00 2001 From: Kranklyboy Date: Sun, 15 Apr 2018 19:23:27 +0200 Subject: [PATCH] Remove printMap() function --- common.h | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/common.h b/common.h index 2fc0a03..085a7e9 100644 --- a/common.h +++ b/common.h @@ -29,11 +29,6 @@ // Maximum number of rounds after which the client loses the game: #define MAX_ROUNDS 80 -// Suggested values to save information about the squares of the map: -#define SQUARE_UNKNOWN 0 // the square has not been targeted yet -#define SQUARE_HIT 1 // a shot at the square hit a ship -#define SQUARE_EMPTY 2 // a shot at the square was a miss (thus it is empty) - #define MIN(x,y) (x < y) ? x : y #define MAX(x,y) (x > y) ? x : y @@ -56,40 +51,4 @@ #include #include -/** - * @brief Print a map showing the squares where ships have been hit. - * - * You might find this function useful for debugging. - * - * @param map A 2-dimensional array of unsigned 8-bit integers, where each - * element represents a square and its value indicates whether a - * shot has already been directed at this square and if a ship was - * hit by that shot, according to the values suggested above. - * - * Example usage: - * @code - * uint8_t map[MAP_SIZE][MAP_SIZE]; - * memset(&map, 0, sizeof(map)); // initialize each square as unknown - * map[1][5] = SQUARE_EMPTY; // a shot at B5 did not hit anything - * map[2][3] = SQUARE_HIT; // a shot at C3 hit a ship - * print_map(map); - * @endcode - */ -static inline void print_map(uint8_t map[MAP_SIZE][MAP_SIZE]) -{ - int x, y; - - printf(" "); - for (x = 0; x < MAP_SIZE; x++) - printf("%c ", 'A' + x); - printf("\n"); - - for (y = 0; y < MAP_SIZE; y++) { - printf("%c ", '0' + y); - for (x = 0; x < MAP_SIZE; x++) - printf("%c ", map[x][y] ? ((map[x][y] == 1) ? 'x' : 'o') : ' '); - printf("\n"); - } -} - #endif // COMMON_H