Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Community Manager
Message 1 of 4

Noops Week Two: Mazebot discussion

This is a space to share and discuss with your fellow challengers. Feel free to post comments below and start the conversation. Good luck challengers!


I hope this helps,
Andrea

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!

3 Replies
Highlighted
Ground Controller Lvl 1
Message 2 of 4

Re: Noops Week Two: Mazebot discussion

Here's my naive implementation of maze racer solver mazebot.rb in ruby which is a translation from my js implementation maze-solver.js.

First time doing ruby, don't think I can get used to that syntax :|

 

Highlighted
Ground Controller Lvl 1
Message 3 of 4

Re: Noops Week Two: Mazebot discussion

I've started a bit too late but here is my solution is written in Go. I decided that these challenges are a great opportunity to sharpen my Go programming skills. Not too difficult, not too simple, just right :)

 

The solution is straightforward: it uses A-star with Manhatten heuristic. However, it was a great challenge for someone who is trying to get a grasp of a new language, and I am glad that I was able to implement it in a couple of days.

 

Here is the core function of the implementation:

 

func Solve(m *generator.Maze, h Heuristic) *Vertex {
	queue := collections.PriorityQueue{NewVertex(m.Start)}
	goal := NewVertex(m.Exit)
	visited := map[generator.Point]bool{}
	for !queue.Empty() {
		curr := queue.Pop().(*Vertex)
		visited[curr.Point] = true
		if curr.Equal(goal) {
			return curr
		}
		for _, neighbour := range getNeighbours(m, curr) {
			_, wasVisited := visited[neighbour.Point]
			if wasVisited { continue }
			neighbour.Score = h(neighbour, goal)
			queue.Push(neighbour)
		}
	}
	return nil
}

Also, I've created a little "renderer" to visualize a maze using ASCII chars.

 

Would be great if these bot APIs will be available after the challenge ends!

Highlighted
Copilot Lvl 2
Message 4 of 4

Re: Noops Week Two: Mazebot discussion

I had some fun and some challenge with this one.

After completing the challenge, do I set up a pull request? Or do I just post my certificate?

Thanks!