A package to run bots for 漢字でGO!.
Project description
kadego
kadego is a python package for running bots to play the browser game 漢字でGO!.
This package allows you to automate gameplay, collect data (like readings and meanings), and customize game-playing strategies.
📦 Structure
This package provides five main objects to work with: Bot, Logger, Observer, Strategy and Runner.
🦾 Bot
The Bot is the one actually playing the game.
When calling its launch method it navigates to the provided mode and level, sets the provided number of lives
and questions and finally enters into the level. Calling the run method will then make the bot play a full game
answering questions according to the specified strategy and logging answers with the specified logger.
📜 Logger
A Logger logs data from the game.
Its log method is called each time an answer is presented to the associated Bot and provided with the current
gameVariables. An example use case would be storing readings and meanings to a JSON file.
👀 Observer
An Observer runs in parallel to a Bot.
Its observe method runs continuously and can perform actions depending on the state of the Bot or any outside
factors. One of these actions can be stopping the Runner from continuing to run the Bot. An example use case would
be stopping the Bot after a certain amount of time or when the intended task has been completed.
🧠 Strategy
A Strategy returns an answer and the corresponding outcome when presented with a question.
Its solve method is called each time the associated Bot is presented with a question. The Strategy will then
depending on the gameVariables and the current GameStatus choose a Solver to provide an answer and the associated
outcome. An example use case would be acing the game by always choosing the right answer.
🚀 Runner
A Runner is responsible for concurrently running a Bot together with an Observer.
Its run method runs the specified Bot by first calling its launch method and the repeatedly calling its run
method until a signal to stop is sent. Additionally, it also runs the specified Observer by calling its observe
method.
🗺️ Map
The different game modes are conceptualized as a WorldMap which the Bot uses to navigate namely the KanjiDeGoMap.
⚙️ Main
The main (メイン) mode has levels:
- easy (ノーマル)
- hard (ハード)
- very_hard (ゲキムズ)
- hell (ヘル)
🔄 Casual
The casual (カジュアル) mode has levels:
- basic (ベーシック)
- variety (バラエティ)
- variety_hard (鬼・バラエティ)
- one_character (一文字)
- four_characters (四字熟語)
- places (国・都市の名前)
- bugs (虫の名前)
- mammals (哺乳類の名前)
- birds (鳥の名前)
- aquatic (水性物の名前)
- plants (植物の名前)
- food (グルメ・調味料)
⏱️ Rush
The rush (ラッシュ) mode has levels:
- level_1 (1ラッシュ)
- level_2 (2ラッシュ)
- level_3 (3ラッシュ)
- level_4 (4ラッシュ)
- level_5 (5ラッシュ)
- level_6 (6ラッシュ)
- level_7 (7ラッシュ)
🌟 Extra
extra (エクストラ) mode has levels:
- math (数学アタック)
- math_hard (鬼・数学アタック)
- english (英語・アタック)
- elements (元素記号)
⚙️ Installation
To install kadego, run
pip install kadego
📚 Example Usage
To run a bot that scrapes all the readings and meanings for words from a single level, you can run the following.
import asyncio
from kadego import get_kadego
from kadego.runners import SingleLevelScraper
async def run(level: int, log_path: str) -> None:
kadego = await get_kadego()
runner = SingleLevelScraper(kadego, level, log_path)
await runner.run()
if __name__ == "__main__":
example_level = 1
exampe_log_path = "/path/to/store/data/to"
asyncio.run(run(example_level, exampe_log_path))
The bot will then run until the data for all words has been collected.
🛠️ Troubleshooting
漢字でGO! might crash or time out from time to time. This will in turn crash the Bot meaning you wil need to rerun
your script.
📝 Changelog
v0.1.0 — Initial release (based on 漢字でGO! v1.1.2.2b). v0.1.1 — Included 7ラッシュ and improved stability.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kadego-0.1.1.tar.gz.
File metadata
- Download URL: kadego-0.1.1.tar.gz
- Upload date:
- Size: 28.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b0804b446c79424a5187160b26bb2c6627dfb95fada9412655bbf126724d9b0
|
|
| MD5 |
9641e3b6f3aea926a1d112f021420baf
|
|
| BLAKE2b-256 |
4f008388ca72733b3f7e10a801faa6ef17eb80d8f88460f80c4890eab79a4fab
|
File details
Details for the file kadego-0.1.1-py3-none-any.whl.
File metadata
- Download URL: kadego-0.1.1-py3-none-any.whl
- Upload date:
- Size: 36.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dde57760fd1f27bfed30a8b64487af553f5df6b45ae0da85cd9ad2c9786e74fa
|
|
| MD5 |
3c0c65c1eb9e1027ed957e217959a3c4
|
|
| BLAKE2b-256 |
0170396c3faf766923c2c855a4eade920354d79ae15a14a6e06677aebe9ed660
|