private void TableResize()
 {
     tableSize = NextPrime(this.tableSize);
     HashObject[] transTable = new HashObject[tableSize];
     foreach (HashObject obj in this.tableContent)
     {
         if (obj != null)
             transTable[(int)Math.Abs((obj.hashKey % tableSize))] = obj;
     }
     tableContent = transTable;
 }
 public void InsertCalculatedValue(Board board, int depth, bool isPlayerAMax, bool turnPlayerA, int value)
 {
     Int64 hashKey = CreateHashKey(board, depth, isPlayerAMax, turnPlayerA);
     int position = (int)Math.Abs((hashKey % tableSize));
     HashObject hashObject = tableContent[position];
     if (hashObject == null)
         tableContent[position] = new HashObject(depth, hashKey, value, isPlayerAMax, turnPlayerA);
     else
     {
         bool collision = true;
         while (collision)
         {
             position = (int)Math.Abs((hashKey % tableSize));
             hashObject = tableContent[position];
             if (hashObject == null)
                 collision = false;
             else if (hashObject.hashKey != hashKey || hashObject.isPlayerAMax != isPlayerAMax || hashObject.turnPlayerA != turnPlayerA)
                 TableResize();
             else
                 collision = false;
         }
         tableContent[position] = new HashObject(depth, hashKey, value, isPlayerAMax, turnPlayerA);
     }
 }