Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Meta

Post History

60%
+1 −0
Meta What would this community like to see in a Codidact API?

I'd like to post king-of-the-hill contests that read code directly from answers Essentials This is the only feature I would need in order to start posting contests. The answer content for each...

posted 2y ago by trichoplax‭

Answer
#1: Initial revision by user avatar trichoplax‭ · 2022-09-29T15:13:02Z (about 2 years ago)
## I'd like to post king-of-the-hill contests that read code directly from answers

### Essentials
This is the only feature I would need in order to start posting contests.

- **The answer content for each answer to a specified post**  
This allows extracting the code block that constitutes a king-of-the-hill contest entrant programmatically, rather than needing to paste code into the controller each time there is a new entrant or an edit. This allows anyone to watch a tournament in their browser without needing to download or install anything, and without needing to wait for the contest host to update anything.

### Nice-to-have optional extras
For me, these are not necessary in order for me to start posting contests, but I would be likely to use them if they existed.

- **The comments on a specified answer**  
This allows the contest host to add comments to answers that then affect the behaviour of the controller. For example, adding a comment containing the word "disqualified" could cause the controller to exclude that answer from tournaments.
- **The edit history of a specified answer**  
This would allow specifying a date in the controller, and running a tournament with the entrants as they were at that date. This could be interesting for contests where the entrants evolved over time and watching a tournament play out with the latest versions only tells half the story. It would also allow showing a chart of different entrants rising and falling over time, rather than just a final leaderboard.

### Thoughts
My interest in using an API for hosting king-of-the-hill contests was initially in JavaScript contests viewable in a webpage by anyone. However, reading code from answers using an API would also save work for contests in other programming languages where the contest host runs tournaments on their own machine.

I'd like to experiment with using WebAssembly to allow entrants in any language that can be compiled to it, in order to run a language-agnostic contest. This would mean the benefit of anyone being able to run a tournament in their web browser would no longer only apply to JavaScript specific contests.