a geicko-2 based round robin ranking system designed to test c++ battleship submissions battleship.dunkirk.sh
1// Author: Keith Shomper 2// Date: 24 Oct 03 3// Purpose: Type definitions for implementing a text-based battleship game 4// Modified:15 Nov 2005 - Moved the class definitions into the file battleship.h 5// to make the data structure more visible. 6// Modified: 5 Nov 2013 - Moved the ISA macros higher in the file to make them 7// more visible. Added ISAMISS macro 8// Modified: 5 Nov 2015 - Moved the ISA macros back to a lower section and made 9// them conditionally compilable. The purpose of this 10// change was to promote their replacement by like-named 11// functions, while maintaining backward compatibility. 12 13// use these constants to indicate whether a ship goes across the grid or up 14// and down 15 16#ifndef BATTLESHIP_TYPE_DEFINITIONS_H 17#define BATTLESHIP_TYPE_DEFINITIONS_H 18 19// Board size 20const int BOARDSIZE = 10; 21 22// use these constants to indicate whether a ship goes across the grid or up 23// and down 24const int HORZ = 0; 25const int VERT = 1; 26 27// these constants allow use to refer to the ships by numerical values 28const int AC = 1; 29const int BS = 2; 30const int CR = 3; 31const int SB = 4; 32const int DS = 5; 33 34// constants for the ship size 35const int AC_SIZE = 5; 36const int BS_SIZE = 4; 37const int CR_SIZE = 3; 38const int SB_SIZE = 3; 39const int DS_SIZE = 2; 40 41// markers for keeping track of game play 42const char HIT_MARKER = 'H'; 43const char MISS_MARKER = '*'; 44const char SUNK_MARKER = 'X'; 45const char EMPTY_MARKER = ' '; 46const char AC_MARKER = 'A'; 47const char BS_MARKER = 'B'; 48const char CR_MARKER = 'C'; 49const char SB_MARKER = 'S'; 50const char DS_MARKER = 'D'; 51 52// TO STUDENTS: It should not be necessary in your assignment for you to use 53// the information appearing below this comment 54 55// color constants for diferent game situations 56const int BATTLE_WHITE = 1; 57const int BATTLE_GREEN = 2; 58const int BATTLE_YELLOW = 3; 59const int BATTLE_RED = 4; 60 61// use these constants to set the return value in playMove(), they allow us 62// to send back mutiple pieces of information about the result of the move in 63// a single integer variable 64const int MISS = 0; 65const int SHIP = 7; 66const int HIT = 8; 67const int SUNK = 16; 68 69#ifdef BATTLESHIP_BACKWARD_COMPATIBILITY 70// these macros use the MISS, HIT, etc. constants below to determine the 71// result of the move 72#define ISAMISS(parm) (!((parm) & HIT)) 73#define ISAHIT(parm) ((parm) & HIT) 74#define ISASUNK(parm) ((parm) & SUNK) 75#define SHIPNUM(parm) ((parm) & SHIP) 76#endif // BATTLESHIP_BACKWARD_COMPATIBILITY 77 78#endif // BATTLESHIP_TYPE_DEFINITIONS_H