Written the ImageWriter

This commit is contained in:
Karma Riuk
2023-08-09 17:44:59 +02:00
parent cffc3b5939
commit 9e7c6b5e24
4 changed files with 140 additions and 4 deletions

View File

@ -1,8 +1,31 @@
package maze
import "math"
type Coordinates struct {
X, Y int
}
func (c Coordinates) Distance(o Coordinates) float64 {
x, y := float64(o.X-c.X), float64(o.Y-c.Y)
if y == 0 {
if x < 0 {
return -x
}
return x
}
if x == 0 {
if y < 0 {
return -y
}
return y
}
return math.Sqrt(x*x + y*y)
}
type Node struct {
Coords Coordinates
Up, Down *Node