A part of my Java assignment requires me to create an enumeration which represents four different types of masks (shapes) which cover squares of a game board. The masks are 3x3 in measurement, with some squares of the 3x3 block missing (these do not hide squares on the game board).
1 0 1 //you can think of the 0's as missing squares, and the 1's as the mask
1 1 1
1 1 0
Now I want to attach a binary matrix to like above to each of the four unique masks using arrays like int[][], like so:
public enum Mask {
W([[1,1,0],[1,1,1],[1,0,1]]),
X([[1,0,1],[1,0,1],[1,1,1]]),
Y([[0,1,1],[1,1,1],[1,1,0]]),
Z([[1,0,1],[1,1,1],[1,0,1]]);
My IDE becomes very unhappy when I try to do this, so I'm sure I'm missing something in my understanding of enums/arrays.
I'm guessing I can't initialize the array in the enum or something like that?
How do I implement this idea?