santa-helpers

https://img.shields.io/pypi/v/santa_helpers.svg https://img.shields.io/travis/lenarother/santa_helpers.svg Documentation Status Updates

Helpers for Advent of Codee

Features

  • Calculate manhattan distance

    >>> distances.manhattan((-3, 1), (0, 0))
    
    4
    
  • Generate neighbors

    >>> list(neighbors.neighbors((1, 1)))
    
    [(1, 0), (0, 1), (2, 1), (1, 2)]
    
    >>> list(neighbors.neighbors((1, 1), 8))
    
    [
        (0, 0),
        (1, 0),
        (2, 0),
        (0, 1),
        (2, 1),
        (0, 2),
        (1, 2),
        (2, 2)
    ]
    
    >>> list(neighbors.neighbors((1, 1), p_min=(1, 1)))
    
    [(2, 1), (1, 2)]
    
  • Generate points in path

    >>> list(paths.path_points((0, 0), 'R2'))
    
    [(1, 0), (2, 0)]
    

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.