PuzzleParserT Class

Reads puzzles from a file. Each puzzle is encoded in the following way:
  • I (identifier) B/W (black/white) puzzleNumber
  • R (reward) scoretetromino (O1/O2/I2/I3/I4/L2/L3/Z/T)
  • five rows starting with P encoding the puzzle; # = filled cell, . = empty cell
The puzzle color and puzzle number together uniquely identify the file in which the puzzle image is stored.

Definition

Namespace: ProjectLCore.GameLogic
Assembly: ProjectLCore (in ProjectLCore.dll) Version: 1.0.0+d0f5e2a7a5f4bb0431970f279d2f79d24b15d256
C#
public class PuzzleParser<T> : IDisposable
where T : Puzzle
Inheritance
Object    PuzzleParserT
Implements
IDisposable

Type Parameters

T
The puzzle type to parse. Must be a subclass of Puzzle and have a constructor with the signature Puzzle(BinaryImage, Int32, TetrominoShape, Boolean, UInt32)

Remarks

The order of the lines doesn't matter and there can be an arbitrary number of lines not starting with a special character scattered throughout the puzzle definition. This however isn't recommended as it makes the file harder to read for humans.

Example

 
I B 13
R 5 O1
P ##..#
P ....#
P #....
P #....
P #..##
This example encodes a black puzzle with number 13, reward of 5 points and O1 tetromino.

Constructors

PuzzleParserT(Stream) Initializes a new instance of the PuzzleParserT class.
PuzzleParserT(String) Initializes a new instance of the PuzzleParserT class.

Methods

CreatePuzzle Creates a object from the parsed data.
Dispose Disposes the StreamReader object used to read the file.
GetNextPuzzle Parses the next puzzle from the file.

See Also