I see.mvanthoor wrote: ↑Tue Sep 29, 2020 5:36 pmIt's not required to post there It's just a topic where I put down some stuff regarding the engine's development status. The reason is the fact that I received a few "and where is your engine?!" comments when I posted remarks to some topics. Now people can see what the engine can do, and how it does it, even though it's not finished yet.maksimKorzh wrote: ↑Tue Sep 29, 2020 4:53 pm Thanks Marcel, this is so kind of you!
Btw the fact that I'm not posting in Rustic progress thread doesn't mean that I don't read that)))
It wouldn't be a problem to use "evaluation" instead of "score", but it could be confusing, because the value is not an evaluation. I store "score" in the move integer, by the way. The reason I use a struct, is because I can put member functions into it:And regarding move scoring - obviously meaningful and correct variable names make the code cleaner, but I really doubt that you could encounter some issue assuming that move score is stored within the move structure (struct move {int move, int score}) because assuming that structure you would be referencing inner fields of - move and score - still there would be a difference in referencing like move->eval VS position->eval or global position eval or whatever data structure you'll encapsulate your eval within. In BBC I've dropped the move struct completely and using move integer only for simplicity, clarity and to completely modularize move ordering itself, so it's done just right before the loop over the moves within alpha beta search instead of ordering moves on the fly within that loop like VICE, TSCP and many other monolithic engines do.
https://github.com/mvanthoor/rustic/blo ... en/defs.rs
So I can do this:
let current_move = (some move here)
current_move.piece()
current_move_from()
current_move.to()
And so on.
I was thinking about encoding score within a move believe it or not but dropped that idea to make move scoring separate and explicit.
why do you use functions pointers within a struct when it seems to be faster just to do decode directly (using macros if C):
Code: Select all
/*
binary move bits hexidecimal constants
0000 0000 0000 0000 0011 1111 source square 0x3f
0000 0000 0000 1111 1100 0000 target square 0xfc0
0000 0000 1111 0000 0000 0000 piece 0xf000
0000 1111 0000 0000 0000 0000 promoted piece 0xf0000
0001 0000 0000 0000 0000 0000 capture flag 0x100000
0010 0000 0000 0000 0000 0000 double push flag 0x200000
0100 0000 0000 0000 0000 0000 enpassant flag 0x400000
1000 0000 0000 0000 0000 0000 castling flag 0x800000
*/
// encode move
#define encode_move(source, target, piece, promoted, capture, double, enpassant, castling) \
(source) | \
(target << 6) | \
(piece << 12) | \
(promoted << 16) | \
(capture << 20) | \
(double << 21) | \
(enpassant << 22) | \
(castling << 23) \
// extract source square
#define get_move_source(move) (move & 0x3f)
// extract target square
#define get_move_target(move) ((move & 0xfc0) >> 6)
// extract piece
#define get_move_piece(move) ((move & 0xf000) >> 12)
// extract promoted piece
#define get_move_promoted(move) ((move & 0xf0000) >> 16)
// extract capture flag
#define get_move_capture(move) (move & 0x100000)
// extract double pawn push flag
#define get_move_double(move) (move & 0x200000)
// extract enpassant flag
#define get_move_enpassant(move) (move & 0x400000)
// extract castling flag
#define get_move_castling(move) (move & 0x800000)