Finishing RotateRight

Signed-off-by: Anthony Debucquoy <debucquoy.anthony@gmail.com>
This commit is contained in:
2023-02-27 11:05:32 +01:00
committed by Anthony Debucquoy
parent e06abe60de
commit 498529f29a
2 changed files with 5 additions and 6 deletions

View File

@ -12,16 +12,15 @@ public class Piece extends Shape{
/**
* Rotate the matrix of the piece. Used when the player right click
* TODO: ALGORITHME INCORECTE, A REFAIRE <tonitch>
*
* @param times Set the amount of time the rotation should be executed. Should be set between 1 and 3.
*/
public void RotateRight(int times){
while(times > 0) {
boolean[][] temp_matrix = new boolean[width][height];
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
temp_matrix[j][i] = matrix[i][j];
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
temp_matrix[i][j] = matrix[-j+height-1][i];
}
}
times--;