King of the Hill, or KotH, is probably the most unique tag on CGCC. If you've never come across it before, today's your lucky day!
In a KotH, submissions will consist of "bots" which compete in some game. Because a KotH involves simulating a (sometimes quite complicated) game, they tend to form much more of a community than other types of challenges.
How a KotH works
Before posting, the author of a KotH will write a program called a controller. This will simulate all aspects of the game, in addition to providing scoring, I/O with bots, and sometimes additional features to make testing bots easier (like graphical output or debugging).
Bots will be submitted as answers, typically with their own names. It's recommended that KotHs are restricted to a single language, but typically this will be something somewhat common like Python or JS. If you don't know the language a KotH is using but still want to compete, ask in chat! Someone will probably be glad to "translate" for you.
To run the KotH, all submissions will be copied into the controller. Sometimes this is done with an automated script. Then, bots are grouped up and the game begins! Whatever scoring the KotH uses will be used to determine a winner.
I wanted to write a nice long section about the advancements in KotHing since it first came about, but it seems great ideas were present almost from the very beginning.
The first King of the Hill challenges date back to the early days of the site, long before I was around. The first few, in 2011, consisted of simple games like prisoner's dilemma, auctions, and card games. In 2014, more complex ideas began to emerge, involving more complicated interaction and combat between bots, often in simulated 2d worlds.
The rate in which KotHs have been posted has decreased over time, with one major factor in this likely being older users leaving the site. But with some recent KotHs reaching large audiences, this trend could soon be turning around.
Playing in a KotH
Writing a bot is easier than it seems! KotHs often look daunting: their specs are longer than other challenges, they've got controllers you need to run your code on, and they take a lot more work than a solution to most code golf problems.
Don't let that discourage you. KotHs are a ton of fun when things go right, and as bots grow smarter, winning becomes more and more of an achievement. The first few bots are almost never competitive later on, so don't be scared to post something silly. I've seen great KotHs die away because nobody was brave enough to take the first step. Don't do that! You'll usually get some free upvotes for your trouble, too :D.
Unfortunately, KotHs aren't particularly common. One per month is typical, and only some of those are successful. Unlike normal code-golf challenges, which can be answered at any date in the future after being posted, KotHs aren't much fun after they start to lose steam. So, you might want to try...
Making a KotH
KotHs aren't easy to design, but they're extremely rewarding to get right. I'll probably post a second blog post in a few weeks going into the topic in more detail, but here are my main tips for KotH design:
Don't be afraid to fail:
Most KotH ideas don't work well in real life. As fun as something is for humans (or in your head), you can get a controller working, play around with it, and realize: this isn't fun. It's happened to me too many times to count.
KotHs are a difficult balancing act between simplicity and depth. Too complex, and nobody will take the time to write a bot. Too shallow and the optimal strategy will be found almost instantly. It's discouraging to put a lot of time into an idea and have it not work out, but you're not a bad KotH writer. (In fact, you're probably a really good one! Keep trying!)
There's a lot of things to remember when writing a KotH. You need to write a good spec, specify how all the different parts of the game will work, write a controller, make some example bots, and probably more. It's always a good idea to double check you have it all done correctly. In addition, designing a KotH is like making a game. It's a lot easier when you can bounce your ideas against someone else, to make sure they'd be fun.
If you have an idea, feel free to bring it up in chat. If you feel your concept's pretty well fleshed out and you're pretty sure it's not a duplicate, I'd recommend putting it in the sandbox for a few weeks. Most KotHs have long specs, and it's much harder than you think to make sure all of the details are clear to someone reading the rules with no background knowledge.
King of the Hill challenges are unlike anything else on CGCC. They might take a little more work to write a submission for, but don't be discouraged! You'll probably have a lot of fun. Similarly, writing a KotH is tough. However, when you finally think of the perfect idea and flesh it out into a great challenge, you'll have the opportunity to form a community around your game, and watch strategies evolve as competitors work to outsmart the other bots.