hanjie

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2021 License: MIT Imports: 4 Imported by: 0

README

hanjie

Test PkgGoDev Go Report Card Coverage Status

"Paint-By-Number" is one of many names for a type of graphical logic puzzle originating in Japan. Other common names for these puzzles are Nonograms, Griddlers, Hanjie, and Picross.

In surveying these, Jan Wolter noticed a lack of a good, standardized file format for paint-by-number puzzles. Every program seems to invent it's own file format. So he decided to come up with an XML file format that would be rich enough to handle most puzzle-storing applications.

We all understand perfectly well that XML is not very fun, so I decided to come up with a YAML-based file format that stylish, trendy and youthful. Bazinga!

License

MIT License

Copyright (c) 2021 Alexey Popov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Documentation

Overview

Package hanjie contains any entities and instruments to read, write and validate puzzles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Read

func Read(r io.Reader, options ...Option) (*ast.PuzzleSet, error)

Read set of puzzles from io.Reader.

func SkipValidation

func SkipValidation(o *Options)

SkipValidation skips validation.

func Write

func Write(w io.Writer, puzzleSet *ast.PuzzleSet, options ...Option) error

Write set of puzzles to io.Writer.

Types

type Option

type Option func(*Options)

Option setter.

func WithValidator

func WithValidator(v Validator) Option

WithValidator to set a custom validator.

type Options

type Options struct {
	Validator      Validator
	SkipValidation bool
}

Options defines puzzle read- and write options.

type Validator

type Validator interface {
	Validate(ast.PuzzleSet) error
}

Validator interface.

Directories

Path Synopsis
Package ast declares puzzle types.
Package ast declares puzzle types.
Package errors contains errors.
Package errors contains errors.
Package tools contains hanjie tools.
Package tools contains hanjie tools.
Package validator contains default puzzle validator.
Package validator contains default puzzle validator.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL