Finishing RotateRight
Signed-off-by: Anthony Debucquoy <debucquoy.anthony@gmail.com>
This commit is contained in:
		@ -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--;
 | 
			
		||||
 | 
			
		||||
@ -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},
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user