Class: RSokoban::LevelSet

Inherits:
Object
  • Object
show all
Defined in:
lib/rsokoban/level_set.rb

Overview

I am a set of sokoban levels. Level set are found in .xsb files.

xsb file format

Info lines begins with semi-colon (;) Map lines begins with a # (that’s a wall !) preceded by 0, 1 or more spaces.

  1. First info is title of the set

  2. Blank line

  3. List of info lines : description

  4. Blank line

  5. Level map

  6. info title of this level

  7. List of info lines : blabla about this level

From 4 to 7 again for each supplementary level

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLevelSet

Returns a new instance of LevelSet.



29
30
31
32
33
# File 'lib/rsokoban/level_set.rb', line 29

def initialize
	@title = 'Unknown set title'
	@description = 'Empty description'
	@raw_levels = []
end

Instance Attribute Details

#descriptionObject

Parameters:

  • description (String)

    get/set the description of this level set.



25
26
27
# File 'lib/rsokoban/level_set.rb', line 25

def description
  @description
end

#raw_levelsObject

Parameters:

  • raw_levels (Array<RawLevel>)

    get/set the raw levels of this set



27
28
29
# File 'lib/rsokoban/level_set.rb', line 27

def raw_levels
  @raw_levels
end

#titleObject

Parameters:

  • title (String)

    get/set the title of this level set.



23
24
25
# File 'lib/rsokoban/level_set.rb', line 23

def title
  @title
end

Instance Method Details

#sizeObject



35
36
37
# File 'lib/rsokoban/level_set.rb', line 35

def size
	@raw_levels.size
end