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