This project is a simple automation bot for the terminal-based typing game ttyper. It leverages Go for image processing, OCR (Optical Character Recognition), and input automation. The bot is designed to enhance typing speed in the game while serving as a hands-on experiment in game automation, pattern recognition, and Go programming.
This project aims to:
- Explore game automation on an offline game to ensure it doesn't affect other players' experiences.
- Serve as a foundation for understanding and experimenting with automation, pattern recognition, and Go language programming.
- Provide a base for future larger-scale automation experiments.
- Captures the game window via screenshot.
- Preprocesses the image by cropping and converting it into a binary (black-and-white) format for improved OCR accuracy.
- Uses OCR to extract text from the processed image.
- Simulates typing the extracted text into the game window.
- Designed for macOS with tesseract OCR.
.
├── go.mod
├── go.sum
├── main.go
└── screenshots
├── binary.png # Binary image after preprocessing
├── cropped.png # Cropped image for OCR
└── screenshot.png # Original screenshot of the game window
- Screen Capture: Captures the screen of the primary display using the
kbinani/screenshotpackage. - Image Preprocessing: Crops the game area and converts the image to binary for better OCR performance.
- Text Extraction: Extracts text using the Tesseract OCR library.
- Simulated Typing: (Currently disabled) Simulates typing the extracted text into the game window using
robotgo.
- Capture: Captures a screenshot of the current display.
- Preprocess: Crops the image to focus on the typing area and converts it to binary.
- OCR: Extracts text from the binary image.
- Automation: Simulates typing the text into the game window. (Currently outputs extracted text to the terminal.)
- Dependencies: Install Go and the required packages listed in
go.mod. - Tesseract OCR: Install Tesseract OCR. Note that macOS users may encounter issues due to limited ARM support.
- Permissions: On macOS, grant permissions for screen recording and accessibility to allow automation.
Use git to clone this project and navigate into the folder:
git clone https://github.com/orca1018/Typing-Game-Automation-Bot
cd Typing-Game-Automation-BotMake sure you have Go installed (Go 1.18 or higher is recommended). Then tidy up dependencies:
go mod tidyYou need to install Tesseract and ensure it's available in your system's PATH.
brew install tesseractsudo apt update
sudo apt install tesseract-ocr- Download the Windows installer from: https://github.com/UB-Mannheim/tesseract/wiki
- Install it and note the install path (e.g.
C:\Program Files\Tesseract-OCR) - Add that folder to your System PATH
- Open Command Prompt and test with:
tesseract --versionLaunch the game in a terminal window:
ttyperMake sure the game is in fullscreen or maximized so the OCR has a clean view.
In a second terminal window, run the bot:
go run main.goThen switch back to the terminal running ttyper — the bot will take over from there and start typing automatically.
That’s it — you’re ready to watch your bot dominate the keyboard.
| Screenshot | Cropped Image | Binary Image |
|---|---|---|
![]() |
![]() |
![]() |
Please note that Tesseract OCR can be quite slow depending on your hardware. After running the bot, it might take a while before the typing begins. Be patient and ensure that the game screen is in full focus while the bot processes the text.
Here is a short demo of the bot in action:
If the demo GIF doesn’t appear, click here to view it directly.
- OCR Accuracy: The bot uses Tesseract OCR, which is resource-intensive and may not always extract text perfectly.
- Typing Speed: Currently,
robotgotypes at around 2000 WPM. To increase speed, consider implementing clipboard-based pasting instead. - Platform Dependency: The project is developed on macOS and may not work out of the box on other platforms.
- Game Compatibility: The bot is tailored for ttyper and lacks looping mechanisms to handle scrolling text in other games.
This project is not actively maintained. However, if you encounter issues or have ideas for improvement, feel free to open an issue. Contributions are welcome, but there are no guarantees for updates or fixes.
This project is licensed under the MIT License. See LICENSE for details.
- The game ttyper for providing a simple and engaging typing experience.
- Ahmad Rosid for helpful resources on image processing in Go.
- The authors of the Go libraries and tools used in this project, including:
This project is a personal experiment and learning exercise. If you want to use or extend it, feel free to fork the repository and modify it as needed. Have fun!



