Metadata-Version: 2.1
Name: capture-the-flag
Version: 0.0.3
Summary: A Capture The Flag (CTF) environment.
Home-page: https://github.com/documentedai/capture-the-flag
Author: Christian Lang
Author-email: me@christianlang.io
License: BSD
Download-URL: https://pypi.org/project/capture-the-flag/
Project-URL: Documentation, https://capture-the-flag.readthedocs.io/en/latest/
Project-URL: Source, https://github.com/documentedai/capture-the-flag
Project-URL: Tracker, https://github.com/documentedai/capture-the-flag/issues
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
Requires-Dist: numpy
Requires-Dist: pyglet
Provides-Extra: docs
Requires-Dist: sphinx ; extra == 'docs'
Provides-Extra: testing
Requires-Dist: pytest ; extra == 'testing'
Requires-Dist: pytest-cov ; extra == 'testing'
Requires-Dist: flake8 ; extra == 'testing'

# 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)

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/)


