Package General
Class PentominoBuilder
java.lang.Object
General.PentominoBuilder
public class PentominoBuilder
extends java.lang.Object
Class responsible for building the pentomino pieces and exporting them to a CSV file
-
Field Summary
Fields Modifier and Type Field Description static java.util.ArrayList<int[][][]>database -
Constructor Summary
Constructors Constructor Description PentominoBuilder() -
Method Summary
Modifier and Type Method Description static int[][][]eraseDuplicates(int[][][] data)erase duplicates in a array of matrices the input matrix stays unchangedstatic int[][]eraseEmptySpace(int[][] data)erase rows and columns that only exist of 0static int[][]horizontalInverse(int[][] data)inverse the matrix horizontally it makes a copy, the input matrix stays unchangedstatic booleanisEqual(int[][] data1, int[][] data2)check if 2 matrices are equal assuming they have the same sizestatic voidmain(java.lang.String[] args)static int[][]makeBigger(int[][] data, int size)expands a smaller than size*size matrix to a size*size matrix it makes a copy, the input matrix stays unchanged assuming that the input is smaller than size!!static voidmakeDatabase()make the database, created of the basicDatabasestatic int[][]moveToAbove(int[][] data)move matrix to the left above corner doesn't make a copy!static int[][]rotate(int[][] data, int rotation)rotate the matrix x amount of times over 90 degrees (assume that the matrix is a square!) it doesn't make a copy, so the return matrix doesn't have to be usedstatic int[][]verticalInverse(int[][] data)inverse the matrix vertically it makes a copy, the input matrix stays unchanged
-
Field Details
-
database
public static java.util.ArrayList<int[][][]> database
-
-
Constructor Details
-
PentominoBuilder
public PentominoBuilder()
-
-
Method Details
-
makeDatabase
public static void makeDatabase()make the database, created of the basicDatabase -
rotate
public static int[][] rotate(int[][] data, int rotation)rotate the matrix x amount of times over 90 degrees (assume that the matrix is a square!) it doesn't make a copy, so the return matrix doesn't have to be used- Parameters:
data- : the matrixrotation- : amount of rotation- Returns:
- the rotated matrix
-
verticalInverse
public static int[][] verticalInverse(int[][] data)inverse the matrix vertically it makes a copy, the input matrix stays unchanged- Parameters:
data- : the matrix- Returns:
- the inverted matrix
-
horizontalInverse
public static int[][] horizontalInverse(int[][] data)inverse the matrix horizontally it makes a copy, the input matrix stays unchanged- Parameters:
data- the matrix- Returns:
- the inverted matrix
-
makeBigger
public static int[][] makeBigger(int[][] data, int size)expands a smaller than size*size matrix to a size*size matrix it makes a copy, the input matrix stays unchanged assuming that the input is smaller than size!!- Parameters:
data- : the matrixsize- : the square size of the new matrix- Returns:
- the size*size matrix
-
moveToAbove
public static int[][] moveToAbove(int[][] data)move matrix to the left above corner doesn't make a copy!- Parameters:
data- : the matrix- Returns:
- the matrix
-
eraseDuplicates
public static int[][][] eraseDuplicates(int[][][] data)erase duplicates in a array of matrices the input matrix stays unchanged- Parameters:
data- the matrix- Returns:
- the array of matrices without duplicates
-
isEqual
public static boolean isEqual(int[][] data1, int[][] data2)check if 2 matrices are equal assuming they have the same size- Parameters:
data1- : first matrixdata2- : second matrix- Returns:
- true if equal, false if not equal
-
eraseEmptySpace
public static int[][] eraseEmptySpace(int[][] data)erase rows and columns that only exist of 0- Parameters:
data- the matrix- Returns:
- the shrinken matrix
-
main
public static void main(java.lang.String[] args) throws java.io.FileNotFoundException, java.io.UnsupportedEncodingException- Throws:
java.io.FileNotFoundExceptionjava.io.UnsupportedEncodingException
-