Sok format

From Sokoban Wiki

Revision as of 18:12, 28 July 2010 by Matthias Meger (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Sokoban (c) by Falcon Co., Ltd., Japan  ::
File Format 0.14  ::
 ::
File Header  ::
Raw File Notes Optional  ::
File Notes Optional  ::
Game Type Optional  ::
Macros Optional  ::
Level 1 Required  ::
Title Optional*  ::
Board See legend ::
Level Notes Optional  ::
Game 1 Optional  ::
Title Optional*  ::
Moves See legend ::
Game Notes Optional  ::
Game 2 Optional  ::
... (more games)  ::
Level 2 Optional  ::
... (more levels)  ::
 ::
Remarks:  ::
 ::
File Header  ::
The different types of information may be written in ::
any order.  ::
 ::
Raw File Notes  ::
Raw file notes are only intended for someone looking ::
at the raw file in a text editor. These lines begin  ::
with "::".  ::
 ::
File Notes  ::
File notes are the remaining lines when all other  ::
information is removed from the file header, e.g.,  ::
raw file notes and macros.  ::
 ::
As an example, file notes can contain general  ::
properties written as key/value pairs, such as  ::
"Author: Name".  ::
 ::
The optional but recommended property  ::
"Collection: Name" assigns a name to the puzzle  ::
collection. When a collection is copied from a  ::
website or e-mail and pasted into a Sokoban program, ::
this information allows the collection to be saved  ::
with the proper name.  ::
 ::
Game Type  ::
The type applies to all levels in the file. If it is ::
not specified, the default value is "Sokoban".  ::
 ::
The type is written as "Game: X" or "Game=X".  ::
An example: "Game: Hexoban".  ::
 ::
Macros  ::
Macros are key/value pairs separated by "=".  ::
An example: "Copyright=These levels are (c) by NN".  ::
 ::
The value of a key/value pair can be inserted in  ::
level notes and game notes by writing the key  ::
enclosed by "<#" ... "#/>". This applies to both  ::
types of key/value pairs, ":" and "=", but in  ::
contrast to ":" pairs, macros are not considered  ::
a part of the file notes.  ::
 ::
An example of macro usage: "<#Copyright#/>".  ::
The use of key/value pairs is case-insensitive.  ::
 ::
Macro-definitions are single-lined. To insert a  ::
line-break in the expanded text, write "\n".  ::
 ::
Titles  ::
A title line is the last non-blank text line before  ::
a level or a game, provided the line is preceded  ::
by a blank line or it is the only text line at this  ::
position in the file.  ::
 ::
Title lines are optional unless a single or a last  ::
text line from a preceding level, game, or file  ::
header can be mistaken for a title line.  ::
 ::
Level Notes  ::
Two special key/value pairs are supported in level  ::
notes: "Title" and "Author", hence, titles can  ::
either come from a title line or from a key/value  ::
pair.  ::
 ::
Board ::::::::::::::::::::::::::
Legend.................:  :.................Legend ::
Wall...................: # # :...................Wall ::
Pusher.................: @ p :.................Pusher ::
Pusher on goal square..: + P :..Pusher on goal square ::
Box....................: $ b :....................Box ::
Box on goal square.....: * B :.....Box on goal square ::
Goal square............: . o :............Goal square ::
Floor..................:  :..................Floor ::
Floor..................: - _ :..................Floor ::
 ::
Remarks:  ::
 ::
The first and the last non-empty square in each row  ::
must be a wall or a box on a goal. A board cannot  ::
have empty rows.  ::
 ::
Boards may be run-length encoded (RLE), e.g.,  ::
"###----@.#" may be encoded as "3#4-@.#", and  ::
"#-#-#-##-#-#-#" may be encoded as "2(3(#-)#)".  ::
A row cannot be split over multiple physical lines.  ::
 ::
Rows may be combined on a single physical line by  ::
using "|" as a row separator, e.g.,  ::
"--3#|3#-#|#@$.#|5#". A "|" at the end of a physical ::
line is optional and may be omitted.  ::
 ::
Moves ::::::::::::::::::::::::::
Legend.................:  :.................Legend ::
Move pusher up.........: u U :.......Push/pull box up ::
Move pusher down.......: d D :.....Push/pull box down ::
Move pusher left.......: l L :.....Push/pull box left ::
Move pusher right......: r R :....Push/pull box right ::
Jump start.............: [ ] :...............Jump end ::
Current position.......: * * :.......Current position ::
 ::
Remarks:  ::
 ::
Moves may be run-length encoded, e.g., "3r3U" means  ::
"rrrUU", and "2(3(dr)R)" means "drdrdrRdrdrdrR".  ::
Each line must, however, have at least one proper  ::
non-digit character. Spaces between moves are  ::
allowed.  ::
 ::
Jumps and pulls: Only in reverse mode games.  ::
 ::
Reverse mode games must start with a jump, even if  ::
it is empty. An example: "[]UU[ddlll]DDllR".  ::
 ::
Current position is optional and defaults to the  ::
position after the last move.  ::
 ::

Date Created: Date of Last Change: 2010-01-26 17:44:01

Macros

The macro feature allows levels to share a common text such as a copyright notice. An example:

Copyright=Copyright (c) 3642 by xyz@paris.mars


Demo Level 01

  1. #
  2. @ $ #
  3. $ #
  4. . . #

This demo level is trivial, but it suffices to demonstrate the file-format. A Sokoban program can add key/value pairs within the notes, such as: Author: nn Website: http://www.nn.net

Solution/Moves (rurrdD)(uLulDD)

The title of a snapshot does not bear any special meaning. This snapshot just happens to be the best solution found (so far). The demo-program automatically saves best solutions.

Snapshot 7/0 urrrrdd

This is an example of a snapshot saved by the user. Later he/she can continue work on this path.

Snapshot 9/2 urrrrddLL*ruulDD

Another snapshot saved by the user. The '*' indicates current position, i.e., the last moves were taken back, but are still available for the "redo" function.


Demo Level 02

  1. .#
  2. @ $ #
  3. $ #
  4. . * #

Just another trivial demo level. The number of levels in a file is limited by available memory only.

A macro example, inserting the text defined in the copyright-macro: <#Copyright#/>

Solution/Moves (rRRR)(drU)(dlLLulD)

Reverse Mode Snapshot 13/6 [rrrd]UU(rLLL)(drD)

This is an example of a reverse mode snapshot.

Reverse mode snapshots always have a leading jump-sequence, even if it is empty. An example: "[]Ulld...".


Demo Level 03

  1. #
  2. $ #
  3. $ #
  4. + . #

Solution/Moves (rrruul)(Lr)(Duull)(DD)

Personal tools