Giter Club home page Giter Club logo

rustyglot's People

Contributors

nkoppel avatar

Watchers

 avatar  avatar

rustyglot's Issues

Maybe bug when promoting

I am testing your program against original polyglot and there are discrepancies when promoting.
The test is done on this simple game:

  1. f4 g5 2. fxg5 Nc6 3. g6 Nf6 4. g7 h6 5. gxh8=Q *

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"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.