a geicko-2 based round robin ranking system designed to test c++ battleship submissions
battleship.dunkirk.sh
1#ifndef BATTLESHIP_LIGHT_H
2#define BATTLESHIP_LIGHT_H
3
4#include <iostream>
5#include <cstdlib>
6#include <ctime>
7#include <string>
8#include <vector>
9
10// Use the same constants and types as the normal version
11#include "kasbs.h"
12
13using namespace std;
14
15// Player types (not in kasbs.h)
16const int HUMAN = 0;
17const int COMPUTER = 1;
18
19// Move validation (not in kasbs.h)
20const int VALID_MOVE = 0;
21const int ILLEGAL_FORMAT = 1;
22const int REUSED_MOVE = 2;
23
24// Position, Ship, and Board are compatible with normal version
25struct Position {
26 int startRow;
27 int startCol;
28 int orient;
29};
30
31struct Ship {
32 Position pos;
33 int size;
34 int hitsToSink;
35 char marker;
36};
37
38struct Board {
39 char grid[BOARDSIZE][BOARDSIZE];
40 Ship s[6]; // index 0 unused
41};
42
43// Core functions - lightweight implementations
44void setDebugMode(bool enabled);
45bool getGuardTripped();
46void resetGuardTripped();
47vector<string> getDebugLog();
48void welcome(bool debug = false);
49void clearTheScreen();
50void pauseForEnter();
51void writeMessage(int x, int y, string message);
52void writeResult(int x, int y, int result, int playerType);
53void displayBoard(int x, int y, int playerType, const Board &gameBoard);
54void initializeBoard(Board &gameBoard, bool file = false);
55int playMove(int row, int col, Board &gameBoard);
56bool isAMiss(int playMoveResult);
57bool isAHit(int playMoveResult);
58bool isASunk(int playMoveResult);
59int isShip(int playMoveResult);
60string randomMove();
61int checkMove(string move, const Board &gameBoard, int &row, int &col);
62void debug(string s, int x = 22, int y = 1);
63string numToString(int x);
64
65#endif // BATTLESHIP_LIGHT_H