nkoppel / rustyglot Goto Github PK
View Code? Open in Web Editor NEWA program which creates and performs powerful operations on PolyGlot's .bin chess opening book format.
License: GNU General Public License v3.0
A program which creates and performs powerful operations on PolyGlot's .bin chess opening book format.
License: GNU General Public License v3.0
I am testing your program against original polyglot and there are discrepancies when promoting.
The test is done on this simple game:
and this position:
r1bqkb1r/ppppppP1/2n2n1p/8/8/8/PPPPP1PP/RNBQKBNR w KQkq - 0 5
After some tests and reviewed your code I propose a mod in this way (or similar) in conversions.rs :
**pub fn to_book_move(mov: Uci) -> u16 {
if let Uci::Normal{from: sq1, to: sq2, promotion} = mov {
let **mut** promotion =
if let Some(p) = promotion {
usize::from(p)
} else {
0
};
**if promotion != 0 {
promotion -= 1;
}**
let i1 = usize::from(sq1);
let i2 = usize::from(sq2);
return (promotion << 12 | i1 << 6 | i2) as u16;
}
unreachable!()
}**
But maybe there is an error in my side, perhaps.
Edit:
in polyglot into file move.h the description of promotions are:
const int MoveNone = 0; // HACK: a1a1 cannot be a legal move
const int MovePromoteKnight = 1 << 12;
const int MovePromoteBishop = 2 << 12;
const int MovePromoteRook = 3 << 12;
const int MovePromoteQueen = 4 << 12;
const int MoveFlags = 7 << 12;
so, in our case, I consider that this will be:
promoteKnight = 1
promoteBishop = 2
promoteRook = 3
promoteQueen = 4
In above mentioned example it throws a five "promotion = 5"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.