game generation process
This commit is contained in:
@@ -20,30 +20,6 @@ type Coordinate struct {
|
||||
X, Y float64
|
||||
}
|
||||
|
||||
type PlanetClass int
|
||||
|
||||
const (
|
||||
PlanetClassHW PlanetClass = iota
|
||||
PlanetClassDW
|
||||
PlanetClassGiant
|
||||
PlanetClassBig
|
||||
PlanetClassNormal
|
||||
PlanetClassRich
|
||||
PlanetClassAsterioid
|
||||
)
|
||||
|
||||
type Planet struct {
|
||||
PlanetClass PlanetClass
|
||||
Position Coordinate
|
||||
Size float64
|
||||
Resources float64 // Сырьё
|
||||
}
|
||||
|
||||
type PlanetarySystem struct {
|
||||
HW Planet
|
||||
DW []Planet
|
||||
}
|
||||
|
||||
func NewMap(width, height, players uint32) (*Map, error) {
|
||||
p, err := plotter.NewPlotter(width, height, defaultFactor)
|
||||
if err != nil {
|
||||
@@ -93,15 +69,6 @@ func (m Map) ShortDistance(from, to Coordinate) float64 {
|
||||
return math.Sqrt(math.Pow(dx, 2) + math.Pow(dy, 2))
|
||||
}
|
||||
|
||||
func NewPlanet(pc PlanetClass, c Coordinate, size, resources float64) Planet {
|
||||
return Planet{
|
||||
PlanetClass: pc,
|
||||
Position: c,
|
||||
Size: size,
|
||||
Resources: resources,
|
||||
}
|
||||
}
|
||||
|
||||
// RandI returns a random float64 value between min and max
|
||||
func RandI(min, max float64) float64 {
|
||||
return min + rand.Float64()*(max-min)
|
||||
|
||||
Reference in New Issue
Block a user