lichess.org
Donate

Adapting nnue-pytorch's binary position format for Lichess

I like the fact that Lichess shares this kind of information even if I understand only half of it. I suppose it helps me to better appreciate the amount of work which goes into running and maintaining the site. Thanks!
I love technology, it's amazing how much things can be improved by applying a new technique. The people behind NNUE must be incredibly skilled and creative. BTW, I wonder if amateur lichess games such as my own can help improve Stockfish? Not because the games are good, but maybe some of the positions that are created can be challenging and interesting. Or maybe it's better to just improve engines with self-play.
It's cool if you get a system that is data efficient. Please note though that it's imperative that puzzle database and similar related items continue to include fen for describing positions because it provides a nonabstract way to easily sort the puzzle in novel ways. For example, here is some code when I was cleaning the puzzle database to find which puzzles are miniatures, creating a count variable for stage of the game, actual move number, and whether the puzzles are for the white or black side. However, a properly cleaned FEN also provides even more for a data set including summation of material count, material count per color, and other awesome things such as finding checkmates where the king is not on the 8th rank but rather in the center of the board, or searching for puzzles with specific pawn structures rather than by opening.

gen moveNumber = real(regexs(1)) if regexm(fen, "([0-9]+)$")
list moveNumber fen in 1/10
label variable moveNumber "Fullmove number"

* Generate a move number categorical variable
gen miniature = (moveNumber <= 10)
label variable miniature "Puzzles appearing 1 to 10 moves into the game"

gen early = (moveNumber >= 11) & (moveNumber <= 20)
label variable early "Puzzles appearing 11 to 20 moves into the game"

gen middle = (moveNumber >= 21) & (moveNumber <= 35)
label variable middle "Puzzles appearing 21 to 35 moves into the game"

gen late = (moveNumber > 35)
label variable late "Puzzles appearing after 35 moves into the game"

* Create a new categorical variable named "stageOfGame"
gen stageOfGame = 0
label variable stageOfGame "Four buckets based on move number"
replace stageOfGame = 1 if miniature == 1
replace stageOfGame = 2 if early == 1
replace stageOfGame = 3 if middle == 1
replace stageOfGame = 4 if late == 1

label define stageOfGame_labels 1 "miniature 1-10" 2 "early 11-20" 3 "middle 21-35" 4 "late 36+"
label values stageOfGame stageOfGame_labels

* Generate a binary string variable named "colorString" that indicates the Active color
* "Active color: "w" means that White is to move; "b" means that Black is to move." - wikipedia
* "w" means that White is to move; "b" means that Black is to move.
* Not sure what this means but it appears to generate w or b to move from the fen properly
* " This function extracts the second word from the fen string. The first word is considered to be everything before the first space."
gen colorString = word(fen, 2)
list colorString fen in 1/10
label variable colorString "Active color to move"
@Awesome-Days Right. I should have mentioned that this is specifically intended for internal storage, not as a data exchange or export format.
Super cool. Missed opportunity to call half a byte a 'nybble', though!
what does this mean in chess?
> optional move counters

And it is not easier to allow all sorts of positions?

> Actually, just support illegal positions, too

than proving that we nailed the ultimate test of a legal position? (legal by what layer or rule set in which variant, etc... having to construct all the games, etc...)
Ok, tell me, why did you mention PyTorch only once and never ever mention it again?
About the illegal positions. Does the board logic have to stop even if there are no kings on board? or insufficient material to win? not exactly the same thing, but why are the ruleset layers putting king on board as a priority. any piece can have its mobility rule set independent of the others. It turns out that sparring or analyzing certain scenarii, might be pedagogically sound without needing all the decorations. another kind of sugar, maybe.

or even teaching king bad breadth in the most abstract context, to help the first exposure to the concept not have distractions, so as to use the human induction ability that all patzers interested by chess kick in and do its job, that won't have the input noise (inputting some chess into the learner I guess).

While having unclogged the sinuses and being able to consider illegal positions, why not do the same with ruleset layers. and give control of that to users? who have some imagination with what to do with that new world.

mutation chess, for theories of learning standard chess. an editor mode within the analysis mode (modifier key, let's mutate the location of that piece right there...).

This might be coding off-topic, but I don't think it is chesswise. Null moves!?

If SF had piece-move-handicap per piece, like king there as target but frozen, one could play with pawn only dynamics, and have the machine do it exhaustive best with only the pawns... all sorts of teaching tools (and learning tools, for the imaginative).
@Awesome-Days said in #4:
> It's cool if you get a system that is data efficient. Please note though that it's imperative that puzzle database and similar related items continue to include fen for describing positions because it provides a nonabstract way to easily sort the puzzle in novel ways. For example, here is some code when I was cleaning the puzzle database to find which puzzles are miniatures, creating a count variable for stage of the game, actual move number, and whether the puzzles are for the white or black side. However, a properly cleaned FEN also provides even more for a data set including summation of material count, material count per color, and other awesome things such as finding checkmates where the king is not on the 8th rank but rather in the center of the board, or searching for puzzles with specific pawn structures rather than by opening.
>
> gen moveNumber = real(regexs(1)) if regexm(fen, "([0-9]+)$")
> list moveNumber fen in 1/10
> label variable moveNumber "Fullmove number"
>
> * Generate a move number categorical variable
> gen miniature = (moveNumber <= 10)
> label variable miniature "Puzzles appearing 1 to 10 moves into the game"
>
> gen early = (moveNumber >= 11) & (moveNumber <= 20)
> label variable early "Puzzles appearing 11 to 20 moves into the game"
>
> gen middle = (moveNumber >= 21) & (moveNumber <= 35)
> label variable middle "Puzzles appearing 21 to 35 moves into the game"
>
> gen late = (moveNumber > 35)
> label variable late "Puzzles appearing after 35 moves into the game"
>
> * Create a new categorical variable named "stageOfGame"
> gen stageOfGame = 0
> label variable stageOfGame "Four buckets based on move number"
> replace stageOfGame = 1 if miniature == 1
> replace stageOfGame = 2 if early == 1
> replace stageOfGame = 3 if middle == 1
> replace stageOfGame = 4 if late == 1
>
> label define stageOfGame_labels 1 "miniature 1-10" 2 "early 11-20" 3 "middle 21-35" 4 "late 36+"
> label values stageOfGame stageOfGame_labels
>
> * Generate a binary string variable named "colorString" that indicates the Active color
> * "Active color: "w" means that White is to move; "b" means that Black is to move." - wikipedia
> * "w" means that White is to move; "b" means that Black is to move.
> * Not sure what this means but it appears to generate w or b to move from the fen properly
> * " This function extracts the second word from the fen string. The first word is considered to be everything before the first space."
> gen colorString = word(fen, 2)
> list colorString fen in 1/10
> label variable colorString "Active color to move"


sorry for having daft question here. What programming language is using "*" symbol for writing up comments? Thank you :)