Creates and compiles GGP js/html projects
Project description
Toolchain for writing General Game Players
This simple script allows you to build
and organize sophisticated general game playing (GGP)
projects. Currently, players are defined by a single html
file,
which means that projects are either confined to a single file
or require a lot of tedious, error-prone manual copy-and-paste if functionality
is spread across different files.
This script allows you to define only the functionality
for the player that you are creating, avoiding all the boilerplate
and copying and pasting. It also allows you to manage slightly larger projects
by generating an html
file from a template and (potentially multiple)
given javascript files.
Setup
Just clone the repository and optionally add it to your PYTHONPATH
.
This has been tested on Python 3.10.5 (no dependencies), but it is
simple enough that it should work with essentially any version
of Python 3
Usage
To create a new player from the sample template, run
python ggp_template.py new myplayer.js
To build an HTML file from a player, run
python ggp_template.py make myplayer.js --out=out.html --ident=your_identifier
You can build multiple javascript files by simply passing multiple arguments (no dependency resolution is done; the scripts are added to the HTML file in the order they are passed in):
python ggp_template.py make lib.js myplayer.js --out=out.html --ident=your_identifier
Options
The make
subcommand takes the following options:
template
The template HTML file to use (defaults to sample.html)ident
The identifier for your playerstrategy
The strategy name that is displayed on the pagetitle
The title for the page (defaults to the strategy and identifier)out
The html file to write to (defaults to stdout)
While javascript files are convereted to data:text,
(hence URI encoded),
none of the other options are escaped. Therefore,
if the title
contains valid HTML, it will simply be inserted into the HTML
file without any extra escaping.
Recommendations
Add this repository to your PYTHONPATH so that you can access the file from anywhere.
Most editors will allow you to set up a custom build
command. In vscode, for example, you can create a tasks.json
file in the project directory and set this to be the default
build task as described here.
If you want more sophisticated tooling, such as automatic dependency resolution
or compiling from e.g. Typescript, use webpack
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ggp_template-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b062e95c63f41b2894fc4cddfb761575d66aec92ff047b798250965ad8bde12 |
|
MD5 | b09724648e6339063f5da0cc11160ffb |
|
BLAKE2b-256 | 6bfa7cd8228796d4d95f68bcb0a7fd26bae2583625db3813ee1212dad1b86aca |