package board

import "fmt"

type TileType byte

type jsonTile struct {
	X      int    `json:"x"`
	Y      int    `json:"y"`
	Type   string `json:"type"`
	Player string `json:"player,omitempty"`
}

const (
	Water TileType = 0
	Rock  TileType = 1
	Ice   TileType = 2
	Iglo  TileType = 3
)

func (t TileType) String() string {
	switch t {
	case Water:
		return "~"
	case Rock:
		return "▲"
	case Ice:
		return "*"
	case Iglo:
		return "⌂"
	}

	panic(fmt.Sprintf("Unknown tile type %#v", t))
}

func (t TileType) Name() string {
	switch t {
	case Water:
		return "W" // API says WATER... zucht.
	case Rock:
		return "R"
	case Ice:
		return "I"
	case Iglo:
		return "H"
	}

	panic(fmt.Sprintf("Unknown tile type %#v", t))
}
