Sorting ulong moves based on their score

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: Sorting ulong moves based on their score

Post by mvanthoor »

eligolf wrote: Fri Feb 18, 2022 5:53 pm I know I won't make any competitive engine...
Mwhahaha ... :lol:

Go try and fool someone else. As soon as your engine is in the CCRL-list (or another rating list), you will want to make it stronger. If you're hitting roadblocks such as speed or bad structure, you'll either restart and write a new engine, or refactor it.

Just wait and see :twisted:

Welcome to the chess programming world... newcomer addict 8-)
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
eligolf
Posts: 114
Joined: Sat Nov 14, 2020 12:49 pm
Full name: Elias Nilsson

Re: Sorting ulong moves based on their score

Post by eligolf »

Hahah yeh I guess you are right, I love optimizing things... Chess programming is a curse, I should have listened to those who said that one should never start writing one :P
Pio
Posts: 335
Joined: Sat Feb 25, 2012 10:42 pm
Location: Stockholm

Re: Sorting ulong moves based on their score

Post by Pio »

eligolf wrote: Fri Feb 18, 2022 5:27 pm Yes, I think it is good to change things like this early.
So when getting all possible moves I do something like this?

Code: Select all

ulong possibleMoves = new ulong[256];
int movesAdded = 0;

// if finding move....
possibleMoves[movesAdded] = newMove;
movesAdded++;

Sorry about all these newbie questions, I am not a very good C# programmer, I am so used to Python :)
And how do I loop through this list in Negamax? I don't want to loop over all possible moves that are 256 in this case, I only want to use the ones I added in the list.
Can’t you just put a dummy element just after the last valid element/move in the array. If 0 is not a legal move you don’t have to set anything, just check for 0 while looping.
eligolf
Posts: 114
Joined: Sat Nov 14, 2020 12:49 pm
Full name: Elias Nilsson

Re: Sorting ulong moves based on their score

Post by eligolf »

Pio wrote: Fri Feb 18, 2022 7:22 pm
eligolf wrote: Fri Feb 18, 2022 5:27 pm Yes, I think it is good to change things like this early.
So when getting all possible moves I do something like this?

Code: Select all

ulong possibleMoves = new ulong[256];
int movesAdded = 0;

// if finding move....
possibleMoves[movesAdded] = newMove;
movesAdded++;

Sorry about all these newbie questions, I am not a very good C# programmer, I am so used to Python :)
And how do I loop through this list in Negamax? I don't want to loop over all possible moves that are 256 in this case, I only want to use the ones I added in the list.
Can’t you just put a dummy element just after the last valid element/move in the array. If 0 is not a legal move you don’t have to set anything, just check for 0 while looping.
Yup, that is what I did :)
pedrojdm2021
Posts: 157
Joined: Fri Apr 30, 2021 7:19 am
Full name: Pedro Duran

Re: Sorting ulong moves based on their score

Post by pedrojdm2021 »

mvanthoor wrote: Fri Feb 18, 2022 6:58 pm
eligolf wrote: Fri Feb 18, 2022 5:53 pm I know I won't make any competitive engine...
Mwhahaha ... :lol:

Go try and fool someone else. As soon as your engine is in the CCRL-list (or another rating list), you will want to make it stronger. If you're hitting roadblocks such as speed or bad structure, you'll either restart and write a new engine, or refactor it.

Just wait and see :twisted:

Welcome to the chess programming world... newcomer addict 8-)
I can confirm it lol, you'll always want more