comparison game/Piece.java @ 191:edf4081fecd6

Simplify.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 04 Apr 2019 12:47:29 +0300
parents 189cd8fe2304
children
comparison
equal deleted inserted replaced
190:5fbc9a6f739e 191:edf4081fecd6
102 stateChanged = true; 102 stateChanged = true;
103 } 103 }
104 104
105 public int getRotation() 105 public int getRotation()
106 { 106 {
107 return currRotation % 4; 107 return (currRotation % 4) * 2;
108 } 108 }
109 109
110 public int getRotatedPoint(int in) 110 public int getRotatedPoint(int in)
111 { 111 {
112 int point = (in - (getRotation() * 2)) % 8; 112 int point = (in - getRotation()) % 8;
113 if (point < 0) point = 8 + point; 113 if (point < 0) point = 8 + point;
114 return point; 114 return point;
115 } 115 }
116 116
117 public int getAntiRotatedPoint(int in) 117 public int getAntiRotatedPoint(int in)
118 { 118 {
119 int point = (in + (getRotation() * 2)) % 8; 119 int point = (in + getRotation()) % 8;
120 if (point < 0) point = 8 + point; 120 if (point < 0) point = 8 + point;
121 return point; 121 return point;
122 } 122 }
123 123
124 public int getMatchingPoint(int point) 124 public int getMatchingPoint(int point)