local demo works
This commit is contained in:
parent
15f1ec5dee
commit
beab95579c
@ -5,6 +5,8 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
. "git.saintnet.tech/stryan/snengame/internal/game"
|
||||
)
|
||||
|
||||
const DEBUG = true
|
||||
@ -17,7 +19,7 @@ func main() {
|
||||
|
||||
func local() {
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
g := snengame.NewGame()
|
||||
g := NewGame()
|
||||
|
||||
for {
|
||||
var t, cmd string
|
||||
@ -29,8 +31,20 @@ func local() {
|
||||
}
|
||||
cmd_raw, _ := reader.ReadString('\n')
|
||||
cmd = strings.TrimSpace(cmd_raw)
|
||||
if t == "s" || t == "d" {
|
||||
c := &snengame.Command{
|
||||
if t == "d" {
|
||||
c := &Command{
|
||||
PlayerID: i,
|
||||
Type: DebugCmd,
|
||||
Cmd: "d",
|
||||
}
|
||||
res := g.Parse(c)
|
||||
if res.DebugResult != nil {
|
||||
fmt.Println(res.DebugResult)
|
||||
} else {
|
||||
fmt.Println("invalid debug command")
|
||||
}
|
||||
} else if t == "s" {
|
||||
c := &Command{
|
||||
PlayerID: i,
|
||||
Type: CmdType(t),
|
||||
Cmd: cmd,
|
||||
@ -46,7 +60,7 @@ func local() {
|
||||
fmt.Println("uh oh")
|
||||
}
|
||||
} else if t == "a" {
|
||||
c := &snengame.Command{
|
||||
c := &Command{
|
||||
PlayerID: i,
|
||||
Type: CmdType(t),
|
||||
Cmd: cmd,
|
||||
|
Loading…
Reference in New Issue
Block a user