Shape_Piece_Map #15

Merged
tonitch merged 12 commits from Shape_Piece_Map into master 2023-03-28 00:31:42 +02:00
2 changed files with 5 additions and 6 deletions
Showing only changes of commit 498529f29a - Show all commits

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--;

View File

@ -16,7 +16,7 @@ class PieceTest {
boolean[][] piece1_matrix_result = {
{true, false, true},
{false, true, true},
{true, true, false},
{false, false, false},
};
@ -32,7 +32,7 @@ class PieceTest {
boolean[][] piece3_matrix_result = {
{false, false, false},
{true, true, false},
{false, true, true},
{true, false, true},
};