Skip to main content

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

Release files for capture-the-flag 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for capture-the-flag 0.0.4
File Size Uploaded
capture-the-flag-0.0.4.tar.gz 56.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for capture-the-flag 0.0.4
File Interpreter ABI Platform
capture_the_flag-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 118.5 kB

Release files / capture-the-flag-0.0.4.tar.gz

Download URL capture-the-flag-0.0.4.tar.gz
Size 56.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a3cb9a8736e6edf20dd626f2411dea723d2e6f9dab3b5cdaf37752e8c5264478
BLAKE2b-256 checksum
How to use checksums
0331b7fcc72c846ccc56f496be9182ab84443f26a299c481fe0560cb46f65da8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

Release files / capture_the_flag-0.0.4-py3-none-any.whl

Download URL capture_the_flag-0.0.4-py3-none-any.whl
Size 61.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07fd09b5a702444e64f0c9e6267dc16ae00352114d62eba64cdcc87d4dcf0527
BLAKE2b-256 checksum
How to use checksums
a425cf0bcdbffb71989707482bdcf3424fbca3eba51463e06b332926bf282cf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page