omargfh / find_billy_py

O(n) divide and conquer guided search in an NxN maze in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Find Billy

A Python solution to the classic "Find Billy" problem in O(N) time and O(1) extra space.

Requirements

  • Python 3.6+
  • PIL

Usage

$ pip install image
$ python find_billy.py <file_path>

Example

$ python find_billy.py billy.txt
* | * | * | * | * | *
> | v | * | * | > | B
⌃ | > | > | > || *| < | < | < | < | *
> | > | > | > || *| * | * | * | * | *
1 | 2 | 3 | 4 | 5 | 6
Billy is at (6, 5)

Example Input

* * * * * *
> v * * > B
^ > > > ^ *
^ < < < < *
> > > > ^ *
^ * * * * *

Example Images

N = 12

12x12

N = 10

10x10

Runtime

Runtime

About

O(n) divide and conquer guided search in an NxN maze in Python


Languages

Language:Jupyter Notebook 80.3%Language:Python 19.7%