1 #include "human_controller.h"
5 #include <iostream> //Really I can't be bothered with fscanf any more
9 MovementResult Human_Controller::QuerySetup(const char * opponentName, string setup[])
12 static bool shownMessage = false;
16 fprintf(stderr, "GUI not yet supported! Please use CLI\n");
17 fprintf(stdout,"Enter %d x %d Setup grid\n", Game::theGame->theBoard.Width(), 4);
18 fprintf(stdout,"Please enter one line at a time, using the following allowed characters:\n");
19 for (Piece::Type rank = Piece::FLAG; rank <= Piece::BOMB; rank = Piece::Type((int)(rank) + 1))
21 fprintf(stdout,"%c x %d\n", Piece::tokens[(int)rank], Piece::maxUnits[(int)rank]);
23 fprintf(stdout, "You must place at least the Flag (%c). Use '%c' for empty squares.\n", Piece::tokens[(int)Piece::FLAG], Piece::tokens[(int)Piece::NOTHING]);
24 fprintf(stdout, "NOTE: Player RED occupies the top four rows, and BLUE occupies the bottom four rows.\n");
31 for (int y = 0; y < 4; ++y)
33 assert(cin.get() == '\n');
35 return MovementResult::OK;
38 MovementResult Human_Controller::QueryMove(string & buffer)
40 static bool shownMessage = false;
44 fprintf(stderr, "GUI not yet supported! Please use the CLI\n");
45 fprintf(stdout, "Please enter your move in the format:\n X Y DIRECTION [MULTIPLIER=1]\n");
46 fprintf(stdout, "Where X and Y indicate the coordinates of the piece to move;\n DIRECTION is one of UP, DOWN, LEFT or RIGHT\n and MULTIPLIER is optional (and only valid for scouts (%c))\n", Piece::tokens[(int)(Piece::SCOUT)]);
54 for (char in = fgetc(stdin); in != '\n'; in = fgetc(stdin))
61 return MovementResult::OK;