2019 Day 17 Complete

This commit is contained in:
2019-12-18 14:21:01 -06:00
parent 5d8cf97902
commit 39f5680ff3
3 changed files with 29 additions and 18 deletions

View File

@@ -123,6 +123,7 @@ func BFS(start, goal *BFSNode) (bool, []*BFSNode) {
var queue, explored []*BFSNode
queue = append(queue, start)
if start == goal {
fmt.Println(queue)
return true, queue
}
explored = append(explored, start)
@@ -131,6 +132,7 @@ func BFS(start, goal *BFSNode) (bool, []*BFSNode) {
if len(queue) > 1 {
current, queue = queue[0], queue[1:]
if current == goal {
fmt.Println(explored)
return true, explored
} else {
children := current.getChildren()