To make ICoordset : IEnumerable<ICoord> I had to implement GetEnumerator for CoordSet64. But looks like it is a main computational bottleneck.
Don't know what to do about it. Make representation a List<ICoord> perhaps instead of a bitboard (uint64) . Doubt if that would make it faster.
For you have intersection and union operation. So maybe a sortedlist<ICoord> I don't know yet.
public IEnumerator<ICoord> GetEnumerator()
{
var bbIter = new BitboardIterator(bb);
foreach (var bit in bbIter)
{
yield return new BitBoardCoord(bit); // far too slow
}
}
If ICoordSet: IEnumerable<ICoord> I can use Intersect and Union operation from LinQ.
Problem is that it returns an IEnumerable<ICoord> and not an ICoordSet or a CoordSet64.
So I can expect even more compile errors.
When will it compile? Maybe next week. After that remove run time errors and then find out that movegeneration is another two times lower.
Too optimistic. Appears to be 4 times slower. But quick fixed tedious compile errors.
Maybe not a good idea to use system.Linq for enumerable operations on what was previously bitsets.
O wait I already found it. Can't use linq operations when computing hashkey for an occupancy during movegeneration. So you really have to use | & there instead of union and intersect. So can't use CoordSets there only bitboards (ulong). Or you have to make a fast implementation of union, intersect.