GithubHelp home page GithubHelp logo

lambdamikel / common-lisp-tangram-solver Goto Github PK

View Code? Open in Web Editor NEW
30.0 9.0 6.0 41.19 MB

A Tangram Puzzle Solver in Common Lisp that is capable of solving arbitrary geometric tiling problems. CLIM (Common Lisp Interface Manager) is used for its GUI.

Home Page: https://www.michael-wessel.info

License: GNU General Public License v3.0

Common Lisp 99.94% Batchfile 0.05% Shell 0.01%
lisp commonlisp lispworks geometric-algorithms tilings tiling-problem tangram tangram-play clim spatial-reasoning

common-lisp-tangram-solver's Introduction

Common-Lisp-Tangram-Solver

A Tangram Puzzle Solver in Common Lisp that is capable of solving arbitrary geometric tiling problems, utilizing CLIM (Common Lisp Interface Manager) for its GUI.

tiles

About

This was written in Common Lisp in 2003, using CLIM (Common Lisp Interface Manager) for its GUI. It compiles with LispWorks 6.1 and 7.1 with CLIM, on Windows, Linux, and Mac. I can only support Windows and Linux, but it is known to run on a M1 Silicon Mac as well (see below).

Here is a 2003 poster about the project, in German, and here my European Lisp Symposium '21 paper, as well as the slides of the talk.

poster

Pleae check out the YouTube video to see it in action!, or try one of the supplied executables to run on your own machine!

On my 2012 iCore 7 2.4 GZ 8 GB Ubuntu Xenial PC, thanks to its geometric search heuristics, it takes ~ 10 seconds to solve the following problem:

editor1 editor2 thinking solutions

The solver uses geometric search:

search

This is work in progress. The heuristics are being changed from time to time. Currently, with the above machine configuration, it takes about ~3 minutes and 50 seconds for it to solve the standard Tangram problem if "Show Thinking" is unchecked, and ~6 minutes and 30 seconds with "Show Thinking" enabled:

Standard Solution 1 Standard Solution 2

Other problems are much faster. The solver frequently finds innovative solutions. Problems in .tan format are src/problems folder.

Ignat Ignat 2

History

The program was written in 2003. I resurrected the code in March 2021 and fixed some major bugs that were responsible for severe incompleteness. It is performing much better by now!

The geometric substrate support functions were written by the author during his computer science master and PhD endeavors, from 1996 to 2003.

Installation (Windows, Linux, Mac)

You will need LisWorks (6.1, 7.1) with CLIM if you want to run it from source, or even build the application. Else, exectuables are provided for Linux32 and Windows (see below).

On Linux, I needed to install a number of (in my case, 32bit) legacy libraries, like (32bit) Motif etc. in order to get is going. It is much more straightforward with Windows (tested on 64bit Windows 10).

The well-known Lisp hacker Lispm (Rainer Joswig) reported that it runs fine on an Apple Silicon Mac with M1 processor under 64bit ARM Linux..

Executables

Here are the provided executables for Linux32 and Windows.

Loading / Usage

If you want to build it from source, check out the src/tangram-sysdcl.lisp. Adjust the logical "tangram" pathname to match your environment. Then, as shown at the end of the file, do a

(compile-system "tangram")
(load-system "tangram")
(tangram::tangram)

There are also deliver.lisp scripts provided for Linux32 and Windows.

For the Mac, you'll probably have to collect the "FLI Templates", and then change the tangram-sysdcl.lisp accordingly:

(define-system tangram
    (:default-pathname "tangram:")
    (:serial "tangram-packages"
   #+:linux
   "tangram-templates"
   tangram-aux tangram-persistence tangram-geometry
   tangram-main tangram-gui))

The process of "FLI template collection" is described in the LispWorks manual.

Lisp hacker Lispm (Rainer Joswig) has successfully delivered the application with his Apple Silicon Mac with M1 processor under 64bit ARM Linux..

Acknowledgements

Thanks to Rainer Joswig (Lispm) for checking it out with the new Silicon Macs and LispWorks 7.1 (I only have 6.1), for spreading the word, and for tipps regarding the application delivery process (FLI template collection).

Enjoy!

common-lisp-tangram-solver's People

Contributors

lambdamikel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

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.