Code Monkey home page Code Monkey logo

java_maze_generator_swing's Introduction

Maze Generator/Solver

During my Degree, I had this project of doing both a generator and a solver of Maze. We were free to choose wich method to use.
All the project was on Java, the generation and resolution was in java vanilla and for the UI we had to use Java Swing.
note : if you are french (or crazy) you can read our pdf wich is in the repo.

Big s/o to paul, my teammate on this project :

Paul Prout

Generation

Maze generation processus

We hesitate between 2 maze generation algorithms:

Finally, I chose the Depth First Search method which seemed a bit eaisier at the time of choice.

Depth First Search method

Here are the different steps of the algorithm:

  1. Randomly select a node (or a cell) N.
  2. Push cell N into a Q queue.
  3. Mark cell N as visited.
  4. Randomly select an adjacent cell A from cell N that has not been visited. If all neighbors of N have been visited:
  • Continue removing items from queue Q until a cell is encountered with at least one unvisited neighbor - assign this cell to N and go to step 4.
  • If no cell exists: stop.
  1. Break the wall between N and A.
  2. Assign the value A to N.
  3. Go to step 2.

Resolution

Maze solving

For this part, we instantly went for the method of Depth-first search (again T.T) because we were forced to by the university. It was pretty the same logic as its counter part in Generation and so this part was made very quickly.

UI

Now that everything was done, we only had to do the UI part, in where we were forced to use Java Swing. We did something pretty classic :

Conclusion

It is always a great project to do a maze generator and/or solver. I was happy to do it and I am proud of the result ๐ŸŒน. Thank you to everyone who read all of this, hope it was interested ๐Ÿ˜„.
See ya

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.