Giter VIP home page Giter VIP logo

maze_generator's People

Contributors

alexriosj avatar mjrlowe avatar technobuddha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

maze_generator's Issues

Directional bias

Some algorithms could have functions that pick neighbor cells to connect to that aren't completely random. Some examples:

  • Horizontal and vertical bias (e.g. picking a vertical neighbor is twice as likely as picking a horizontal neighbor)
  • Pick neighbors according to a perlin/open-simplex noise function (creates blobby patterns)
  • Other functions (see this p5.js sketch I made a while ago: change "select neighbor mode")
  • Custom functions? It wood be cool if the user was able to give the algorithm a custom function to pick the neighbors with. (Maybe it takes in the cell's x and y position and it's possible neighbors and it outputs which neighbor/direction to chose?)

This will work best for algorithms like the recursive backtracker, where almost every step we have to make a decision about which neighbor we should connect to.

Implement seeds

This would be a property, probably a number, which would be passed in when calling Maze.create().
E.g.:

let recursiveDivisionMaze = Maze.create({
  algorithm: "recursive division",
  width: 10,
  height: 12,
  seed: 28542
})

This should always produce the same maze, provided the other settings are the same.

I am not entirely sure how to implement this though:

  • I think it is probably easiest to rely on a third-party module for random seeds but I'm not sure how/if I will be able to get this to work with both Deno and Node.
  • Should I overwrite Math.random with the seeded random function? This will mean that the algorithm code will work by itself without the seed function stuff (although the seeds won't work), but it probably isn't good practice to overwrite a standard function(?)

Multiple start points

An option to have multiple start points for some algorithms could be nice.

Algorithms that this would work well with:

  • Recursive backtracker
  • Simplified Prim's
  • Aldous Broder

Add tests

I don't know much about them so this will require a little bit of research, but hopefully it will make development easier in the future.

More coloring modes

Currently we have two coloring modes: "normal", which is just one color, and "distance", which colors the cells according to the distance from a certain point.

Here are a few ideas for some other coloring modes that might work well:

  • Number of neighbors
  • Number of times visited
  • Direction (or direction bias if that ever gets added)
  • Set (particularly for Kruskal's but could work for other algorithms like Eller's)
  • Order added/connected
  • Order you would pass them if you went from the start using the left/right wall following method.

Implement other shapes

E.g. hexagonal tiles, circular mazes, and irregular shapes.

This will probably require a rewrite of much of the code, so it is more of a long-term aim.

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.