I’ve been fascinated for a little while by the programming language called Inform 7. (Note as of writing, the main website is under maintenance, so here is the Inform Wikipedia article as backup.) It is a language designed specifically for crafting works of interactive fiction (aka “text adventures”). Version 7’s syntax in particular is based on natural language, and as a result, source code for games written in Inform are often quite intelligible to those not well versed in programming or the Inform language specifically.
Here is an example of defining mutually exclusive properties…
1 2 3 | |
Here’s an interesting predicate “instead” which provides an override kind of like aspect oriented programming…
1 2 | |
Here’s a simple rule that changes the lit/unlit based on light source…
1 2 | |
A before advice to guard saving the game when not in a safe place…
1 2 3 4 5 6 | |
Here’s an after advice to modify the display of a character based on their state of being in a web or not…
1 2 | |
Sometimes the emphasis on natural language becomes a little contorted though when writing procedural code…
1 2 3 4 5 6 7 8 | |
Anyways just found this kind of interesting/inspirational and wanted to share.