Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Sokoban state space explorer.
- // Discussion: https://dxdy.ru/topic144781.html
- import java.util.*;
- public class CellsAdjacency {
- private int totalCellsNumber, activeCellsNumber;
- /*
- Array "values" consists of consecutive records for every possible transition
- from cell to cell. Records for moves from same cell are placed one after another,
- comprising blocks. Array "indices" holds starting indices of said same starting
- cell blocks and contain one more index to denote arrays "values" size for convenience.
- Values record:
- - direction index (from CellVector class)
- - adjacent cell index
- - next adjacent cell index
- - rear adjacent cell index
- Impassable and inactive next adjacent cells are assigned -1 index. Rear adjacent cells
- are assigned -1 index if it is impassable or starting cell is inactive.
- //*/
- private short [] values;
- private int [] indices;
- public CellsAdjacency (int totalCellsNumber, int activeCellsNumber, short [] values, int [] indices) {
- this .totalCellsNumber = totalCellsNumber;
- this .activeCellsNumber = activeCellsNumber;
- this .values = values;
- this .indices = indices;
- }
- public int getTotalCellsNumber () {
- return totalCellsNumber;
- }
- public int getActiveCellsNumber () {
- return activeCellsNumber;
- }
- public short [] getValues () {
- return Arrays .copyOf (values, values .length);
- }
- public int [] getIndices () {
- return Arrays .copyOf (indices, indices .length);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement