node-version: ${{ matrix.node-version }}
- name: Build ffishjs
working-directory: src
- run: make -f Makefile_js build debug=yes optimize=no
+ run: make -f Makefile_js build debug=yes
- name: Install dependencies
working-directory: tests/js
run: npm install
Board::sfInitialized = true;
}
v = get_variant(uciVariant);
+ UCI::init_variant(v);
this->resetStates();
if (fen == "")
fen = v->startFen;
states = StateListPtr(new std::deque<StateInfo>(1)); // Drop old and create a new one
const Variant* v = variants.find(std::string(variant))->second;
+ UCI::init_variant(v);
if (strcmp(fen, "startpos") == 0)
fen = v->startFen.c_str();
- Options["UCI_Chess960"] = chess960;
pos.set(v, std::string(fen), chess960, &states->back(), Threads.main());
// parse move list
#include "types.h"
+#include "variant.h"
+
namespace Stockfish {
class Position;
namespace UCI {
+void init_variant(const Variant* v);
+
class Option;
/// Custom comparator because UCI options should be case insensitive
"capablanca", "gothic", "janus", "caparandom", "grand", "shogi", "xiangqi"
};
+void init_variant(const Variant* v) {
+ pieceMap.init(v);
+ Bitboards::init_pieces();
+}
+
/// 'On change' actions, triggered by an option's value change
void on_clear_hash(const Option&) { Search::clear(); }
void on_hash_size(const Option& o) { TT.resize(size_t(o)); }
Eval::NNUE::init();
const Variant* v = variants.find(o)->second;
- pieceMap.init(v);
- Bitboards::init_pieces();
+ init_variant(v);
PSQT::init(v);
}
void on_variant_change(const Option &o) {
result = sf.legal_moves("diana", "rbnk1r/pppbpp/3p2/5P/PPPPPB/RBNK1R w KQkq - 2 3", [])
self.assertIn("d1f1", result)
+ # Test configurable piece perft
+ legals = ['a3a4', 'b3b4', 'c3c4', 'd3d4', 'e3e4', 'f3f4', 'g3g4', 'e1e2', 'f1f2', 'b1a2', 'b1b2', 'b1c2', 'c1b2', 'c1c2', 'c1d2', 'a1a2', 'g1g2', 'd1c2', 'd1d2', 'd1e2']
+ result = sf.legal_moves("yarishogi", sf.start_fen("yarishogi"), [])
+ self.assertCountEqual(legals, result)
+
def test_get_fen(self):
result = sf.get_fen("chess", CHESS, [])
self.assertEqual(result, CHESS)
const board = new ffish.Board("crazyhouse", "r1b3nr/pppp1kpp/2n5/2b1p3/4P3/2N5/PPPP1PPP/R1B1K1NR/QPbq w KQ - 0 7");
chai.expect(board.numberLegalMoves()).to.equal(90);
board.delete();
+ const yariboard = new ffish.Board("yarishogi");
+ chai.expect(yariboard.numberLegalMoves()).to.equal(20);
+ yariboard.delete();
});
});