Code Monkey home page Code Monkey logo

mazesolving's Introduction

mazesolving

A variety of algorithms to solve mazes from an input image.

maze image

About

These are the python files associated with the computerphile video on maze solving. Feel free to use, alter, redistribute the code as you see fit.

Input

Some example mazes are included in the repository. These were generated either by hand, or using the software Daedalus. Once exported I edited the mazes to ensure that the following rules are adhered to:

  • Each maze is black and white. White represents paths, black represents walls.
  • All mazes are surrounded entirely by black walls.
  • One white square exists on the top row of the image, and is the start of the maze.
  • One white square exists on the bottom row of the image, and is the end of the maze.

Notes

This was just a side project I did for fun over a couple of evenings, I'm sure there are many improvements and extensions you could make if you wanted to. Some things to note:

  • The data structures and representations can probably be improved for speed - I only focused a little on efficiency. Mostly I wanted to keep memory usage down, to allow the use of very large mazes.
  • The very large mazes use a lot of ram. If you don't have 16Gb at least for the 10k+ x 10k+ mazes, you may run out of memory!
  • The current format of the test mazes (short paths, very dense) means that in fact dijkstra and a* usually operate more slowly than simple algorithms. In these cases Dijkstra usually performs the same function as breadth first search, but with more computational overhead. There will be some forms of maze where they are significantly faster.
  • Mazes don't need to be square - as long as they are surrounded by black walls. The input image will obviously be square.
  • Large areas of white, using my algorithm, will essentially degenerate into an inefficient flood fill - avoid!

mazesolving's People

Contributors

mikepound avatar

Watchers

James Cloos avatar Safta Catalin Mihai 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.