MCPcopy Create free account
hub / github.com/MeigenChou/DCTimer-Android / permutationSign

Method permutationSign

app/src/main/java/solver/Utils.java:206–216  ·  view source on GitHub ↗
(int[] permutation)

Source from the content-addressed store, hash-verified

204 }
205
206 public static boolean permutationSign(int[] permutation) {
207 int nInversions = 0;
208 for (int i = 0; i < permutation.length; i++) {
209 for (int j = i + 1; j < permutation.length; j++) {
210 if (permutation[i] > permutation[j]) {
211 nInversions++;
212 }
213 }
214 }
215 return nInversions % 2 == 0;
216 }
217
218 //pruning table
219 public static void createPrun(byte[] prunTable, int depth, short[][] moveTable, int times) {

Callers 2

scrambleMethod · 0.95
scrambleMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected