Skip to main content

A Capture The Flag (CTF) environment.

Project description

Capture The Flag (CTF)

PyPI Latest Release Package Status License Upload Python Package Coverage

Capture The Flag (CTF) is a Python package for reinforcement learning. This package is not related to CTF Hacking competitions.

Installation

pip install capture-the-flag

Dependencies

Usage

For a random game.

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

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

capture-the-flag-0.0.4.tar.gz (56.7 kB view hashes)

Uploaded Source

Built Distribution

capture_the_flag-0.0.4-py3-none-any.whl (61.9 kB view hashes)

Uploaded Python 3

Supported by

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