2019 Complete!
This commit is contained in:
33
2019/day25/util.go
Normal file
33
2019/day25/util.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
termboxUtil "github.com/br0xen/termbox-util"
|
||||
"github.com/nsf/termbox-go"
|
||||
)
|
||||
|
||||
// Some characters for display
|
||||
const (
|
||||
ChUpKeyValue = '↑'
|
||||
ChRightKeyValue = '→'
|
||||
ChDownKeyValue = '↓'
|
||||
ChLeftKeyValue = '←'
|
||||
ChEnterKeyValue = '⏎'
|
||||
ChCursor = '┇'
|
||||
)
|
||||
|
||||
func DrawString(v string, x, y int, fg, bg termbox.Attribute) (int, int) {
|
||||
termboxUtil.DrawStringAtPoint(v, x, y, fg, bg)
|
||||
return (x + len(v)), (y + 1)
|
||||
}
|
||||
|
||||
func FilterStrings(h []string, n string) []string {
|
||||
var ret []string
|
||||
for _, v := range h {
|
||||
if strings.HasPrefix(v, n) {
|
||||
ret = append(ret, v)
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
Reference in New Issue
Block a user