https://github.com/adrienc21/recursive-fractal-graphics

A set of different recursive algorithms to draw patterns or fractals in python.

https://github.com/adrienc21/recursive-fractal-graphics

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.9%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

A set of different recursive algorithms to draw patterns or fractals in python.

Basic Info
  • Host: GitHub
  • Owner: AdrienC21
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 229 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created about 5 years ago · Last pushed about 5 years ago
Metadata Files
Readme License

README.md

Recursive / Fractals graphics & solvers

A set of different recursive algorithms to solve problems, draw patterns or fractals in python.

Overview

Here is a list of the different algorithms implemented in this project

  • Von Koch Snowflake
  • Menger Sponge
  • Square percolation (and probability/density analysis)
  • Hexagonal percolation
  • Sudoku solver
  • Maze solver

Installation

Clone this repository :

bash git clone https://github.com/AdrienC21/recursive-fractal-graphics.git

How to use

Please find below a short description on how to use each algorithms.

Von Koch Snowflake

Draw the Von Koch Snowflake

alt text

Edit in runvonkoch.py the following lines :

python initial_P1 = np.array([0, 0]) # first coordinate of the initial segment initial_P2 = np.array([3, 3]) # second coordinate of the initial segment nbiter = 8 # number of iterations

Run runvonkoch.py

Menger Sponge

Draw the Menger Sponge

alt text

Edit in run_menger.py the following lines :

python nbiter = 8 # number of iterations size = 3**7 # size of the array

Run runvonkoch.py

Square percolation

Create a random array with holes and process a percolation from the top. Draw the result.

alt text

Then, an estimation of the density of filled holes and an estimation of the probability that a percolation on a random array will reach the botton is also plotted.

alt text alt text

Edit in runsquarepercolation.py the following lines :

python proba = 0.6 # probability of a hole to a appear when building grid size = 100 # size of the matrix

Run runsquarepercolation.py

Hexagonal percolation

Create a random hexagonal grid with holes and process a percolation from the top. Draw the result.

alt text

Edit in runhexpercolation.py the following lines :

python sizepolygon = 7 # size of a vertice of an hexagon size = 94 # size of the grid p = 0.6 # Between 0 and 1. Hole creation probability

Run runhexpercolation.py

Sudoku solver

Sudoku solver that use a recursive algorithm. Draw the sudoku once solved.

alt text

(OPTIONAL) Edit in runsudokusolver.py one of the sudokus :

```python

Example of a sudoku written in python

M1 = np.array([[0, 1, 0, 0, 5, 2, 0, 0, 7], [0, 8, 0, 7, 0, 0, 0, 1, 0], [9, 0, 2, 0, 6, 1, 5, 0, 0], [4, 0, 0, 2, 0, 0, 7, 0, 0], [8, 0, 1, 0, 7, 0, 2, 0, 4], [0, 0, 7, 0, 0, 5, 0, 0, 9], [0, 0, 6, 5, 3, 0, 9, 0, 8], [0, 9, 0, 0, 0, 4, 0, 5, 0], [2, 0, 0, 9, 8, 0, 0, 7, 0]]) ```

Run runsudokusolver.py

Maze solver

WARNING : The algorithm may take a lot of time.

Maze solver that use a recursive algorithm. Draw the maze, the coordinates explored an print the path in the console.

alt text alt text

Edit in runmazesolver.py the following lines :

```python n = 9 # size of the n*n maze p = 0.6 # probability of creating a land instead of a wall in our maze

Random initial and final coordinates

initialcoordinate = (rd.randint(0, n - 1), rd.randint(0, n - 1)) finalcoordinate = (rd.randint(0, n - 1), rd.randint(0, n - 1)) ```

Run runmazesolver.py

License

MIT

Owner

  • Name: Adrien Carrel
  • Login: AdrienC21
  • Kind: user
  • Location: London

Quantitative Researcher MSc Imperial College London (Advanced Computing) MEng CentraleSupélec (Applied Mathematics, Diplôme d'ingénieur)

GitHub Events

Total
Last Year

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels