aboutsummaryrefslogtreecommitdiff
path: root/go/game/pos.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/game/pos.go')
-rw-r--r--go/game/pos.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/go/game/pos.go b/go/game/pos.go
index 2b3459cd..2a646a83 100644
--- a/go/game/pos.go
+++ b/go/game/pos.go
@@ -1,10 +1,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}
}