# Capture The Flag (CTF)
[![PyPI Latest Release](https://img.shields.io/pypi/v/capture-the-flag.svg)](https://pypi.org/project/capture-the-flag/)
[![Package Status](https://img.shields.io/pypi/status/capture-the-flag.svg)](https://pypi.org/project/capture-the-flag/)
[![License](https://img.shields.io/pypi/l/capture-the-flag.svg)](https://github.com/documentedai/capture-the-flag/blob/master/LICENSE)
[![Upload Python Package](https://github.com/documentedai/capture-the-flag/workflows/Upload%20Python%20Package/badge.svg?branch=master)](https://github.com/documentedai/capture-the-flag/actions?query=branch%3Amaster)
[![Coverage](https://codecov.io/github/documentedai/capture-the-flag/coverage.svg?branch=master)](https://codecov.io/gh/documentedai/capture-the-flag)
Capture The Flag (CTF) is a Python package for reinforcement learning. This package is not related to [CTF Hacking](https://en.wikipedia.org/wiki/Capture_the_flag#Computer_security) competitions.
## Installation
```
pip install capture-the-flag
```
## Dependencies
- [numpy](https://www.numpy.org)
- [pyglet](http://www.pyglet.org)
## Usage
For a random game.
```python
import random
import time
import ctf
game = ctf.Ctf()
game.new_game()
fps = 30
while not game.winner:
for unit in game.need_to_move:
started = time.time()
game.render()
legal_moves = game.legal_moves()
game.move(unit=unit, direction=random.choice(legal_moves[unit]))
finished = time.time()
sleeptime = 1.0/fps - (finished - started)
if sleeptime > 0:
time.sleep(sleeptime)
print(game.board)
print(game.score)
print(game.winner)
```
## [Documentation](https://capture-the-flag.readthedocs.io/en/latest/)
Python库 | capture-the-flag-0.0.4.tar.gz
版权申诉
15 浏览量
2022-04-07
01:14:04
上传
评论
收藏 55KB GZ 举报
挣扎的蓝藻
- 粉丝: 12w+
- 资源: 15万+
最新资源
- Java毕业设计:SpringBoot Vue工作考勤管理系统源码(代码可直接运行)
- 论文复刻中国式融资融券与企业金融化-双重差分模型(Stata代码附数据)PSM+DID
- 夜间灯光数据“合成DMSP(1992-2020)”(年度数据)
- 基于springboot的网上花店系统,包含后端springboot项目、前台(用户角色)和后台管理(管理员/卖家角色)两个前端
- 2022年版本异质机构投资者(压力敏感型和压力抵制型机构投资者)数据2000-2022年
- 【重磅、详细、2022更新!】1990-2022上市公司环境保护税(排污费)数据大合集!
- TVP-SV-VAR方法的MATLAB操作步骤及关键代码解释
- 7607p电信固件V2.0.0P1N6
- 0到180度移相电路Multisim仿真
- 全国水体矢量分省市县合集2023年OSM数据-一二三四五级水系与水系流域shp矢量数据
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈