41 package host.labyrinth;
43 import java.util.Scanner;
53 scan =
new Scanner(System.in);
69 System.out.println(
"Press enter to continue...");
96 for (
int i =0 ; i<args.length ; ++i) {
100 if (i+1 < args.length)
106 if (i+1 < args.length)
112 if (i+1 < args.length)
121 case "--interactive":
128 System.out.println(
"Labyrinth Game");
129 System.out.println(
"");
130 System.out.println(
"Usage:");
131 System.out.println(
"labyrinth [-b|--board <Num>] [-s|--supplies <Num>] [-r|--rounds <Num>] [--norooms] [-i|--interactive]");
132 System.out.println(
"or");
133 System.out.println(
"labyrinth -h|--help");
134 System.out.println(
"\nOptions\n");
135 System.out.println(
"-b | --board:\n Sets the size of board's edge.\n");
136 System.out.println(
"-s | --supplies:\n Sets the number of supplies on the board.\n");
137 System.out.println(
"-r | --rounds:\n Sets the maximum number of rounds of the game.\n");
138 System.out.println(
"--norooms:\n Prevents the creation of closed rooms inside the board.\n");
139 System.out.println(
"-i | --interactive:\n Each round requires user input in order to continue.\n");
140 System.out.println(
"-h | --help:\n Print this and exits.");
151 public static void main(String[] args) {
161 Player players [] = {T, M};
167 System.out.println(
"Initial board: " + (game.
round()));
174 System.out.println();
175 System.out.println(
"Round: " + (game.
round()+1));
178 for (
Player p : players) {
179 p.move(p.playerTileId());
188 System.out.println(
"**** " + T.
getName() +
" Wins!!! Score =" + T.
getScore() +
" ****");
192 System.out.println(
"**** " + M.getName() +
" Wins!!!");
196 System.out.println(
"**** New day has come... Tie! ****");
202 p.final_statistics();
205 catch (Exception e) {
207 System.out.println(e.getMessage());
This class represents the game's player who cheats.
void createBoard(int theseusTile, int minotaurTile)
Creates the board with all the requested walls and supplies.
static void main(String[] args)
Main game loop.
This class is the representation of the games's board.
int round()
Utility to get current round of the game.
int playerTileId()
Utility to access player's tileID.
String [][] getStringRepresentation(int theseusTile, int minotaurTile)
Returns a 2-D array with the string representation of the board.
static int supplySize
Default board's supply size (if no one set it via command line)
This class represents the game's player.
int nextRound()
Utility to increase and get the increased round of the game.
static boolean getArguments(String[] args)
Command line argument handler.
static boolean interactive
When true each round of the game requires user input.
Scanner scan
Input handle used in interactive mode.
An Application wide board position implementation holding just the id coordinate. ...
static boolean loopGuard
When true a wall creation guard is added to prevent closed rooms inside the board.
static int toID(int row, int col)
Takes row and column coordinates and return the calculated Id coordinate.
Game()
< An empty constructor
Application wide object to hold settings like values for the session.
static int boardSize
Default board's size (if no one set it via command line)
static int maxRounds
Default number of rounds per game (if no one set it via command line)
int round
Holds the round of the game.
void printBoard(String[][] sBoard)
Print board utility.
void waitUser()
Utility to hold the execution of the program waiting for user input.