[Commit] RRClient RRBoard.java,1.3,1.4

Bart Massey commit at keithp.com
Sat Jun 7 01:18:46 PDT 2003


Committed by: bart

Update of /local/src/CVS/RRClient
In directory home.keithp.com:/tmp/cvs-serv14238

Modified Files:
	RRBoard.java 
Log Message:
Fully functional now.



Index: RRBoard.java
===================================================================
RCS file: /local/src/CVS/RRClient/RRBoard.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- RRBoard.java	7 Jun 2003 07:03:10 -0000	1.3
+++ RRBoard.java	7 Jun 2003 07:18:43 -0000	1.4
@@ -44,12 +44,6 @@
 	return s;
     }
 
-    static void check_thetarget(boolean t)
-      throws IOException {
-	if (!t)
-	    throw new IOException("target priority mismatch");
-    }
-
     void wall_line(BufferedReader in, int i)
       throws IOException {
 	int off = 1;
@@ -122,30 +116,30 @@
 	    int c1 = s.charAt(ci++);
 	    int c2 = s.charAt(ci++);
 	    int color = -1;
-	    boolean thetarget = false;
+	    boolean goal_target = false;
 	    switch (c1) {
 	    case 'R':
-		thetarget = true;
+		goal_target = true;
 	    case 'r':
 		color = RRSquare.RED;
 		break;
 	    case 'Y':
-		thetarget = true;
+		goal_target = true;
 	    case 'y':
 		color = RRSquare.YELLOW;
 		break;
-	    case 'g':
-		thetarget = true;
 	    case 'G':
+		goal_target = true;
+	    case 'g':
 		color = RRSquare.GREEN;
 		break;
-	    case 'b':
-		thetarget = true;
 	    case 'B':
+		goal_target = true;
+	    case 'b':
 		color = RRSquare.BLUE;
 		break;
 	    case 'W':
-		thetarget = true;
+		goal_target = true;
 	    case 'w':
 		color = RRSquare.WHIRLPOOL;
 		break;
@@ -153,29 +147,30 @@
 		expect(c1, '.');
 	    }
 	    int shape = -1;
+	    boolean goal_shape = false;
 	    switch(c2) {
 	    case 'C':
-		check_thetarget(thetarget);
+		goal_shape = true;
 	    case 'c':
 		shape = RRImages.CIRCLE;
 		break;
 	    case 'S':
-		check_thetarget(thetarget);
+		goal_shape = true;
 	    case 's':
 		shape = RRImages.SQUARE;
 		break;
 	    case 'T':
-		check_thetarget(thetarget);
+		goal_shape = true;
 	    case 't':
 		shape = RRImages.TRIANGLE;
 		break;
 	    case 'O':
-		check_thetarget(thetarget);
+		goal_shape = true;
 	    case 'o':
 		shape = RRImages.STAR;
 		break;
 	    case 'W':
-		check_thetarget(thetarget);
+		goal_shape = true;
 	    case 'w':
 		if (color != RRSquare.WHIRLPOOL)
 		    throw new IOException("target whirlpool mismatch");
@@ -186,10 +181,12 @@
 		if (color != -1)
 		    throw new IOException("target blank mismatch");
 	    }
+	    if (goal_shape != goal_target)
+		throw new IOException("target priority mismatch");
 	    if (color >= 0) {
 		int symbol = 4 * color + shape;
-		squares[i][j].setTarget(symbol, thetarget);
-		if (thetarget) {
+		squares[i][j].setTarget(symbol, goal_target);
+		if (goal_target) {
 		    row_goal = i;
 		    col_goal = j;
 		}
@@ -214,10 +211,10 @@
 	RRSquare s = b.squares[1][1];
 	/* XXX is this still right? */
 	for (int i = 7; i < 9; i++) {
-	    squares[9][i].setWall(0);
-	    squares[i][6].setWall(1);
-	    squares[6][i].setWall(2);
-	    squares[i][9].setWall(3);
+	    b.squares[9][i].setWall(0);
+	    b.squares[i][6].setWall(1);
+	    b.squares[6][i].setWall(2);
+	    b.squares[i][9].setWall(3);
 	}
 	s.setWall(1);
 	s.setWall(2);




More information about the Commit mailing list