55 lines
1.1 KiB
C
55 lines
1.1 KiB
C
/**
|
|
* @file common.h
|
|
* @author OSUE Team <osue-team@cps.tuwien.ac.at>
|
|
* @date 2017-10-06
|
|
*
|
|
* @brief Common definitions for OSUE exercise 1B `Battleship'.
|
|
*/
|
|
|
|
// guard block:
|
|
#ifndef COMMON_H
|
|
#define COMMON_H
|
|
|
|
// default hostname and port:
|
|
#define DEFAULT_HOST "localhost"
|
|
#define DEFAULT_PORT "1280"
|
|
|
|
// Length of each side of the map:
|
|
#define MAP_SIZE 10
|
|
|
|
// Minimum and maximum length of the ships:
|
|
#define MIN_SHIP_LEN 2
|
|
#define MAX_SHIP_LEN 4
|
|
|
|
// Number of ships of each length:
|
|
#define SHIP_CNT_LEN2 2 // 2 ships of length 2
|
|
#define SHIP_CNT_LEN3 3 // 3 ships of length 3
|
|
#define SHIP_CNT_LEN4 1 // 1 ship of length 4
|
|
|
|
// Maximum number of rounds after which the client loses the game:
|
|
#define MAX_ROUNDS 80
|
|
|
|
#define MIN(x,y) (x < y) ? x : y
|
|
#define MAX(x,y) (x > y) ? x : y
|
|
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
#include <limits.h>
|
|
|
|
#include <assert.h>
|
|
#include <errno.h>
|
|
#include <signal.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
#include <netdb.h>
|
|
#include <fcntl.h>
|
|
|
|
#endif // COMMON_H
|