Coverage Summary for Class: Algo_CO_6 (it.polimi.ingsw.model)
Class |
Class, %
|
Method, %
|
Line, %
|
Algo_CO_6 |
100%
(1/1)
|
100%
(2/2)
|
100%
(10/10)
|
package it.polimi.ingsw.model;
import java.util.ArrayList;
/*
Two columns each formed by 6 different types of tiles.
*/
/**
* class which represent the number six objective (common). Immutable
* @author Ettori Faccincani
*/
public class Algo_CO_6 extends Strategy { // terzo seconda colonna
/**
* check if the matrix match with the objective
* @author Ettori
* @param board the matrix of the board
* @return true iff it found a match
*/
@Override
public boolean checkMatch(Card[][] board) {
int count = 0;
ArrayList<Color> colors;
for (int j = 0; j < COLS; j++) {
colors = new ArrayList<>();
for (int i = 0; i < ROWS; i++) {
if (!colors.contains(board[i][j].color) && board[i][j].color != Color.EMPTY)
colors.add(board[i][j].color);
}
if (colors.size() == 6)
count++;
}
return count >= 2;
}
}