aiwolf-nlp-common
Project description
aiwolf-nlp-common
人狼知能コンテスト(自然言語部門) のエージェント向けの共通パッケージです。
ゲームサーバから送信されるJSON形式のデータをオブジェクトに変換するためのパッケージです。
import json
from aiwolf_nlp_common.packet import Packet
value = """{"request":"INITIALIZE","info":{"day":0,"agent":"Agent[01]","statusMap":{"Agent[01]":"ALIVE","Agent[02]":"ALIVE","Agent[03]":"ALIVE","Agent[04]":"ALIVE","Agent[05]":"ALIVE"},"roleMap":{"Agent[01]":"WEREWOLF"}},"setting":{"playerNum":5,"maxTalk":5,"maxTalkTurn":20,"maxWhisper":5,"maxWhisperTurn":20,"maxSkip":0,"isEnableNoAttack":false,"isVoteVisible":false,"isTalkOnFirstDay":true,"responseTimeout":120000,"actionTimeout":60000,"maxRevote":1,"maxAttackRevote":1,"roleNumMap":{"BODYGUARD":0,"MEDIUM":0,"POSSESSED":1,"SEER":1,"VILLAGER":2,"WEREWOLF":1}}}"""
packet = Packet.from_dict(json.loads(value))
print(packet.request) # Request.INITIALIZE
print(packet.info.agent) # Agent[01]
詳細については下記のプロトコルの説明やゲームサーバのソースコードを参考にしてください。
プロトコルの実装について
インストール方法
python -m pip install aiwolf-nlp-common
運営向け
パッケージ管理ツールとしてuvの使用を推奨します。
git clone https://github.com/aiwolfdial/aiwolf-nlp-common.git
cd aiwolf-nlp-common
uv venv
uv sync
パッケージのビルド
uv build
パッケージの配布
PyPI
uv publish --token <PyPIのアクセストークン>
TestPyPI
uv publish --publish-url https://test.pypi.org/legacy/ --token <TestPyPIのアクセストークン>
uvを使用しない場合については、パッケージ化と配布については下記のページを参考にしてください。
Packaging and distributing projects
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
aiwolf_nlp_common-0.6.0.tar.gz
(42.1 kB
view details)
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 aiwolf_nlp_common-0.6.0.tar.gz.
File metadata
- Download URL: aiwolf_nlp_common-0.6.0.tar.gz
- Upload date:
- Size: 42.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9731d1a8317403b6bf06b79ee621250ba72ccf5b5ef756afc7833b2ef42bc462
|
|
| MD5 |
3cee091e5dd3d03fcd3e201f57a20846
|
|
| BLAKE2b-256 |
ff12daddf531c1099835fc5ce865edad03c7f5239a9d9de3855ba50298a163f7
|
File details
Details for the file aiwolf_nlp_common-0.6.0-py3-none-any.whl.
File metadata
- Download URL: aiwolf_nlp_common-0.6.0-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75427ab6b1955f96d2eb81d1b17895884c63dc4a7eec5a2c0e922fae11bac139
|
|
| MD5 |
6022025be1b128168dbe88233af5438f
|
|
| BLAKE2b-256 |
4631d0d35c12dd60912d28a667438133f284672c0e3903f0682c863964fdeb26
|