Compare commits
No commits in common. "f1e72352531ceb9b55bd31500b946df60e9a5ad2" and "d13de717ce99fee03efb0c418ec4db9fee50e9b2" have entirely different histories.
f1e7235253
...
d13de717ce
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
|||||||
[submodule "report/config"]
|
|
||||||
path = report/config
|
|
||||||
url = https://git.hoo2.net/hoo2/LaTeX_confing.git
|
|
4
report/.gitignore
vendored
4
report/.gitignore
vendored
@ -1,4 +0,0 @@
|
|||||||
*.aux
|
|
||||||
*.log
|
|
||||||
*.out
|
|
||||||
*.gz
|
|
@ -1 +0,0 @@
|
|||||||
Subproject commit c27d16e915615bc56a7b09f56e882661ac69b860
|
|
Binary file not shown.
@ -1,43 +0,0 @@
|
|||||||
%
|
|
||||||
% Report for data structures 2020-2021 assignment part 1.
|
|
||||||
%
|
|
||||||
% authors:
|
|
||||||
% Χρήστος Χουτουρίδης ΑΕΜ 8997
|
|
||||||
% cchoutou@ece.auth.gr
|
|
||||||
|
|
||||||
|
|
||||||
% Document configuration
|
|
||||||
\newcommand{\ClassName}{Δομές δεδομένων}
|
|
||||||
\newcommand{\DocTitle}{Λαβύρινθος: Ο Θησέας και ο Μινώταυρος}
|
|
||||||
\newcommand{\InstructorName}{Σιάχαλου Σταυρούλα}
|
|
||||||
\newcommand{\InstructorMail}{ssiachal@auth.gr}
|
|
||||||
\newcommand{\CurrentDate}{\today}
|
|
||||||
|
|
||||||
\input{config/AuthReportConfig.tex}
|
|
||||||
|
|
||||||
%\renewcommand{\AuthorName}{Χρήστος Χουτουρίδης}
|
|
||||||
%\renewcommand{\AuthorMail}{cchoutou@ece.auth.gr}
|
|
||||||
%\renewcommand{\AuthorAEM}{8997}
|
|
||||||
|
|
||||||
\setFancyHeadLR{\ClassName}{\DocTitle}
|
|
||||||
%\setFancyHeadLERO{\ClassName}{\DocTitle}
|
|
||||||
|
|
||||||
% Document
|
|
||||||
% =================
|
|
||||||
\begin{document}
|
|
||||||
|
|
||||||
\FirstPage
|
|
||||||
|
|
||||||
%\tableofcontents
|
|
||||||
%\listoffigures
|
|
||||||
%\listoftables
|
|
||||||
|
|
||||||
\section{Εισαγωγή}
|
|
||||||
|
|
||||||
% References
|
|
||||||
% ============================
|
|
||||||
%\begin{thebibliography}{100}
|
|
||||||
%\bibitem{item}item...
|
|
||||||
%\end{thebibliography}
|
|
||||||
|
|
||||||
\end{document}
|
|
@ -22,8 +22,6 @@ class Const {
|
|||||||
*/
|
*/
|
||||||
class Session {
|
class Session {
|
||||||
static int boardSize = 15; /**< Default board's size (if no one set it via command line) */
|
static int boardSize = 15; /**< Default board's size (if no one set it via command line) */
|
||||||
static int supplySize = 4; /**< Default board's supply size (if no one set it via command line) */
|
|
||||||
static int wallSize = 4*15-1; /**< Default board's wall size (if no one set it via command line) */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,9 +15,6 @@ public class Game {
|
|||||||
|
|
||||||
Game() {} /**< An empty constructor */
|
Game() {} /**< An empty constructor */
|
||||||
|
|
||||||
int round () { return round; }
|
|
||||||
int nextRound() { return ++round; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Accessor/Mutator interface
|
* @name Accessor/Mutator interface
|
||||||
* @note
|
* @note
|
||||||
@ -37,69 +34,20 @@ public class Game {
|
|||||||
/**
|
/**
|
||||||
* Main game loop
|
* Main game loop
|
||||||
*/
|
*/
|
||||||
static boolean getArguments (String[] args) {
|
|
||||||
boolean ret = true;
|
|
||||||
|
|
||||||
for (int i =0 ; i<args.length ; ++i) {
|
|
||||||
switch (args[i]) {
|
|
||||||
case "-b":
|
|
||||||
case "--board":
|
|
||||||
if (i+1 < args.length)
|
|
||||||
Session.boardSize = Integer.parseInt(args[++i]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "-w":
|
|
||||||
case "--walls":
|
|
||||||
if (i+1 < args.length)
|
|
||||||
Session.wallSize = Integer.parseInt(args[++i]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "-s":
|
|
||||||
case "--suplies":
|
|
||||||
if (i+1 < args.length)
|
|
||||||
Session.supplySize = Integer.parseInt(args[++i]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
ret = false;
|
|
||||||
case "-h":
|
|
||||||
case "--help":
|
|
||||||
System.out.println("Labyrinth Game");
|
|
||||||
System.out.println("");
|
|
||||||
System.out.println("Usage:");
|
|
||||||
System.out.println("labyrinth [-b|--board <Num>] [-w|--walls <Num>] [-s|--supplies <Num>]");
|
|
||||||
System.out.println("or");
|
|
||||||
System.out.println("labyrinth -h|--help");
|
|
||||||
System.out.println("");
|
|
||||||
System.out.println("\t-b | --board: Sets the size of board's edge.");
|
|
||||||
System.out.println("\t-w | --walls: Sets the number of walls on the board.");
|
|
||||||
System.out.println("\t-s | --supplies: Sets the number of supplies on the board.");
|
|
||||||
System.out.println("\t-h | --help: Print this and exit");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
// Get command line options
|
|
||||||
Game.getArguments(args);
|
|
||||||
|
|
||||||
// Create a game, a board and 2 players.
|
// Create a game, a board and 2 players.
|
||||||
Game game = new Game();
|
Game game = new Game();
|
||||||
Board board = new Board(Session.boardSize, Session.supplySize, Session.wallSize);
|
Board board = new Board(11, 4, 82);
|
||||||
Player T = new Player(1, "Theseus", board, 0);
|
Player T = new Player(1, "Theseus", board, 0);
|
||||||
Player M = new Player(2, "Minotaur", board, Position.toID(Session.boardSize/2, Session.boardSize/2));
|
Player M = new Player(2, "Minotaur", board, Position.toID(3, 3));
|
||||||
|
|
||||||
// Populate data to the board
|
// Populate data to the board
|
||||||
board.createBoard(T.playerTileId(), M.playerTileId());
|
board.createBoard(T.playerTileId(), M.playerTileId());
|
||||||
|
|
||||||
// The game
|
|
||||||
while (true) {
|
while (true) {
|
||||||
int[] m;
|
int[] m;
|
||||||
System.out.println();
|
System.out.println();
|
||||||
System.out.println("Round: " + (game.round()+1));
|
System.out.println("Round: " + (game.getRound()+1));
|
||||||
|
|
||||||
m = T.move(T.playerTileId());
|
m = T.move(T.playerTileId());
|
||||||
System.out.println(T.getName() + ":\t tileId =" + m[0] + " (" + m[1] + ", " + m[2] + ")");
|
System.out.println(T.getName() + ":\t tileId =" + m[0] + " (" + m[1] + ", " + m[2] + ")");
|
||||||
@ -118,7 +66,8 @@ public class Game {
|
|||||||
System.out.println(M.getName() + " Wins!!! Score =" + M.getScore());
|
System.out.println(M.getName() + " Wins!!! Score =" + M.getScore());
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
if (!(game.nextRound() < 100)) {
|
game.setRound(game.getRound()+1);
|
||||||
|
if (!(game.getRound() < 100)) {
|
||||||
System.out.println("New day has come... Tie!!!");
|
System.out.println("New day has come... Tie!!!");
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user