Files
game-of-life/math/comp.go
Natercio Moniz ea5b5c4e75 Initial commit
implemented the game of life variation with hexagonal grid
2025-12-16 11:33:00 +00:00

38 lines
473 B
Go

package math
func Max[T SignedNumber](nLst ...T) T {
switch len(nLst) {
case 0:
var zeroT T
return zeroT
case 1:
return nLst[0]
default:
m := nLst[0]
for _, n := range nLst[1:] {
if m < n {
m = n
}
}
return m
}
}
func Min[T SignedNumber](nLst ...T) T {
switch len(nLst) {
case 0:
var zeroT T
return zeroT
case 1:
return nLst[0]
default:
m := nLst[0]
for _, n := range nLst[1:] {
if m > n {
m = n
}
}
return m
}
}