Skip to content

Commit

Permalink
Basic class setup
Browse files Browse the repository at this point in the history
  • Loading branch information
mmorris44 committed Aug 4, 2018
1 parent 596b386 commit 3960dea
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Factory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
public class Factory {
int x, y;
int index;

String tag;
}
38 changes: 38 additions & 0 deletions src/InputParser.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class InputParser {

String filename = "";
int mapHeight, mapWidth, minerCount, excavatorCount, haulerCount, workerCount, numberOfMines, numberOfFactories, budget;

public InputParser (String filename) {
this.filename = filename;
}

public void read () {
try {
System.out.println("Reading from file: " + filename);
Scanner scanner = new Scanner(new File(filename));
mapHeight = scanner.nextInt();
mapWidth = scanner.nextInt();
minerCount = scanner.nextInt();
excavatorCount = scanner.nextInt();
haulerCount = scanner.nextInt();
workerCount = scanner.nextInt();
numberOfMines = scanner.nextInt();
numberOfFactories = scanner.nextInt();
budget = scanner.nextInt();
scanner.nextLine();

while(scanner.hasNextLine()) {
int index = scanner.nextInt();
}

} catch (FileNotFoundException e) {
e.printStackTrace();
}
}

}
7 changes: 7 additions & 0 deletions src/Mine.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
public class Mine {
int x, y;
int index;

String tag;
int supply;
}
3 changes: 3 additions & 0 deletions src/Worker.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
public class Worker {
int capacity;
}

0 comments on commit 3960dea

Please sign in to comment.