Monarch Of The Hill - base infrastructure for computer-based puzzle contests
Go to file
Neale Pickett 5075bb601d Everything but puzzle content serving 2018-09-19 03:29:05 +00:00
bin Look for "until" file to disable contest by time 2018-01-28 10:24:49 -07:00
docs Move assigned.txt into state 2017-10-12 00:55:34 +00:00
example-puzzles Add a counting example puzzle 2018-04-12 14:58:12 +00:00
res Everything but puzzle content serving 2018-09-19 03:29:05 +00:00
src Everything but puzzle content serving 2018-09-19 03:29:05 +00:00
tools Rewrite devel server to be more reliable, accept seed in URL 2018-05-11 21:45:40 +00:00
www Merge branch 'mothv3' of https://github.com/dirtbags/moth into mothv3 2018-05-11 14:27:38 +00:00
.dockerignore More dockering 2017-09-11 16:12:22 +00:00
.gitignore Reworked some basics of how the Puzzle class works. Shouldn't look to different from the outside. 2016-10-17 13:24:54 -06:00
Dockerfile.moth Add a fifth logo 2018-05-10 16:54:36 +00:00
Dockerfile.moth-compile Rewrite devel server to be more reliable, accept seed in URL 2018-05-11 21:45:40 +00:00
Dockerfile.moth-devel Rewrite devel server to be more reliable, accept seed in URL 2018-05-11 21:45:40 +00:00
Dockerfile.package-puzzles Move to base alpine image so I can get PIL 2017-09-14 15:06:07 +00:00
LICENSE.md Change license to comply with LANL legal request 2017-09-08 20:58:33 +00:00
README.md Moving toward a working server 2018-09-17 23:00:08 +00:00
devel.sh update usage message 2017-09-15 10:27:53 -06:00
install.sh Make CGIs executable on installation 2017-06-17 06:27:01 +00:00
setup.cfg devel-server use new Puzzles obj. Needs cleanup. 2016-10-18 05:02:05 +00:00

README.md

Dirtbags Monarch Of The Hill Server

This is a set of thingies to run our Monarch-Of-The-Hill contest, which in the past has been called "Tracer FIRE", "Project 2", "HACK", "Queen Of The Hill", "Cyber Spark", "Cyber Fire", "Cyber Fire Puzzles", and "Cyber Fire Foundry".

Information about these events is at http://dirtbags.net/contest/

This software serves up puzzles in a manner similar to Jeopardy. It also tracks scores, and comes with a JavaScript-based scoreboard to display team rankings.

How everything works

This section wound up being pretty long. Please check out the overview for details.

Getting Started Developing

If you don't have a puzzles directory, you can copy the example puzzles as a starting point:

$ cp -r example-puzzles puzzles

Then launch the development server:

$ python3 tools/devel-server.py

Point a web browser at http://localhost:8080/ and start hacking on things in your puzzles directory.

More on how the devel sever works in the devel server documentation

Running A Production Server

Run dirtbags/moth (Docker) or mothd (native).

mothd assumes you're running a contest out of /moth. For Docker, you'll need to bind-mount your actual directories (state, mothballs, and optionally resources) into /moth/.

You can override any path with an option, run mothd -help for usage.

State Directory

Pausing scoring

Create the file state/disabled to pause scoring, and remove it to resume. You can use the Unix touch command to create the file:

touch state/disabled

When scoring is paused, participants can still submit answers, and the system will tell them whether the answer is correct. As soon as you unpause, all correctly-submitted answers will be scored.

Resetting an instance

Remove the file state/initialized, and the server will zap everything.

Setting up custom team IDs

The file state/teamids.txt has all the team IDs, one per line. This defaults to all 4-digit natural numbers. You can edit it to be whatever strings you like.

We sometimes to set teamids.txt to a bunch of random 8-digit hex values:

for i in $(seq 50); do od -x /dev/urandom | awk '{print $2 $3; exit;}'; done

Remember that team IDs are essentially passwords.

Mothball Directory

Installing puzzle categories

The development server will provide you with a .mb (mothball) file, when you click the [mb] link next to a category.

Just drop that file into the mothballs directory, and the server will pick it up.

If you remove a mothball, the category will vanish, but points scored in that category won't!

Resources Directory

Making it look better

mothd provides some built-in HTML for rendering a complete contest, but it's rather bland. You can override everything by dropping a new file into the resources directory:

  • basic.css is used by the default HTML to pretty things up
  • index.html is the landing page, which asks to register a team
  • puzzle.html and puzzle.js render a puzzle from JSON
  • puzzle-list.html and puzzle-list.js render the list of active puzzles from JSON
  • scoreboard.html and scoreboard.js render the current scoreboard from JSON
  • Any other file in the resources directory will be served up, too.

If you don't want to read through the source code, I don't blame you. Run a mothd server and pull the various static resources into your resources directory, and then you can start hacking away at them.

Changing scoring

Believe it or not, scoring is determined client-side in the scoreboard, from the points log. You can hack in whatever algorithm you like.

If you do hack in a new algorithm, please be a dear and email it to us. We'd love to see it!