Genshin TIS
TIS (short for Teyvat Instruction Set) is a Genshin Impact-themed esoteric programming language/interpreter, implemented in Python. It features custom variables, interactive terminals, and game-themed instructions inspired by Genshin Impact, making it a fun esolang for both Genshin fans and esolang enthusiasts.
Overview
TIS is designed to mimic in-game operations in Genshin Impact, with core features including variable management (e.g., Mora, Resin, custom INIT), interactive input/output via "Void Terminal", and conditional execution of game-themed commands (e.g., artifact enhancement, character skills, gacha).
The language is implemented with three core Python scripts: - `tisrun.py`: Directly execute TIS scripts - `tisbuild.py`: Compile TIS scripts to Python code - `tiscompiler.py`: Compile and execute TIS scripts in one step
Features
- Custom variables (supports numeric variables like `INIT`, `Mora`, `Resin`, `Primogems`)
- Interactive "Void Terminal" for user input (`虚空终端:采集`) and output (`虚空终端:打印`)
- Genshin Impact-themed instructions (artifact enhancement, character skills, gacha system)
- Conditional statements (Chinese syntax: `若 [condition] 则 [command]`)
- Logging support (enable with `# LOG: ON` at the start of scripts)
- Status display command (`显示状态` to print all variable values)
Example Code
A basic TIS program demonstrating variables, interactive input, and conditional execution:
# Enable logging
LOG: ON
# Initialize custom variable
INIT=50
# Print initial value via Void Terminal
虚空终端:打印 初始INIT值为{INIT}
# Get user input
虚空终端:采集
# Print updated value
虚空终端:打印 采集后INIT值为{INIT}
# Conditional execution
若 INIT>=100 则 圣遗物强化
若 INIT<100 则 抽卡
# Show all variables
显示状态
- Expected Behavior
1. The program initializes `INIT` to 50 and prints it. 2. It prompts the user to enter a new value for `INIT`. 3. It prints the new value and executes either "artifact enhancement" or "gacha" based on the value. 4. Finally, it displays all current variable values.
Implementation
TIS is fully implemented in Python 3.8+, with no external dependencies beyond the Python standard library. The source code is publicly available on Gitee:
- Official Repository: TIS on Gitee
- Core Files:
- `tisrun.py`: Runtime interpreter for TIS scripts - `tisbuild.py`: Compiler from TIS to Python - `tiscompiler.py`: Combined compile + run utility
Precompiled Windows executables (no Python required) are also available in the `dist/` directory of the repository.
Usage
- Running from Source
```bash
- Clone repository
git clone https://gitee.com/sakuracoder/tis.git
- Enter source directory
cd TIS/src
- Run example script
python tisrun.py ../examples/basic_demo.tis