Permalink
Browse files

Add other item types to enum

  • Loading branch information...
1 parent 8e3c3dd commit 410a374ced01745c7c5cf99d9cd05ad8aba70622 @bradleybuda committed Nov 14, 2011
Showing with 5 additions and 4 deletions.
  1. +2 −0 go/item.go
  2. +3 −4 go/square.go
View
@@ -3,6 +3,8 @@ package main
type ItemType int
const (
Food = iota
+ Hill
+ EnemyAnt
)
type Item interface {
View
@@ -108,10 +108,9 @@ func (square *Square) HasFood() bool {
}
func (square *Square) HasHill() bool {
- // TODO implement
- return false;
+ return (square.item != nil) && (square.item.ItemType() == Hill)
}
-func (sqaure *Square) HasEnemyAnt() bool {
- return false;
+func (square *Square) HasEnemyAnt() bool {
+ return (square.item != nil) && (square.item.ItemType() == EnemyAnt)
}

0 comments on commit 410a374

Please sign in to comment.