func (h *Office) Draw(screen *gc.Window, y, x int) {
	f := h.Frames
	v, p := (*f)["Office"]

	if !p {
		frames := [][]string{[]string{
			"<----->",
			"|XXXXX|",
			"|     |",
			"|XXXXX|",
			"|     |",
			"|XXXXX|",
			"[-----]"}, []string{
			"<----->",
			"|XXXXX|",
			"|     |",
			"|     |",
			"|     |",
			"|XXXXX|",
			"[-----]"}}

		(*f)["Office"] = frames
		v = frames
	}

	for ly, row := range v[h.Frame] {
		for lx, c := range row {
			screen.MoveAddChar(y+ly, x+lx, MapChar(c))
		}
	}
}
func (c *Circuit) display() {
	stdscr, err := gc.Init()
	if err != nil {
		log.Println(err)
	}
	defer gc.End()

	rows, cols := stdscr.MaxYX()
	height, width := len(c.circuit)+1, len(c.circuit[0])+1
	y, x := (rows-height)/2, (cols-width)/2

	var win *gc.Window
	win, err = gc.NewWindow(height, width, y, x)
	if err != nil {
		log.Println(err)
	}
	defer win.Delete()

	win.Timeout(500)

	for i := 0; i != height-1; i++ {
		for j := 0; j != width-1; j++ {
			if c.circuit[i][j] == "" {
				continue
			}
			char := gc.Char([]rune(c.circuit[i][j])[0])
			win.MoveAddChar(i, j, char)
		}
	}

main:
	for {
		for _, com := range c.Components {
			com.Update()
		}

		for _, com := range c.Components {
			cx, cy, _, _ := com.Space()
			for coord, out := range com.Visual() {
				char := gc.Char([]rune(*out)[0])
				win.MoveAddChar(cx+coord.X, cy+coord.Y, char)
			}
		}

		win.NoutRefresh()
		gc.Update()

		switch win.GetChar() {
		case 'q':
			break main
		}
	}
}
func (h *SmallHouse) Draw(screen *gc.Window, y, x int) {
	f := h.Frames
	var v [][]string
	var p bool

	if h.Dead {
		h.Frame = 0
		v, p = (*f)["DeadSmallHouse"]

		if !p {
			frames := [][]string{[]string{
				"    ",
				"|   ",
				"|   |",
				"[---]"},
			}

			(*f)["DeadSmallHouse"] = frames
			v = frames
		}
	} else {

		v, p = (*f)["SmallHouse"]

		if !p {
			frames := [][]string{[]string{
				"<--->",
				"|X  |",
				"|  X|",
				"[---]"}, []string{
				"<--->",
				"|X  |",
				"|   |",
				"[---]"}, []string{
				"<--->",
				"|   |",
				"|  X|",
				"[---]"},
			}

			(*f)["SmallHouse"] = frames
			v = frames
		}
	}

	for ly, row := range v[h.Frame] {
		for lx, c := range row {
			screen.MoveAddChar(y+ly, x+lx, MapChar(c))
		}
	}
}
func (h *BigFactory) Draw(screen *gc.Window, y, x int) {
	f := h.Frames
	v, p := (*f)["BigFactory"]

	if !p {
		frames := [][]string{[]string{
			"             ",
			"|| ||        ",
			"|| ||   <->  ",
			"|-------| |--",
			"|           |",
			"| XXX   XXX |",
			"[-----------]"}, []string{
			"xx xx        ",
			"|| ||        ",
			"|| ||   <->  ",
			"|-------| |--",
			"|           |",
			"| XXX   XXX |",
			"[-----------]"}, []string{
			"             ",
			"|| ||        ",
			"|| ||   |    ",
			"|-------| |--",
			"|           |",
			"| XXX       |",
			"[-----------]"}}

		(*f)["BigFactory"] = frames
		v = frames
	}

	for ly, row := range v[h.Frame] {
		for lx, c := range row {
			screen.MoveAddChar(y+ly, x+lx, MapChar(c))
		}
	}
}