![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
github.com/oskarforsstrom/maze
When a maze has multiple solutions one might wanna find the shortest possible path from start to finish. The BFS method of finding the shortest possible path uses a queue to visit vertices with increasing distance from the start-vertex and thereby finds the shortest possible path.
Run this command to install the maze
package:
go get github.com/oskarforsstrom/maze
The package builds a maze based on a object-oriented graph with vertices and edges with adjencency lists. Every vertex has a unique two integer (coordinate) representation and can only have edges to adjencent vertices (non-diagonal).
package main
import (
"fmt"
"github.com/oskarforsstrom/maze"
)
func main() {
g := maze.NewGraph(5, 5)
g.AddStart(1, 1)
g.AddFinish(1, 5)
for i := 1; i <= 3; i++ {
g.AddObstacle(i, 3)
}
fmt.Printf(g.StringFastestPath())
}
---
Output:
.-------.-------.-------.-------.-------.
| ( s ) (1,2) | (1,3) | ( p ) ( f ) |
: + +-------+ + +
| ( p ) (2,2) | (2,3) | ( p ) (2,5) |
: + +-------+ + +
| ( p ) (3,2) | (3,3) | ( p ) (3,5) |
: + +-------+ + +
| ( p ) ( p ) ( p ) ( p ) (4,5) |
: + + + + +
| (5,1) (5,2) (5,3) (5,4) (5,5) |
'-------'-------'-------'-------'-------'
distance = 10
type Graph struct {
// containts unexported fields
}
Graph represents a maze-graph where every vertex is represented by a 2D coordinate (a unique combination of two integers) and where every vertex only can have edges between itself and adjencent (non-diagonal) vertices, i.e., if we're given a Vertex (x,y) we know that it can only have edges to the vertices: (x+1,y), (x-1,y), (x,y+1), (x,y-1).
func NewGraph(height int, width int) Graph
NewGraph creates a graph of size, width x heigth, where every vertex has a edge connected to every adjencent vertex (non-diagonal).
func (g *Graph) String() string
Reurns a ASCII representation of the graph with visual representation for obstacles, startVertex and finishVertex.
func (g *Graph) AddObstacle(y int, x int)
Adds an obstacle at the specified vertex, i.e. removes edges between the vertex and its adjencent vertices.
func (g *Graph) RemoveObstacle(y int, x int)
Removes an obstacle at the specified vertex, i.e. adds edges between the vertex and its adjencent vertices, if the adjencent vertex isn't an obstacle.
func (g *Graph) AddStart(y int, x int)
Marks the specified vertex as the "startVertex".
func (g *Graph) AddFinish(y int, x int)
Marks the specified vertex as the "finishVertex".
func (g *Graph) StringFastestPath() string
Return a ASCII representation of the shortest path between the start- and finishvertex and the distance of the path.
func (g *Graph) GetFastestPath() (int, []string)
Returns the shortest distance between the start- and finishvertex and a slice of strings representing the shortest path.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.