Code Monkey home page Code Monkey logo

5puzzle's Introduction

Exploring Ersatz

This package explores encoding and solving various puzzles using Ersatz. Ersatz is a library for generating SAT problems with a high-level level encoding.

In particular this library explores the use of a new symbolic set selection encoding named Select and the use of a total map type named SparseMap.

Select makes it easy to work symbolically with a choice from a set of possibilities without creating a new encoding of the enumerated type in Ersatz. This is particularly useful for run-time defined possibilities.

SparseMap supports the generalized Boolean typeclass and makes it easy to work with bit-maps (or more complex types than bit) over arbitrary keys.

Install minisat

These solutions use the minisat program to actually compute solutions to the generated SAT problems. You'll need to install this tool. Below are some examples of how to do this.

Homebrew (macOS)

$ brew install minisat

Debian Linux

$ apt install minisat

Building this repository

The recommended way to build this repository is using cabal-install and GHC 8.4.2. Make sure you're using a recent version of cabal-install.

Haskell Platform

$ git clone https://github.com/glguy/5puzzle
$ cd 5puzzle
$ cabal new-build
$ cabal new-run ToolName

The repository can also be built using stack

$ git clone https://github.com/glguy/5puzzle
$ cd 5puzzle
$ stack setup
$ stack build
$ stack exec ToolName

Problems encoded

  • Coin - Finds a way to use a balance scale to find one coin that doesn't match the others in a set.

  • Handshakes - Solves a puzzle where a couple goes to a party and everyone shakes hands when they arrive.

  • Cube - Solves a puzzle where 17 rectangular solids are placed within a 5x5 cube.

  • Pentomino - Solves placing arbitrary puzzle pieces on an arbitrary 2D board allowing for rotating and flipping pieces. The example problem places pentominos on a square board.

  • Domino - Solve the covering of an NxM grid with dominos where two opposing corners are removed

  • Einstein - Solves a classic logic puzzle.

  • RegExp - Solves regular expression crossword puzzles. This implementation features both an efficient implementation of regular expressions without backreferences, and an inefficient one with backreferences.

  • Nonogram - Solves nonogram puzzles by encoding the clues as regular expressions and treating them like regular expression crossword puzzles.

  • Sudoku - Solves arbitrary Sudoku puzzles.

  • Tough - Solves the One Tough Puzzle 3x3 jigsaw puzzle.

  • SetGame - Computes a way to arrange all 81 Set cards into 27 sets.

  • Queens - Solves the generalized Eight queens puzzle

  • Zhed - Solves an minimizes solutions to Zhed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.