diff game/Piece.java @ 42:951a4d669af0

Initially working path solving algorithm.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 22 Feb 2011 05:58:55 +0200
parents a69103644bf6
children 9664bbb9d613
line wrap: on
line diff
--- a/game/Piece.java	Sat Feb 19 03:05:13 2011 +0200
+++ b/game/Piece.java	Tue Feb 22 05:58:55 2011 +0200
@@ -91,10 +91,37 @@
 
     public int getRotatedPoint(int in)
     {
+        int point = (in - (currRotation * 2)) % 8;
+        if (point < 0) point = 8 + point;
+        return point;
+    }
+
+    public int getAntiRotatedPoint(int in)
+    {
         int point = (in + (currRotation * 2)) % 8;
         if (point < 0) point = 8 + point;
+        System.out.print("getAntiRotatedPoint("+ in +"): rot="+currRotation+", point="+point+"\n");
         return point;
     }
+    
+    public int getMatchingPoint(int point)
+    {
+        switch (point)
+        {
+            case 0: return 5;
+            case 1: return 4;
+
+            case 2: return 7;
+            case 3: return 6;
+
+            case 4: return 1;
+            case 5: return 0;
+
+            case 6: return 3;
+            case 7: return 2;
+        }
+        return -1;
+    }
 
     public void setConnectionState(int point, boolean state)
     {