Copyright (C), 1997, Paul McCarthy. FILE_SYTNAX.txt Syntax for the files used by the SokoSave program: File Types: Maze Files: *.sokomaze Save Files: *.sokosave Score File: SCORES ============================================================================= MAZE FILE SYNTAX ----------------------------------------------------------------------------- Mazes are text files containing a simple 2D map of ASCII characters. Example: 01.sokomaze ##### # # #$ # ### $## # $ $ # ### # ## # ###### # # ## ##### ..# # $ $ ..# ##### ### #@## ..# # ######### ####### WALL_CHAR '#' // 35 Wall. EMPTY_CHAR ' ' // 32 Plain empty square. GOAL_EMPTY_CHAR '.' // 46 Empty goal square. CRATE_CHAR '$' // 36 Crate on an empty square. GOAL_CRATE_CHAR '*' // 42 Crate on a goal square. PLAYER_CHAR '@' // 64 Player on an empty square. GOAL_PLAYER_CHAR '^' // 94 Player on a goal square. Max rows = 20 Max cols = 40 There must be exactly one player on the map. The map must be "closed" -- it must have walls enclosing the playing area. It should be solvable! But the program does not know how to verify that. ============================================================================= SAVE FILE SYNTAX ----------------------------------------------------------------------------- Save files are also printable ASCII text files. They contain a simple encoding of the player's movement history. The history is encoded as follows: Direction Move Push Up u U Left l L Right r R Down d D A simple run-length-encoding (RLE) scheme is used to compress this history. Two or more successive instances of the same character are replaced by an integer count (in printable ASCII decimal characters) followed by a single instance of the character. The maze itself is encoded in the save file. The maze is encoded using the following characters: #define GOAL_BIT 0x01 #define PLAYER_BIT 0x02 #define CRATE_BIT 0x04 #define WALL_BIT 0x08 #define PRINTABLE_BIT 0x40 EMPTY_CHAR '@' 0x40 64 // Empty plain square. GOAL_EMPTY_CHAR 'A' 0x41 65 // Empty goal square. PLAYER_CHAR 'B' 0x42 66 // Player on an empty square. GOAL_PLAYER_CHAR 'C' 0x43 67 // Player on a goal square. CRATE_CHAR 'D' 0x44 68 // Crate on an empty square. GOAL_CRATE_CHAR 'E' 0x45 69 // Crate on a goal square. WALL_CHAR 'H' 0x48 72 The dimensions of the maze are printed as ASCII decimal integers on a separate line, followed by each row of the maze, compressed using the run-length-encoding scheme described above. The full file layout is as follows. The "1" is a version number. 1 ... Example: 1 $(SokoSave)/Maze/01.sokomaze 1024 33 33 u3l3uLU2lD2l3dr12RurD 0 0 33 16 11 19 19H 5H3@11H 5HD@D11H 5H3@11H 3H3@D2@10H 3H@HD2H@10H H3@H@2H@5H2@2AH H@D13@ACH 5H@3H@H@2H2@AEH 5H5@9H 19H ============================================================================= SCORE FILE SYNTAX ----------------------------------------------------------------------------- The SCORES file is a text file containing one score per line. The fields are separated by tab characters. There must not be any tabs nor newlines in any of the fields. Each line must be less than 2048 characters long. Fld Name Description 1 Maze Base part of the maze filename, both the directory and the ".sokomaze" extension are excluded. 2 Moves Unsigned positive integer number of moves. 3 Pushes Unsigned positive integer number of pushes. 4 Date Unsigned positive integer UNIX time_t value. 5 Name User's name. 6 Notes User's notes. Example: 01 239 97 878385600 zarnuk Comments 01 252 97 725889600 Solvoban Notes 02 487 141 725889600 zarnuk 02 500 131 878472000 zarnuk 02 623 145 725889600 Solvoban 03 360 134 725889600 zarnuk 03 434 138 725889600 Solvoban 04 877 355 878212800 zarnuk 04 989 369 725889600 Solvoban 05 398 143 878212800 zarnuk 06 319 116 725889600 zarnuk [... etc ...]