Skip to content

Kixenon/cobra-movegen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cobra Movegen

A high-performance bitboard-based move generator for tetromino stackers.

Overview

This project was originally derived from Cobra, but has since gone through major changes, with some reference from fast-reachability.

Currently, it runs perft from an empty position, though this can be modified as needed in apps/bench.cpp.

Features

  • SRS/SRS+ rotation system
  • 180 spins
  • T-spin detection (full and mini)
  • Configurable piece spawn (rising spawns, clutch clear)
  • Full movegen (non-infinite SDF)
  • Canonical, deduplicated moves
  • Move input pathfinding with finesse
  • Header-only library

Cobra Movegen achieves high single-thread performance through data-level parallelism (register-friendly wide operations), compile-time template specialization, and aggressive search-space pruning.

Benchmarked on an M2 MacBook Pro (results may vary):

./bin/bench IOLJSZT
Depth: 7 Nodes: 2647076135 Time: 5946ms NPS: 445111171

Usage

  • Requires C++23
make help # Shows build information
make bench && ./bin/bench <queue (e.g. "IOLJSZT") or "test">

If you wish to use this as a submodule, simply include headers in src.

Remember to define the rules! More information can be found in src/ruleset.hpp

struct Rules : RulesetBase {
    static constexpr Policy::KickRule KICKS = Policy::KickRule::SRS;
    static constexpr Policy::SpinRule SPINS = Policy::SpinRule::NONE;
    static constexpr int SPAWN_Y = 19;
    static constexpr bool ENABLE_180 = false;
};

Links

Credits

  • Kixenon - Developer and maintainer
  • Special thanks to ImpleLee and Opyu

License

This project is open source and available under the Apache 2.0 License.

About

A high-performance move generation implementation for tetromino stackers.

Topics

Resources

License

Stars

Watchers

Forks

Contributors