refactor: floats, tests
This commit is contained in:
@@ -22,11 +22,11 @@ func (f Float) F() float64 {
|
||||
return float64(f)
|
||||
}
|
||||
|
||||
type TechSet map[Tech]float64
|
||||
type TechSet map[Tech]Float
|
||||
|
||||
func (ts TechSet) Value(t Tech) float64 {
|
||||
if v, ok := ts[t]; ok {
|
||||
return v
|
||||
return v.F()
|
||||
} else {
|
||||
panic(fmt.Sprintf("TechSet: Value: %s's value not set", t.String()))
|
||||
}
|
||||
@@ -34,7 +34,7 @@ func (ts TechSet) Value(t Tech) float64 {
|
||||
|
||||
func (ts TechSet) Set(t Tech, v float64) TechSet {
|
||||
m := maps.Clone(ts)
|
||||
m[t] = v
|
||||
m[t] = F(v)
|
||||
return m
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ type Game struct {
|
||||
Turn uint `json:"turn"`
|
||||
Map Map `json:"map"`
|
||||
Race []Race `json:"races"`
|
||||
Votes float64 `json:"votes"`
|
||||
Votes Float `json:"votes"`
|
||||
ShipGroups []ShipGroup `json:"shipGroup,omitempty"`
|
||||
Fleets []Fleet `json:"fleet,omitempty"`
|
||||
Winner []uuid.UUID `json:"winner,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user