Git Product home page Git Product logo

chaos-game's Introduction

Chaos-Game

A simple Java gui app that creates fractals applying specifics rules to random generated points.

For more information abaout chaos game and fractal visit the Algorithm Archive, the Wikipedia page or the Wolfram one.

Table of contents

About The Project

Chaos game is a method to create fractals using an initial point selected at random inside a polygon and then applying a rule to find the next point. After some iterations we will often (depending on the rule) start seeing the shape.

This project aim is to create a gui that allows to simple generate fractal using the above method.

The main window allows to select from three polygons (Triangle, Squere, Pentagon) or to create yours (Custom) by choosing the number of sides (wich obviously must be greater then three) and to insert the number of iterations.

You can also select two different rules to generate the points: both of them starts from a random point inside the shape, select a vertex of the polygon and then choose the mid point of the distance between the previous point and the vertex as the new point form wich reiterate this algoritm.
In the first rule (the default one for the triangle) the vertex is choosen randomly, while in the second one (the default for other shapes) is added one condition: it must be different from the previous one.



Main window with default settings for Triangle

Main window: Default settings

Trinagle fractal (also known as Sierpiński triangle)

Shape window: Trinagle

Square fractal

Shape window: Square

Pentagon fractal

Shape window: Pentagon


Main window with custom settings for Esagon

Main window: Custom settings

Esagon fractal

Shape window: Esagon



Getting Started

Prerequisites

This project requires:

  • Java 11 or newer

Quick start

To run this project from the commnad line (on Unix systems) follw this steps:

  1. Clone the reposiory:
    git clone [email protected]:akanok/Chaos-Game.git or git clone https://github.com/akanok/Chaos-Game.git
  2. Move into the project folder: cd Chaos-Game/
  3. Create bin folder for .class files: mkdir bin
  4. Compile java files: javac -sourcepath src/ -d bin/ src/chaos/game/*.java
  5. Move into the bin folder: cd bin/
  6. Run the app: java chaos.game.Main

If you prefere you can also create a .jar and execute it:

  1. Steps 1 to 5 are identically as before
  2. Create .jar archive: jar cvfe MyApp.jar chaos/game/Main chaos/game/*
  3. Run the app: java -jar MyApp.jar

Built With

License

This project is licensed under MIT.
Please see the LICENSE file for details.

chaos-game's People

Contributors

akanok 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.