42 package host.labyrinth;
44 import java.util.Scanner;
54 scan =
new Scanner(System.in);
70 System.out.println(
"Press enter to continue...");
97 for (
int i =0 ; i<args.length ; ++i) {
101 if (i+1 < args.length)
107 if (i+1 < args.length)
113 if (i+1 < args.length)
122 case "--interactive":
129 System.out.println(
"Labyrinth Game");
130 System.out.println(
"");
131 System.out.println(
"Usage:");
132 System.out.println(
"labyrinth [-b|--board <Num>] [-s|--supplies <Num>] [-r|--rounds <Num>] [--norooms] [-i|--interactive]");
133 System.out.println(
"or");
134 System.out.println(
"labyrinth -h|--help");
135 System.out.println(
"\nOptions\n");
136 System.out.println(
"-b | --board:\n Sets the size of board's edge.\n");
137 System.out.println(
"-s | --supplies:\n Sets the number of supplies on the board.\n");
138 System.out.println(
"-r | --rounds:\n Sets the maximum number of rounds of the game.\n");
139 System.out.println(
"--norooms:\n Prevents the creation of closed rooms inside the board.\n");
140 System.out.println(
"-i | --interactive:\n Each round requires user input in order to continue.\n");
141 System.out.println(
"-h | --help:\n Print this and exits.");
152 public static void main(String[] args) {
162 Player players [] = {M, T};
168 System.out.println(
"Initial board: " + (game.
round()));
175 System.out.println();
176 System.out.println(
"Round: " + (game.
round()+1));
179 for (
Player p : players) {
180 p.move(p.playerTileId());
189 System.out.println(
"**** " + T.getName() +
" Wins!!! Score =" + T.getScore() +
" ****");
193 System.out.println(
"**** " + M.
getName() +
" Wins!!!");
197 System.out.println(
"**** New day has come... Tie! ****");
203 p.final_statistics();
206 catch (Exception e) {
208 System.out.println(e.getMessage());
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.
This class represents the game's minimax player.
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.