Discussion of chess software programming and technical issues.
Moderators: hgm, Dann Corbit, Harvey Williamson
Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
-
Henk
- Posts: 6764
- Joined: Mon May 27, 2013 8:31 am
Post
by Henk » Sat Feb 20, 2021 3:17 pm
O no I defined another dirty enum
Code: Select all
enum SlidingType { Straight, Diagonal };
-
Henk
- Posts: 6764
- Joined: Mon May 27, 2013 8:31 am
Post
by Henk » Wed Feb 24, 2021 12:18 pm
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.
Code: Select all
public IEnumerator<ICoord> GetEnumerator()
{
var bbIter = new BitboardIterator(bb);
foreach (var bit in bbIter)
{
yield return new BitBoardCoord(bit); // far too slow
}
}
-
Henk
- Posts: 6764
- Joined: Mon May 27, 2013 8:31 am
Post
by Henk » Wed Feb 24, 2021 12:27 pm
O wait maybe it is the Log operation.
Code: Select all
public BitBoardCoord(ulong bit)
{
Index = (int)Math.Log(bit, 2);
}
-
Henk
- Posts: 6764
- Joined: Mon May 27, 2013 8:31 am
Post
by Henk » Wed Feb 24, 2021 2:39 pm
Another terrible slow operation.
Code: Select all
public static ulong ConvertToBitBoard(ICoordSet coordSet)
{
ulong result = 0;
foreach (var coord in coordSet)
{
var bb = ConvertToBitBoard(coord);
result |= bb;
}
return result;
}
To fix this I have to repair at least 120 compile errors.
Coding horror movie never stops.
By the way argument should have been CoordSet64 and not ICoordSet.
So that will be another gazillion type casting errors.
-
Henk
- Posts: 6764
- Joined: Mon May 27, 2013 8:31 am
Post
by Henk » Wed Feb 24, 2021 4:45 pm
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.