Skip to content

qluana7/fumen-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

fumen++

fumen++ is a header only C++ library for encoding and decoding fumen strings, which represent Tetris field states. This project is a C++ port of the original knewjade/tetris-fumen (TypeScript) implementation.

Features

  • Encode and decode fumen strings to and from C++ objects
  • Full support for Tetris field, piece operations, comments, and quiz mode
  • Minimal dependencies (uses only the C++ standard library)
  • Designed for C++17 and later
    └─ This library was originally designed for C++20. If you encounter any bugs when using C++17, please open an issue.

Getting Started

1. Include in Your Project

Clone this repository and add the fumen++ directory to your include path.

# On shell
git clone https://github.com/qluana7/fumen-cpp
# CMakeLists.txt
target_include_directory(<target> PRIVATE <path_to_fumen++>)

2. Decoding a Fumen String

#include <fumen.hpp>
#include <iostream>

int main() {
    std::string fumen_code = "v115@vhAAgH";
    auto pages = fumen::decode(fumen_code);

    for (const auto& page : pages) {
        std::cout << page.m_field.to_string() << std::endl;
        std::cout << "Comment: " << page.m_comment << std::endl;
    }
}

3. Encoding to a Fumen String

#include <fumen.hpp>
#include <iostream>

int main() {
    fumen::fumen_page page;
    std::string fumen_code = fumen::encode({ page });

    std::cout << fumen_code << std::endl;
}

References

License

This project follows the same license as the original repository. See knewjade/tetris-fumen for details.

About

C++ Library for encoding/decoding fumen

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages