Refactor tiles to objects to be re-used

This commit is contained in:
Marc Di Luzio 2020-06-26 19:45:24 +01:00
parent 8b1eca0aee
commit 2846ed796e
6 changed files with 69 additions and 51 deletions

37
pkg/objects/objects.go Normal file
View file

@ -0,0 +1,37 @@
package objects
const (
Empty = byte(' ')
Rover = byte('R')
SmallRock = byte('o')
LargeRock = byte('O')
)
// Check if an object is a blocking object
func IsBlocking(object byte) bool {
var blocking = [...]byte{
Rover,
LargeRock,
}
for _, t := range blocking {
if object == t {
return true
}
}
return false
}
// Check if an object is stashable
func IsStashable(object byte) bool {
var stashable = [...]byte{
SmallRock,
}
for _, t := range stashable {
if object == t {
return true
}
}
return false
}