light.go 445 B

123456789101112131415161718192021222324252627282930
  1. package interaction
  2. import "strconv"
  3. type Light struct {
  4. id int
  5. location string
  6. on bool
  7. }
  8. func (l Light) Location() string {
  9. return l.location
  10. }
  11. func (l Light) Id() int {
  12. return l.id
  13. }
  14. func (Light) Type() string {
  15. return "Light"
  16. }
  17. func (l Light) String() string {
  18. return l.Type() + " " + strconv.Itoa(l.Id()) + " " + l.Location()
  19. }
  20. func New(id int, location string) Light {
  21. l := Light{id, location, false}
  22. return l
  23. }