Free Hero Mesh class definition file

A Free Hero Mesh puzzle set consists of four files; this article is about the .class file, which contains the program codes implementing the rules of the game.

This file is a plain text file, with a somewhat Lisp-like format, describing the classes of objects, their attributes, and the code to implement their behaviours; however, the code implementing behaviours is stack-based, like Forth or PostScript. It also includes a macro preprocessor.

The character encoding is normally the PC character encoding (CP437); however, it is possible to declare the use of other IBM PC code pages other than 437 as well (see MS-DOS encodings). The  block specifies the number of the code page to use; if it is omitted, then 437 is assumed by default.

Example

 * Example sokoban code in Free Hero Mesh (public domain)

($Player (Image "PLAYER")  Player  Input  (Strength 1)  ('RIGHT E Move)  ('UP N Move)  ('LEFT W Move)  ('DOWN S Move)  (BEGIN_TURN $Box #TEST 0 0 BroadcastSum lnot if WinLevel then) )

($Floor (Image "FLOOR")  (Density 1) )

($Box (Image "BOX")  Shovable  (Weight 1)  (Height 1)  (#TEST $Target Loc ObjClassAt lnot) )

($Target (Image "TARGET")  (Density -1) )