Tentatively: I’ll paste “(YourCode TheirCode)” into the interpreter with DrRacket, with #lang scheme.
The most elegant, it seems to me, would be to require entires to be sumitted as a .rkt file that defines a module providing a single variable (possibly with a required name, eg “bot”) that must be a quoted expression.
This makes it simple to call programs (eval the expressions), pass opponent’s source code, or even provide programs with their own source code; and could be used to automate static checking of various constraints, such as the ban on file I/O.
It also allows more flexibility for submitters in constructing their entry, for instance I was able to considerably streamline the source code to the CliqueBot template:
(this is the “workhorse” part, providing the program as a quoted expression obviates the need for repeating it twice, as we can then leverage the quasiquote and unquote language features)
The most elegant, it seems to me, would be to require entires to be sumitted as a .rkt file that defines a module providing a single variable (possibly with a required name, eg “bot”) that must be a quoted expression.
This makes it simple to call programs (eval the expressions), pass opponent’s source code, or even provide programs with their own source code; and could be used to automate static checking of various constraints, such as the ban on file I/O.
It also allows more flexibility for submitters in constructing their entry, for instance I was able to considerably streamline the source code to the CliqueBot template:
(this is the “workhorse” part, providing the program as a quoted expression obviates the need for repeating it twice, as we can then leverage the quasiquote and unquote language features)
(this is the “template”, it will be expanded to include the program-matching portion)
(this is the actual program, it both quotes (via inclusion of the template) and uses the program-matching part).
The top of the file would consist of the following declaration:
...or if you’re requiring that all entries use the same name “bot” (which could make it easier to administrate the actual running of the contest):