# Game Play

To play the game one has to move person (man) on screen. Man can either go from one cell to the other if there is nothing on second cell or can push a box if the cell on which man wants to go is occupied by box and there is empty cell behind the box.

## Playing with keyboard

All this man movements could be done using keyboard or mouse. When moving man with keyboard one shall use arrow keys (left, right, up, down) to move man.

### Undo/Redo

YSokoban supports undo/redo actions. With keyboard undo is done with backspace. For redo use space.

When changing level (or reloading current one with Esc) all your moves will go to the redo buffer. If you reload level (with Esc) then you can play again your moves with redo. If you accidentally change the level, go back to previous level and use redo to play your moves.

## Playing with mouse

Usually when player has finished 2 or 3 of his first levels ever he realizes that how to push some box from one cell to the other is not an interesting task. Important thing (which one has to be concentrated on) is in which order boxes has to be pushed and to which cells.

So here come the mouse usage. There are different possible usage of mouse: click on man and click on the cell where you want to move the man or even simply click on some cell and man will go there (if possible without pushing boxes). The other possibility (much often used) is to click on some box and then click on cell where it shall be pushed (or drag and drop box there). If there is push path, then man will push box there. To be able to find how to push the box YSokoban has a push path finding capabilities (like most of the modern Sokoban implementations).

Mouse undo/redo is assigned to mouse wheel (by default). But you can configure it.

### Push Path finding

YSokoban has a path finder to help player with tedious and non productive part of the game:

- Finds path how to push box from one cell to some other cell: click box to push, then click where box shall be pushed to (target cell) or drag and drop box from a cell to the target cell. If there is a path to push box without touching other boxes (see go-thru for exception) then box will be pushed and this action will be animated (unless IM - instant move, is selected)
- Show where the player can go: click on the player
- Show reachable boxes: Click on any wall and it will show all unreachable box with a symbol. The symbol is part of the skin and is usually cross out with red cross or some other sign.
- Show where a box can be pushed to: click a box (but you should have hints configured properly)
- Show go-thrus - this is some more complicated feature (see description).
- Show which box can be pushed to here: click on any floor or goal position (by default with right mouse click, but you can set it in options dialog to do it with left mouse button). All boxes which could be pushed to that position will be marked and the nearest will be selected. Right mouse clicking (if using default configuration) again on same target will do the push. Right mouse clicking on some of other possible boxes will do the push with that box. Left clicking on some of the possible boxes will mark the box as non auto selectable for push (useful in some cases).

See example for path finding and instant move below.

## Instant move

YSokoban supports not showing the intermediate moves/pushes during play or replay. In other words, all of the intermediate animations will not be shown when this feature is enabled. For example, if you click on a box and then click on the destination, you will see the box moved to the destination instantly. Click on the "IM" button to enable this feature.

During IM, there's an option to show direction change. To enable this, select "Show dir change during IM" in the options panel.

Example for path-finding and instant move:

## Go-Through boxes

In some special cases restriction "not to touch other boxes" during path finding is too strong. There are many cases where to go from one part of the level to the other part one needs to push some box and then return it back where it was. This is called Go-Thrugh Box. So it will be nice to have this automatically done. Go-Through feature will show places where the player can reach after pushing a box and pushing it back in the same place. To activate it, in the options panel, check the box "Go through boxes (if possible)". To use it: click on the Player: if go-thru is possible

- it will show the reachable boxes/cells with a circle
- it will show the go-through box (that is the box which will be "moved and moved back") with a square
- circle/square is white if position is directly reachable (without going through boxes)
- circle/square is black if position is only indirectly reachable (needs to go through box)

### Examples:

Moving the player with go-thru:

Moving a box with go-thru:

## Save/Load during play

One can save and load current position at any time.

- Ctrl-S: to save your current unfinished level (and moves)
- Ctrl-D or Ctrl-O: to load a previously saved unfinished level.

You have to specify filename to save/load level and solutions.

## Copy/Paste

YSokoban support clipboard usage. One can copy/paste solution or level from/to clipboard. Importing (pasting) solution shall use LURD format. When importing into YSokoban, the LURD formatted solution can be in lower or upper cases. When exporting from YSokoban, the LURD formatted solution will always be in the proper cases.

### Copy current level and solution to clipboard

- Ctrl-L will copy current level and solutions to the clipboard. If you're in the middle of play, this will copy the current moves, current level layout, and original level to the clipboard.
- Ctrl-ALT-L - same as Ctrl-L but spaces are replaced with - or _ (minus or underscore)
- Ctrl-Shift-L - same as Ctrl-L but RLE packed format
- Ctrl-ALT-Shift-L - same as Ctrl-L but MF8 format. MF8 format is a special format used by MF8 group to share information. When exporting to clipboard it will put [soko=...] and [/soko] in clipboard. When pasting there should be [soko= or [/soko] somewhere to accept it as MF8 format (so do not remove [soko=... marks from clipboard)
- Ctrl-M - same as Ctrl-L but has XSB + MF8 format
- Ctrl-Ins (or Ctrl-C) - copy moves made for this level to clipboard (LURD format)

Note: If you have already solved some level then to copy the solution (without solving again) press Ctrl-C before you made any move (or if you do, first press ESC). When there is no move made YSokoban will copy selected solution in clipboard.

### Paste level/solution

When pasting from clipboard YSokoban analyzes contents and in case it is level (or collection) will use it. If it is moves in LURD format then will try to play them in current level from current position (as if you actually play them).

- Shift-Ins (or Ctrl-V) - paste moves (or level/collection) from clipboard (expects LURD format for solution or level in normal text format), both (solution and level) could be RLE encoded.
- Ctrl-Shift-V (Ctrl-Shift-Ins) - same as above (paste moves) but stops on every box change then you can continue with space.
  In fact it just fills up redo buffer. For example: Press Ctrl-C (or Ctrl-Ins) after you finish the level (but before moving to the next one). All moves will be copied to the clipboard in LURD format. Now you can paste them into e-mail (or some other text file).
  If you receive such a solution: mark and copy it to the clipboard. Go to the desired level and press Shift-Ins (Ctrl-V) and solution will be played (if it is correct).
  If you want to see solution with pause between box changes, then press Ctrl-Shift-V (Ctrl-Shift-Ins).
  Playing can be paused by pressing space and then run again by pressing Ctrl-space.
- Ctrl-ALT-C (Ctrl-ALT-Ins): copy to clipboard the rest of the solution if you are currently performing a step by step review of solution. This feature was requested by Ming with following explanation: when replaying solutions (tracing the moves one by one), at any given time, Ctrl-C will copy the current solution (from beginning up to the current move) to the clipboard. It would be useful to have a function copy the rest of the move (those moves after the current position) to the clipboard. This function comes in handy when one wants to improve their existing solution(s). Often, one need to trace both solutions when and then get to a common map; then perform the rest of the moves (if this feature is available, one can just copy and paste it)

## Changing level orientation

You can play any level in any of the 8 possible orientations (rotate/mirror) at any give time. You can also "lock-in" the orientation for all levels. You can select an orientation from the "Select transformation" dialog, or you can use the hot-keys (described there)

Created with Ywiki