Explorar el Código

update example solution to match new test expectations

Corey McCandless hace 6 años
padre
commit
053996abe2
Ninguna cuenta está vinculada al correo electrónico del colaborador
Se han modificado 1 ficheros con 5 adiciones y 11 borrados
  1. 5
    11
      exercises/go-counting/.meta/src/reference/java/GoCounting.java

+ 5
- 11
exercises/go-counting/.meta/src/reference/java/GoCounting.java Ver fichero

@@ -127,22 +127,16 @@ class GoCounting {
127 127
 	}
128 128
 	
129 129
 	HashMap<String, Set<Point>> getTerritories() {
130
-		HashMap<String, Set<Point>> territories = new HashMap<String, Set<Point>>();
130
+		HashMap<Player, Set<Point>> territories = new HashMap<Player, Set<Point>>();
131 131
 		
132
-		territories.put("WHITE", new HashSet<Point>());
133
-		territories.put("BLACK", new HashSet<Point>());
134
-		territories.put("NONE", new HashSet<Point>());
132
+		territories.put(Player.WHITE, new HashSet<Point>());
133
+		territories.put(Player.BLACK, new HashSet<Point>());
134
+		territories.put(Player.NONE, new HashSet<Point>());
135 135
 		
136 136
 		for (int i = 0; i < board[0].length; i++) {
137 137
 			for (int j = 0; j < board.length; j++) {
138 138
 				if (board[j][i] == Player.NONE) {
139
-					if (getTerritoryOwner(j, i) == Player.NONE) {
140
-						territories.get("NONE").add(new Point(j, i));
141
-					} else if (getTerritoryOwner(j, i) == Player.BLACK) {
142
-						territories.get("BLACK").add(new Point(j, i));
143
-					} else {
144
-						territories.get("WHITE").add(new Point(j, i));
145
-					}
139
+					territories.get(getTerritoryOwner(j, i)).add(new Point(j, i));
146 140
 				}
147 141
 			}
148 142
 		}