Skip to main content

A command-line tic-tac-toe game

Project description

pyjzq

Build Status License PyPI

这是一个基于命令行的井字棋游戏。

安装

pip install pyjzq

使用方法

在Python代码中使用 你可以在Python代码中导入并使用这个包。以下是一个简单的示例:

from pyjzq import TicTacToe, play, HumanPlayer

def main():
    # 创建游戏实例
    game = TicTacToe()

    # 创建玩家实例
    x_player = HumanPlayer('X')
    o_player = HumanPlayer('O')

    # 开始游戏
    play(game, x_player, o_player)

if __name__ == "__main__":
    main()

示例输出

以下是运行上述代码时的示例输出:

| 0 | 1 | 2 |
| 3 | 4 | 5 |
| 6 | 7 | 8 |

X makes a move to square 0
| X |   |   |
|   |   |   |
|   |   |   |

O makes a move to square 1
| X | O |   |
|   |   |   |
|   |   |   |

...

X wins!

开发

如果你想要为这个项目做出贡献,你可以按照以下步骤进行开发和测试:

克隆仓库

git clone https://github.com/tianhukj/pyjzq.git

创建虚拟环境并安装依赖

cd pyjzq
python -m venv venv
source venv/bin/activate  # Windows 上使用 `venv\Scripts\activate`
pip install -r requirements.txt

运行测试

python main.py

许可证

该项目使用 MIT 许可证

#贡献

欢迎贡献!请阅读 CONTRIBUTING.md 了解详细的贡献流程。

反馈

如果你有任何问题或建议,请通过 Issues 页面反馈。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyjzq-0.2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyjzq-0.2-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file pyjzq-0.2.tar.gz.

File metadata

  • Download URL: pyjzq-0.2.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.18

File hashes

Hashes for pyjzq-0.2.tar.gz
Algorithm Hash digest
SHA256 d94fd1b85fd19531888d43a05157c0382278a394ba277798112ab1868cc170f2
MD5 0ea11fa27eb333a0871045bf597c32cc
BLAKE2b-256 aca53ac78bc22ab255a2a8bdc307683b07c0e3242378bd1dec6a2a1b567861ca

See more details on using hashes here.

File details

Details for the file pyjzq-0.2-py3-none-any.whl.

File metadata

  • Download URL: pyjzq-0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.18

File hashes

Hashes for pyjzq-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 aa408c0b5e48e6a7da78b459a9ed67f3499063d1af9fed89b4fb93faa3228224
MD5 8848a55bea2aab6ebf19a7b548722165
BLAKE2b-256 45f1e630581c4ce2d13988c2f44db1b9ad7d03145dc1178e74497be4b797d8c7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page