哈希表,如果改用更大的表,相应的哈希计算位数也要改 static private final int hSize = 128 * 1024; public int count = 0; public LayoutToHash() { hsb = new long[hSize + hSize/4 + 64]; hsb2 = new long[hsb.length / 4]; cht = 0; } @Override public boolean checkAndModify(int[] layout) { if (check(layout) == 1) { symmetricCheck(layout); return true; } return false; } public int check(int[] layout) { // count++; //生成散列参数n1,n2,m0 //以下参数生成算法不保证参数与棋盘的唯一对应关系,因此理论上存在哈希表冲突判断错误的可能 //只不过产生错误的可能性几乎可能完全忽略 int[] p = ZBD.layoutCompress(layout); long n1 = ( ( p[1] > 17 )) & 0x0000ffffffffL; int h0 = (int) h; // if (count > 19 )) & 0x0000ffffffffL; h0 = (int) h; for(int i = 0; i 0) { k++; //计算1的个数 } } if(k==Hn && i 0 && i - 1 == k1 && h == 1) { //向左 hrdLayout.addChoice(i, i - 1); } f[c] = 1; break; case 'H': //关羽可能的走步 if (i + 4 == k1 && h == 2) { hrdLayout.addChoice(i, i + 4); } if (i - 4 == k1 && h == 2) { hrdLayout.addChoice(i, i - 4); } if (col 0 && (i - 1 == k1 || i - 1 == k2)) { hrdLayout.addChoice(i, i - 1); if (h == 2) { hrd