import java.util.Scanner; /* Author: James Tam Version: Feb 18, 2021 * New version of the starting code included. Version: October 12, 2015 * Original program */ public class World { public static final int SIZE = 10; public static final int ORCS_WIN = 0; public static final int ELVES_WIN = 1; public static final int DRAW = 2; public static final int CEASE_FIRE = 3; public static final int NOT_OVER = 4; private Entity [][] aWorld; // Post-condition: the position of the characters in the // starting input file will determine the position of the // objects in the array. The type of character in the file // determines the appearance of the Entity(O or D) or if the // element is empty (spaces become null elements) public World() { aWorld = new Entity[SIZE][SIZE]; int r; int c; for (r = 0; r < SIZE; r++) { for (c = 0; c < SIZE; c++) { aWorld[r][c] = null; } } aWorld = FileInitialization.read(); } // Displays array elements on at a time one row per line // Each element is bound above, below, left and right by // bounding lines public void display() { int r = -1; int c = -1; int b = -1; for (r = 0; r < SIZE; r++) { for (c = 0; c < SIZE; c++) { if(aWorld[r][c] == null) System.out.print(" "); else System.out.print(aWorld[r][c].getAppearance()); } System.out.println(); } for (b = 0; b < SIZE; b++) System.out.print("-"); System.out.println(); } public void start() { Scanner in = new Scanner(System.in); display(); System.out.print("Press hit enter to continue: "); in.nextLine(); } }