-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
public class Factory { | ||
int x, y; | ||
int index; | ||
|
||
String tag; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
public class Worker { | ||
int capacity; | ||
} |