@Test public void testGetSymmetries1() throws Exception { YAxisSymmetryExpander yAxisSymmetryExpander = new YAxisSymmetryExpander(8); HashSet<Integer> actual = Sets.newHashSet(ArrayUtils.toObject(yAxisSymmetryExpander.getSymmetries(11))); HashSet<Integer> expected = Sets.newHashSet(Arrays.asList(11, 18)); Assert.assertEquals(expected, actual); }
@Override public int[] getSymmetries(int location) { int M = boardWidth - 1; int c = BoardUtils.colFromPos(location, boardWidth); int r = BoardUtils.rowFromPos(location, boardWidth); int[] a = new int[] { flat(c, r), flat(M - c, r), }; assert a.length == numSymmetries(); return a; }
YAxisSymmetryExpander implements SymmetryExpander { @Override public int[] getSymmetries(int location) { int M = boardWidth - 1; int c = BoardUtils.colFromPos(location, boardWidth); int r = BoardUtils.rowFromPos(location, boardWidth); int[] a = new int[] { flat(c, r), flat(M - c, r), }; assert a.length == numSymmetries(); return a; } }
YAxisSymmetryExpander implements SymmetryExpander { @Override public int[] getSymmetries(int location) { int M = boardWidth - 1; int c = BoardUtils.colFromPos(location, boardWidth); int r = BoardUtils.rowFromPos(location, boardWidth); int[] a = new int[] { flat(c, r), flat(M - c, r), }; assert a.length == numSymmetries(); return a; } YAxisSymmetryExpander(int boardWidth); }
YAxisSymmetryExpander implements SymmetryExpander { @Override public int[] getSymmetries(int location) { int M = boardWidth - 1; int c = BoardUtils.colFromPos(location, boardWidth); int r = BoardUtils.rowFromPos(location, boardWidth); int[] a = new int[] { flat(c, r), flat(M - c, r), }; assert a.length == numSymmetries(); return a; } YAxisSymmetryExpander(int boardWidth); @Override int[] getSymmetries(int location); int flat(int c, int r); @Override int numSymmetries(); int boardWidth(); }
YAxisSymmetryExpander implements SymmetryExpander { @Override public int[] getSymmetries(int location) { int M = boardWidth - 1; int c = BoardUtils.colFromPos(location, boardWidth); int r = BoardUtils.rowFromPos(location, boardWidth); int[] a = new int[] { flat(c, r), flat(M - c, r), }; assert a.length == numSymmetries(); return a; } YAxisSymmetryExpander(int boardWidth); @Override int[] getSymmetries(int location); int flat(int c, int r); @Override int numSymmetries(); int boardWidth();  }