So, right now i’m doing the game implementation and got confused. The pointofrotation that the Piece hold should it be the point of rotaion of the piece, or the point of rotation in the board? In project description there is “When a piece is placed on the board, it always receives the position, at which the point of rotation shall be placed”. I’m not really sure i understand this one
The piece always holds the point of rotation of the piece self, it only changes when you rotate the piece.
And when you add a Piece to the Board you use the method
addPiece(Piece piece, int row, int column). So with that
is meant that the board is always receiving the position where the point of rotation should be.
So if you add a piece to the board with the method
addPiece(piece, row, column) the variables
column will specify where on the board the point of rotation should be.
Therefore the point of rotation will be at
(row,column) on the board and you will place the rest of the tiles (from the piece) around the point of rotation but that will not change the point of rotation itself.
So you have the piece:
L P L L
where P is the point of rotation.
And now you want to place the piece with
1 2 3 4 5 6 7 8 9 10 1 2 L 3 P 4 L L 5 6 7 8 9 10
and now you can see that I placed the point of rotation at
(3,8) and built the rest of the piece around it.
I don’t know if am right, but that’s how I implemented/understood that and I am passing all daily tests.
So my other question, in the Game implementation. How did you keep track of the location of the Piece?
You always know where exactly the piece is, because you always know exactly how it moves. You have to update the variables for the current position (row and column in the game implementation) with every call of the move methods.
For example, you have to increment the row when the piece moves down.