2023-12-11 21:51:50 +01:00
|
|
|
package robots
|
2023-12-01 21:57:52 +01:00
|
|
|
|
2023-12-06 20:32:08 +01:00
|
|
|
import (
|
|
|
|
"github.com/gdamore/tcell/v2"
|
|
|
|
)
|
2023-12-01 21:57:52 +01:00
|
|
|
|
|
|
|
const (
|
|
|
|
Up = iota
|
|
|
|
Left
|
|
|
|
Right
|
|
|
|
Down
|
2023-12-01 22:41:35 +01:00
|
|
|
upleft
|
|
|
|
upright
|
|
|
|
downleft
|
|
|
|
downright
|
|
|
|
teleport
|
2023-12-01 21:57:52 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
type Position struct {
|
|
|
|
x int
|
|
|
|
y int
|
|
|
|
}
|
|
|
|
|
|
|
|
type Player struct {
|
|
|
|
position Position
|
2023-12-01 23:08:17 +01:00
|
|
|
score int
|
2023-12-01 21:57:52 +01:00
|
|
|
moves int
|
|
|
|
teleports int
|
|
|
|
}
|
|
|
|
|
|
|
|
type Game struct {
|
|
|
|
screen tcell.Screen
|
|
|
|
style tcell.Style
|
|
|
|
keypresses chan int
|
|
|
|
player Player
|
2023-12-02 00:19:33 +01:00
|
|
|
level int
|
2023-12-06 20:32:08 +01:00
|
|
|
robots []Robot
|
2023-12-01 21:57:52 +01:00
|
|
|
trash []Position
|
|
|
|
gameover int
|
|
|
|
}
|
2023-12-06 20:32:08 +01:00
|
|
|
|
|
|
|
type Robot struct {
|
|
|
|
id int
|
2024-01-08 11:12:13 +01:00
|
|
|
comms chan Position
|
2023-12-06 20:32:08 +01:00
|
|
|
position Position
|
|
|
|
}
|