Apery

From Chessprogramming wiki
Revision as of 16:35, 8 August 2020 by GerdIsenberg (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Home * Engines * Apery

Apery,
an USI compliant open source Shogi engine developed by Takuya Hiraoka, initially written in C++, in 2019 ported to Rust [2], licensed under the GPL v3.0. Apery's search is derived from Stockfish with board representation and move generation adopted to Shogi, including magic bitboards for the sliding pieces rook, bishop, as well as the sliding attack subsets of the promoted dragon and horse - of course due to the 7-bit inner piece occupancy of the 9x9 board, somewhat bigger tables. The improved search of the Rust version makes it stronger than the C++ version, despite a little bit lower NPS. Apery's initial evaluation was Bonanza like, using piece-square tables indexed by king location and further two-piece locations, dubbed KPP or KKP. More recent versions require evaluation function binaries as a sub-module as specified by the USI Eval_Dir command. Since 2012, Apery regularly participates at World Computer Shogi Championships. It won the WCSC24 in 2014, and became third at the WCSC28 in 2018.

Bitboards

Shogi Bitboards are defined as array of two quad words.

C++

The C++ Apery has a conditional compiled union type with 128-bit type __m128i, explicitly taking advantage of SSE2 and SSE4 instructions [3].

class Bitboard {
 ...
private:
#if defined (HAVE_SSE2) || defined (HAVE_SSE4)
    union {
        u64 p_[2];
        __m128i m_;
    };
#else
    u64 p_[2];  // p_[0] : Seeing from the front, 1 to 79 are arranged vertically. Use 63 bits. Call it right.。
                // p_[1] : Seeing from the front, 8 bits from 1 to 19 are arranged vertically. Use 18 bits. Call it left.
#endif
};

Rust

[4]

pub struct Bitboard {
    pub v: [u64; 2],
}

Publications

Forum Posts

External Links

Shogi Engine

Misc

References

Up one Level