Mercurial > hg > ristipolku
comparison 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 |
comparison
equal
deleted
inserted
replaced
41:a5fd4f74a767 | 42:951a4d669af0 |
---|---|
89 stateChanged = true; | 89 stateChanged = true; |
90 } | 90 } |
91 | 91 |
92 public int getRotatedPoint(int in) | 92 public int getRotatedPoint(int in) |
93 { | 93 { |
94 int point = (in - (currRotation * 2)) % 8; | |
95 if (point < 0) point = 8 + point; | |
96 return point; | |
97 } | |
98 | |
99 public int getAntiRotatedPoint(int in) | |
100 { | |
94 int point = (in + (currRotation * 2)) % 8; | 101 int point = (in + (currRotation * 2)) % 8; |
95 if (point < 0) point = 8 + point; | 102 if (point < 0) point = 8 + point; |
103 System.out.print("getAntiRotatedPoint("+ in +"): rot="+currRotation+", point="+point+"\n"); | |
96 return point; | 104 return point; |
105 } | |
106 | |
107 public int getMatchingPoint(int point) | |
108 { | |
109 switch (point) | |
110 { | |
111 case 0: return 5; | |
112 case 1: return 4; | |
113 | |
114 case 2: return 7; | |
115 case 3: return 6; | |
116 | |
117 case 4: return 1; | |
118 case 5: return 0; | |
119 | |
120 case 6: return 3; | |
121 case 7: return 2; | |
122 } | |
123 return -1; | |
97 } | 124 } |
98 | 125 |
99 public void setConnectionState(int point, boolean state) | 126 public void setConnectionState(int point, boolean state) |
100 { | 127 { |
101 states[point] = state; | 128 states[point] = state; |