AI-Tournaments is a platform for competitive programming and match making between algorithms. Users can make their own participates to compete in any of the existing arenas, or make their own custom arena and challenge other users to join. "AI" in the name refers to playing against the computer on old video games, like "Hard AI" or "Hard CPU".
AI-Tournaments in an early prototype stage. See the section Participate if you want to join a arena, then analyze how other have solved the arena until better documentation has been written.
Join the official GitHub or Discord community. Please read and follow the community guide lines.
To participate in a Arena you need to create a public GitHub repository and apply three topics: AI-Tournaments
, AI-Tournaments-Participant
and the full repository name of the arena (ExampleAuthor--ExampleArena
). The repository also has to have a file in root called participant.js
, this is the file that will be called to the arena. The repository's name will represent the participants name, except if it starts with AI-Tournaments-Participant-
then that part is omitted.
Currently not supported.
For both developing arenas and participants.
In Local development setups you can add the URLs to arena (arena.js
along with the arenas replay page) and participants to test with before publishing them in GitHub.
Explanation
Key | Description | Example |
---|---|---|
arena.url | URL to a arena.arena.js . |
"http://127.0.0.1:8080/Community-Arena/" or "https://raw.githubusercontent.com/AI-Tournaments/Worm-Arena/main/" |
arena.name Optional |
Displayed name. Name defaults to URL if left empty. |
"New-Community-Arena" |
arena.replay | URL to replay view. | "http://127.0.0.1:8080/Community-Arena-Replay/" |
arena.settings Optional |
Prefigured settings. | {"general":{"seed":"example"}} |
participants | Adds participants. Array with either a url string to script or a JSON object per participant. |
["http://127.0.0.1:8080/Community-Arena-Test-Participants/participant-1.js",{"url":"http://127.0.0.1:8080/Community-Arena-Test-Participants/participant-2.js","name":"Temp-Participant","team":1}] |
The development environment also includes some extra dials and features to help with quality assurance.
Participant's URLs can be written in different forms. An ordinary URL is interpreted in the default sealed sandbox, but URLs that starts with a question mark (?
) is executed as plain javascript and can be debugged by the javascript debugger
command.
If you need more freedom for debugging or would like to train a neural network you should investigate using an interface, which's URLs starts with a exclamation mark (!
). The main difference between an Interface and a Participant is that interfaces opens up a separate web page and sidestep all participant's restrictions. The main use case for interfaces is to get better insight during a running match, for example by allowing Human vs Participant and even Human vs Human matches.
By appending a question mark (?
) after the first special character (??
or !?
) the arena will insert a break point just before the first message is posted to the participant or interface so that JavaScript debuggers can be used to step inside along with the first message.
The arena.js
and participant.js
optional file header has to be valid Json otherwise it is omitted. The header can be placed anywhere in the file, but at the top is recommended as a standardization.
/**
{}
**/
/**{}**/
/**{
"example": true
}**/
To load libraries like jQuery and others, copy the files to the repository and add them to the file header. The files has to be referenced locally. The sources are imported assigned order.
/**{
"dependencies": [
"exampleLib.js",
"other/exampleLib.js"
]
}**/
- engine262
AI-Tournaments uses engine262 for sandboxing matches and execute then deterministically. - JSON Editor
AI-Tournaments uses JSON Editor by Jos de Jong, powered by Ace (Ajax.org Cloud9 Editor) and Ajv JSON schema validator, for editing, rendering and validating JSON. - seedrandom
AI-Tournaments uses seedrandom by David Bau for overridingMath.random()
to generate repeatable numbers. - Supabase
AI-Tournaments uses Edge Functions by Supabase for serverless backend.
AI-Tournaments is not Open Source by the Open Source Initiative's definition but rather Source Available, except were a license that says otherwise is in place. This might change when AI-Tournaments leaves the prototype stage, the decision has not yet been made.
AI-Tournaments executes user written JavaScripts in the web browser, which is usually seen as a security concern (Cross-site scripting). But the scripts are loaded into a sandbox IFrame and Web Worker to prevent just that. But the concern still remain and that's a fact that should not be hidden, that is why it is instead addressed and displayed publicly here.
But if you do find a way to break out of the sandbox and access client data or other participant scripts, please do report it! Reporters of confirmed security holes will get a honorable mention once the hole is fixed.
A server-side events with official match results is planned, but until then client-side execution is the only way to run the arenas. Note that interfaces will not be able or allowed to compete.
The source code for AI-Tournament's arena executor and the official arenas are available in order to make it easier to examen the "rules" and come up with optimal strategies. You are basically allowed to do what ever as long as it isn't commercial matches.
Download code from AI-Tournaments to ...
- Develop, troubleshooting or train an AI.
- Writing and recording dev-diary or tutorial.
- Have your own internal non-profit tournaments.
- Scientific research.
- Please do tell if something is published! 😃
Basically anything that gives something back to the community.
- Removing all links and references to AI-Tournaments.
- Setup a commercial competitor to AI-Tournaments.
- Private tournaments for benchmarking user performance.
If you have any doubts, you can request permission here.