aboutsummaryrefslogtreecommitdiff
path: root/go/game/pos.go
blob: 2a646a83d206f5837c8f330154ff848e459247c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package game

import (
	"fmt"
)

type Position struct {
	X int
	Y int
}

func (p *Position) String() string {
	if *p == INVALID_POSITION() {
		return "INVALID_POSITION"
	}

	return fmt.Sprintf("(%d, %d)", p.X, p.Y)
}

func INVALID_POSITION() Position {
	return Position{-1, -1}
}