|
|
|
@ -54,25 +54,24 @@ class Shape(val typeShape: TypeShape,var position: Position) {
|
|
|
|
|
|
|
|
|
|
return sharePosition
|
|
|
|
|
}
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
|
|
|
|
|
fun sharePositionUp(shape: Shape): MutableList<Position>{
|
|
|
|
|
fun sharePositionUp(shape: Shape): MutableList<Position> {
|
|
|
|
|
val sharePosition = mutableListOf<Position>()
|
|
|
|
|
for( line in 0..3){
|
|
|
|
|
for (line in 0..3) {
|
|
|
|
|
for (column in 0..3) {
|
|
|
|
|
if ( line != 3 ){
|
|
|
|
|
if ( (typeShape.showShape[line][column] == 1) and (typeShape.showShape[line+1][column] == 0)){
|
|
|
|
|
sharePosition.add(Position(column,line))
|
|
|
|
|
if (line != 3) {
|
|
|
|
|
if ((typeShape.showShape[line][column] == 1) and (typeShape.showShape[line + 1][column] == 0)) {
|
|
|
|
|
sharePosition.add(Position(column, line))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ( (line == 3) and (typeShape.showShape[line][column] == 1) ){
|
|
|
|
|
sharePosition.add(Position(column,line))
|
|
|
|
|
if ((line == 3) and (typeShape.showShape[line][column] == 1)) {
|
|
|
|
|
sharePosition.add(Position(column, line))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return sharePosition
|
|
|
|
|
=======
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun sharePositionRotationRight(shape: Shape):Array<IntArray>{
|
|
|
|
|
var leftmostCol = 4
|
|
|
|
@ -104,7 +103,7 @@ class Shape(val typeShape: TypeShape,var position: Position) {
|
|
|
|
|
return rotatedMatrix
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun sharePositionRotationLeft(shape: Shape):Array<IntArray>{
|
|
|
|
|
fun sharePositionRotationLeft(shape: Shape):Array<IntArray> {
|
|
|
|
|
var leftmostCol = 4
|
|
|
|
|
// Pivoter la matrice
|
|
|
|
|
val rotatedMatrix = Array(4) { row ->
|
|
|
|
@ -127,12 +126,11 @@ class Shape(val typeShape: TypeShape,var position: Position) {
|
|
|
|
|
}
|
|
|
|
|
for (col in leftmostCol until 4) {
|
|
|
|
|
rotatedMatrix[row][col - leftmostCol] = rotatedMatrix[row][col]
|
|
|
|
|
if ( col - leftmostCol != col){
|
|
|
|
|
if (col - leftmostCol != col) {
|
|
|
|
|
rotatedMatrix[row][col] = 0
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return rotatedMatrix
|
|
|
|
|
>>>>>>> Enzo
|
|
|
|
|
}
|
|
|
|
|
}
|