Git Product home page Git Product logo

tangramai's Introduction

Tangram AI

Tangram Main Img

Table of Contents

About the project

Context

This program is our final project for the IA41 class. We had as specifications to realize a tangram solver and to let the user realize his own puzzles.

A tangram is a set of 7 geometric pieces (2 large triangles, 1 middle triangle, 1 parallelogram, 1 square and 2 small triangles). The goal is to complete an image where only the shadow of the pieces appears.

Made with

This project has been made 100% in python.

Features

This program is able to solve mutliple tangrams puzzles in matters of seconds. It includes a built-in tangram editor allowing the user to create its own tangram puzzles and use the program to solve them.

You can save the results of the execution of the program. This saved data includes the position of the solved piece on the 800x700px canvas, the execution time of the program and the differents steps to complete the tangram :

Step by step tangram solving

Getting Started

Prerequisites

In order to use the program you will need to have a python 3.X interpretor installed. The required libraries are listed in the requirements.txt file.

Installation

  1. Clone the project and unzip it.
  2. Install the librairies listed in requirements.txt

Usage

Commands

A simple use of the program to save the results of the solver is to execute this line in the terminal :

py main.py --saveData True

The arguments available to use the program are :

  • imagePath : Allow the user to use the solver on an prebuilt image (if no path is provided the program will use the built-in editor)
  • saveData : Allow the user to save the data of the execution in a .json file and the steps as .png files. (By default False)

Use the editor

This program includes a built-in editor that lets you design your own tangram puzzles. You can select the piece you want to use using the numbers keys :

  • 1 Large triangle n°1
  • 2 Large triangle n°2
  • 3 Medium Triangle
  • 4 Parallelogram
  • 5 Square
  • 6 Small triangle n°1
  • 7 Small triangle n°2

When a piece is selected you can :

  • Press F to flip the active piece (useful when dealing with the parallelogram)
  • Press R to rotate the active piece
  • Press N to change the active piece's corner held by the mouse cursor

Examples

Time (in seconds) 0.7 44.9 0.2 2586.5
Solution steps drawing drawing drawing drawing

With our algorithm, most tangrams are solvable in only a few seconds. However, as shown here, some tangrams (usually those with few corners) are very difficult and the algorithm can spend a few tens of minutes.

License

Distributed under the MIT License.

Authors

tangramai's People

Contributors

hugom25 avatar timothewt avatar

Stargazers

 avatar  avatar

Watchers

 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.