Giter Club home page Giter Club logo

pissoir-problem's Introduction

Pissoir-problem

This is a very simple (and slow) implementation of the pissoir problem with maximum courtesy distance as presented in the DorFuchs video "Das Pissoir-Problem" (https://www.youtube.com/watch?v=a36zHPlbd2g).

Prerequisites:

  • Python 3.6+ (only tested in CPython 3.8 though)
  • matplotlib

The program calculates and plots the results of all pissoir problems up to a given n.

The program can be run from the command line like so: <python> <path>\pissoir_problem.py <n> <print_progress>.

Explanation of parameters:

  • <python> - your Python version. Usually it's one those 3: python, python3 or py.
  • <path> - The path towards the script, relative to your current location
  • <n> - describes the amount of pissoirs up to which you want to calculate
  • <print_progress> - optional, i.e. you can just omit it. If you put anything here it'll print what step it's currently calculating (might be useful if you calculate larger ns, as the program is kinda slow and you might panic if you don't see any output for a prolonged period of time).

In case you omit all parameters or put anything that is not a number for n, the program will "manually" ask you for those inputs.

Example run on my computer:

> python .\pissoir_problem.py 16 1
Calculating n= 0... Took 0.00000s
Calculating n= 1... Took 0.00000s
Calculating n= 2... Took 0.00000s
Calculating n= 3... Took 0.00000s
Calculating n= 4... Took 0.00000s
Calculating n= 5... Took 0.00000s
Calculating n= 6... Took 0.00000s
Calculating n= 7... Took 0.00100s
Calculating n= 8... Took 0.00101s
Calculating n= 9... Took 0.00300s
Calculating n=10... Took 0.01404s
Calculating n=11... Took 0.09077s
Calculating n=12... Took 0.36844s
Calculating n=13... Took 2.20706s
Calculating n=14... Took 9.32787s
Calculating n=15... Took 47.05341s
Calculating n=16... Took 351.85369s

--------------------------

Solution for n= 0: 0
Solution for n= 1: 1
Solution for n= 2: 2
Solution for n= 3: 4
Solution for n= 4: 8
Solution for n= 5: 20
Solution for n= 6: 48
Solution for n= 7: 216
Solution for n= 8: 576
Solution for n= 9: 1,392
Solution for n=10: 7,200
Solution for n=11: 43,200
Solution for n=12: 184,320
Solution for n=13: 1,065,600
Solution for n=14: 4,314,240
Solution for n=15: 21,611,520
Solution for n=16: 150,958,080

pissoir_problem_upto_16

pissoir-problem's People

Contributors

samuelroettgermann avatar mamuschka avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

mamuschka

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.