Kenichi Ishigaki > Games-Nonogram-0.01 > Games::Nonogram::Loader::File

Download:
Games-Nonogram-0.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Games::Nonogram::Loader::File

SYNOPSIS ^

  use Games::Nonogram::Loader::File;
  my ($h, $w, @lines) = Games::Nonogram::Loader::File->load( $file );

DESCRIPTION ^

This is used internally to load puzzle data from a file.

loader ignores lines which start with #
loader reads row clues first: a set of row clues per a line, and the row clues should be comma-separated.
loader regards the first blank line as the end of the row clues.
loader reads column clues, then, in the same manner.
loader regards end-of-file or the second blank line as the end of the column clues.

In short, a file like below

  # row clues
  1
  3
  1,1,1
  3
  1
  
  # column clues
  1
  1,1
  5
  1,1
  1

would produce a puzzle like below.

  __X__
  _XXX_
  X_X_X
  _XXX_
  __X__

METHOD ^

load

takes a filename as an argument and reads its data.

AUTHOR ^

Kenichi Ishigaki, <ishigaki at cpan.org>

COPYRIGHT AND LICENSE ^

Copyright 2007 by Kenichi Ishigaki

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: