https://github.com/qluana7/fumen-cpp
C++ Library for encoding/decoding fumen
https://github.com/qluana7/fumen-cpp
cpp17 fumen tetris
Last synced: 8 months ago
JSON representation
C++ Library for encoding/decoding fumen
- Host: GitHub
- URL: https://github.com/qluana7/fumen-cpp
- Owner: qluana7
- License: mit
- Created: 2025-08-14T13:56:42.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-08-22T10:10:28.000Z (10 months ago)
- Last Synced: 2025-09-17T02:22:44.116Z (9 months ago)
- Topics: cpp17, fumen, tetris
- Language: C++
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fumen++
**fumen++** is a header only C++ library for encoding and decoding [fumen](https://fumen.zui.jp/) strings, which represent Tetris field states. This project is a C++ port of the original [knewjade/tetris-fumen](https://github.com/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.
```shell
# On shell
git clone https://github.com/qluana7/fumen-cpp
```
```cmake
# CMakeLists.txt
target_include_directory( PRIVATE )
```
### 2. Decoding a Fumen String
```cpp
#include
#include
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
```cpp
#include
#include
int main() {
fumen::fumen_page page;
std::string fumen_code = fumen::encode({ page });
std::cout << fumen_code << std::endl;
}
```
## References
- Original TypeScript implementation: [knewjade/tetris-fumen](https://github.com/knewjade/tetris-fumen)
## License
This project follows the same license as the original repository. See [knewjade/tetris-fumen](https://github.com/knewjade/tetris-fumen) for details.