A Capture The Flag (CTF) environment.
Project description
Capture The Flag (CTF)
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 details)
Built Distribution
File details
Details for the file capture-the-flag-0.0.4.tar.gz
.
File metadata
- Download URL: capture-the-flag-0.0.4.tar.gz
- Upload date:
- Size: 56.7 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3cb9a8736e6edf20dd626f2411dea723d2e6f9dab3b5cdaf37752e8c5264478 |
|
MD5 | fc5ef23a8a16d41362af9a619d013ea8 |
|
BLAKE2b-256 | 0331b7fcc72c846ccc56f496be9182ab84443f26a299c481fe0560cb46f65da8 |
File details
Details for the file capture_the_flag-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: capture_the_flag-0.0.4-py3-none-any.whl
- Upload date:
- Size: 61.9 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07fd09b5a702444e64f0c9e6267dc16ae00352114d62eba64cdcc87d4dcf0527 |
|
MD5 | 539f60afefc6ebcea66a3ee90a48fa3f |
|
BLAKE2b-256 | a425cf0bcdbffb71989707482bdcf3424fbca3eba51463e06b332926bf282cf6 |