Git Product home page Git Product logo

coding-adventures's Introduction

Coding Adventures

Repository with some simple code tasks solved. Each adventure is a single python module, in some cases it provides some interaction via CLI adventure.

Adventures

Simple implementation of Wave Function Collapse algorithm for solving sudoku puzzle. Can be used via CLI with:

adventure wfc-sudoku

Can output individual steps of solution.

Sometimes fails due to random choices that lead to cases with impossible solutions

Example:

WFC Sudoku Example

Very simple and not optimal in terms of complexity ($O$-notation) implementation of algorithm for generating Voronoi Diagrams.

Provides 3 distance functions:

  • Euler

    Default distance function, widely known by everyone.

$$ \sqrt{(x_1 - x_2) ^ 2 + (y_1 - y_2) ^ 2} $$

  • Manhattan

    Also known as "taxicab" distance, calculated as length of vertical and horizontal moves from one position to another.

$$ |x_1 - x_2| + |y_1 - y_2| $$

  • Chebyshev

    Distance function calculated as max difference between $x$ and $y$ of positions.

$$ \max (|x_1 - x_2|, |y_1 - y_2|) $$

For generating random centers of groups I also provide 3 different approaches:

Approach Description
Random Generates random $x$ & $y$ for each group center; Guarantees generation of exact number of groups
Min Distance Random Generates random $x$ & $y$ for each group center; Guarantees generation of exact number of groups and minimal distance between group center
Fuzzy Grid Builds a grid of evenly distributed center and than based on fuzz radius randomly moves them around initial position

Voronoi Diagrams

coding-adventures's People

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.