Git Product home page Git Product logo

yasai's Introduction

Rust

YASAI: Yet Another Shogi library, for AI development

YASAI(野菜) is a Rust library for high-speed generation of legal moves and search for positions for Shogi. It is based on the implementation of apery_rust and uses shogi_core as the fundamental types and functions.

Examples

Perft

cargo run --release --example perft 5

yasai's People

Contributors

na2hiro avatar sugyan avatar taotao54321 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

yasai's Issues

打ち歩詰めでないものが打ち歩詰めと判定される

version: commit 9ea3831

sfen

図の局面で12歩は合法ですが、yasai では打ち歩詰めと判定されてしまいます。

金/馬/飛/龍がまっすぐ引いて歩を取る手は(たとえ pin されていても)常に可能なので、歩を打った筋については pin 判定の対象外とする処理が必要だと思います。

また別件なのですが、こちらのコードは玉の移動先から既に single が除かれているのにさらに single を XOR しているため、結局玉で歩を取る手を二重に判定してしまっているようです:

yasai/src/movegen.rs

Lines 364 to 374 in 9ea3831

// 玉が逃げられる
if let Some(king) = self.king_position(c.flip()) {
let single = Bitboard::single(sq);
let escape =
ATTACK_TABLE.ou.attack(king, c.flip()) & !self.player_bitboard(c.flip()) & !single;
let occupied = self.occupied_bitboard() | single;
for to in escape ^ single {
if self.attackers_to(c, to, &occupied).is_empty() {
return false;
}
}

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.