Initial commit
implemented the game of life variation with hexagonal grid
This commit is contained in:
19
math/pair.go
Normal file
19
math/pair.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package math
|
||||
|
||||
import "fmt"
|
||||
|
||||
type Pair[T SignedNumber] struct {
|
||||
X, Y T
|
||||
}
|
||||
|
||||
func NewPair[T SignedNumber](x, y T) Pair[T] {
|
||||
return Pair[T]{X: x, Y: y}
|
||||
}
|
||||
|
||||
func (p Pair[T]) Equal(other Pair[T]) bool {
|
||||
return p.X == other.X && p.Y == other.Y
|
||||
}
|
||||
|
||||
func (c Pair[T]) String() string {
|
||||
return fmt.Sprintf("(%v,%v)", c.X, c.Y)
|
||||
}
|
||||
Reference in New Issue
Block a user