Giter VIP home page Giter VIP logo

astar-pathfinding-challenge's Introduction

A* Pathfinding Challenge

I gave myself 4 hours to complete this challenge. The objective was to create a pathfinding algorithm that can find the shortest path between two points in a grid.

Technologies

  • React
  • ESLint
  • TypeScript
  • StyledComponents

Thought Process

To be honest, I would not use React for this kind of challenge. I would just use a plain old HTML/CSS/JS with a Snowpack setup for the development environment and to build the static files for the production environment.

My first thought was to use the A* algorithm to find the shortest path. I've never coded it before, but I've used it and read about it's implementation. I considered using one of the available npm packages for this, but I decided to write my own.

Before working on the components, and knowing about the time limit, I decided to start by algorithm implementation. I used the Wikipedia article as my main reference, but I also used two videos I've watched before: Computerphile - A* (A Star) Search Algorithm and Daniel Shiffman - Coding Challenge 51.1: A* Pathfinding Algorithm. This implementation took most of the time I had to complete the challenge.

Once it was working, I started building the basic components. The main component is the App component, which holds the maze reference, the solution, and the solver. Once I was able to render a basic maze using numbers to represent the maze state (walls, open spaces, solution, and the start and end points), I started working on the UI elements: Maze, and Tile.

Finally, as I had some minutes left before writting this README, I decided to add a basic interaction with the maze. Every tile has a click event, which will toggle the tile's state between open and wall. This also triggers the solver to find the shortest path again.

Running the repo

Just do the old npm install and npm start.

astar-pathfinding-challenge's People

Contributors

matiasbontempo avatar

Watchers

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