Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
5 votes
5 answers
1k views

Faux Random Maze Generator

For a personal project, I've written a maze generator in Python that I will be using A* to navigate through (using C++). The biggest points of improvements I'm looking for are in the generation itself....
Ben A's user avatar
  • 10.7k
5 votes
2 answers
1k views

Optimizing Python BFS Code

...
FailingCoder's user avatar
1 vote
1 answer
378 views

Google Foobar challenge optimization

I am trying to solve Google Foobar challenge prepare-the-bunnies-escape using my own approach, instead of BFS. I attempt to solve two ends of the maze and try to ...
ScriptKidd's user avatar
2 votes
0 answers
121 views

AStar Implementation and Efficiency

This is my implementation of an AStar-like algorithm for maze solving. A quick summary of the problem I am trying to solve with my algorithm might be: A simple binary maze is given to you to solve, ...
ZeroMaxinumXZ's user avatar
2 votes
0 answers
73 views

Dijkstra from scratch

I implemented the Dijkstra algorithm from scrath and wonder if I can save some code? The whole algorithm is here. n is the number of nodes, and m the number of edges. 1 ≤ 𝑛 ≤ 10^4, 0 ≤ 𝑚 ≤ 10^5, 𝑢 ...
Lerner Zhang's user avatar
3 votes
1 answer
830 views

How can I speed up my IDA* algorithm for N-puzzle?

I'm trying to solve the N-Puzzle problem using IDA* algorithm with a Manhattan heuristic. I already implemented the algorithm from the pseudocode in this Wikipedia page (link). Here's my code so far : ...
cuzureau's user avatar
  • 191
4 votes
1 answer
83 views

Navigating the robot by finding the shortest way

I have this task where I have to make my robot find the shortest way when I enter a destination point. I've created some functions to assign numbers (distances) for each square and counts its way back ...
Mert's user avatar
  • 49
10 votes
2 answers
4k views

Implementation of Dijkstra's algorithm in Python

I have implemented Dijkstra's algorithm for my research on an Economic model, using Python. In my research I am investigating two functions and the differences ...
O.B.'s user avatar
  • 103
6 votes
1 answer
1k views

Python: Astar algorithm implementation

I have implemented Astar algorithm for a problem on an online judge relating to maze given start and end positions along with a grid representing the maze. I output the length of the path along with ...
V_head's user avatar
  • 555
1 vote
0 answers
385 views

Directed graph and Dijkstra algorithm using heap

I have implemented directed graph and Dijkstra algorithm using heap in Python. I first implemented an abstract base class WeightedGraph, of which ...
user141240's user avatar
4 votes
1 answer
78 views

Advice on path-finding visualisation program

Im looking for some help on improving my code which visualizes path-finding algorithms. The code is working however I know it can be improved. Any suggestions would be appreciated. Github code - ...
James Robinson's user avatar
10 votes
2 answers
1k views

Path finding solution for a maze whose state changes during the solve

This is not a traditional maze where you find the shortest path (like the gif on the left). In order to solve it, you need to visit every available node before reaching the end, where once a node is ...
alec's user avatar
  • 109
7 votes
2 answers
3k views

Find the closest enemy in a 2D grid with wrapping allowed

I'd like feedback on my solution to the outlined programming challenge. Is numpy a good candidate module for this? What might be a more efficient or Pythonic solution? Closest Enemy II Have the ...
Dave's user avatar
  • 753
8 votes
1 answer
2k views

Speeding up Dijkstra's algorithm

I have Dijkstra's algorithm: ...
Alexey's user avatar
  • 183
7 votes
2 answers
6k views

Find the correct path through a 5 x 5 grid (coderbyte 'Correct path')

I've completed the following coderbyte question and would like feedback as to whether it follows Python best practices, is efficient and so forth. The coderbyte problem: Have the function ...
Dave's user avatar
  • 753

15 30 50 per page