complete generator test
This commit is contained in:
@@ -9,12 +9,12 @@ const defaultFactor float64 = 0.1
|
||||
|
||||
type MapSetting struct {
|
||||
Players uint32
|
||||
HWSize uint32
|
||||
HWResources uint32
|
||||
HWSize float64
|
||||
HWResources float64
|
||||
HWMinDistance uint32
|
||||
DWCount uint32
|
||||
DWSize uint32
|
||||
DWResources uint32
|
||||
DWSize float64
|
||||
DWResources float64
|
||||
DWMinDistance uint32
|
||||
DWMaxDistance uint32
|
||||
|
||||
@@ -31,7 +31,8 @@ func (ms MapSetting) String() string {
|
||||
}
|
||||
|
||||
func (ms MapSetting) ExpectedSize() uint32 {
|
||||
return uint32(math.Sqrt(float64(ms.Players)) * float64(ms.HWMinDistance) * 1.4)
|
||||
// 1.5 coefficient is enough if all free planet probability will be 1.0
|
||||
return uint32(math.Sqrt(float64(ms.Players)) * float64(ms.HWMinDistance) * 1.5)
|
||||
}
|
||||
|
||||
func (ms MapSetting) TotalPlanets() uint32 {
|
||||
@@ -51,8 +52,8 @@ type PlanetSetting struct {
|
||||
Probability float64
|
||||
}
|
||||
|
||||
func (ps PlanetSetting) Count(freePlanets uint32) int {
|
||||
return int(math.Ceil(float64(freePlanets) * float64(ps.Probability)))
|
||||
func (ps PlanetSetting) MaxCount(freePlanets uint32) int {
|
||||
return int(math.Ceil(float64(freePlanets) * ps.Probability))
|
||||
}
|
||||
|
||||
func DefaultMapSetting() MapSetting {
|
||||
@@ -82,7 +83,7 @@ func DefaultMapSetting() MapSetting {
|
||||
MaxResource: 10,
|
||||
Probability: 0.18,
|
||||
},
|
||||
OthersMinDistance: defaultFactor, // minimal of 1 pixel on the plotter
|
||||
OthersMinDistance: defaultFactor, // min. is 1 pixel on the plotter
|
||||
NormalPlanets: PlanetSetting{
|
||||
MinDistanceHW: 0,
|
||||
MinSize: 0,
|
||||
|
||||
Reference in New Issue
Block a user