2021-07-15 19:26:57 -04:00
|
|
|
package main
|
|
|
|
|
2021-07-16 15:35:29 -04:00
|
|
|
import (
|
|
|
|
"bufio"
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"strings"
|
|
|
|
)
|
2021-07-16 14:08:19 -04:00
|
|
|
|
2021-07-15 19:26:57 -04:00
|
|
|
func main() {
|
2021-07-16 15:35:29 -04:00
|
|
|
reader := bufio.NewReader(os.Stdin)
|
2021-07-16 14:08:19 -04:00
|
|
|
g := NewGame()
|
|
|
|
|
2021-07-16 15:35:29 -04:00
|
|
|
for {
|
|
|
|
var t, cmd string
|
|
|
|
var i int
|
|
|
|
fmt.Print("> ")
|
|
|
|
_, err := fmt.Scanf("%s %d", &t, &i)
|
|
|
|
if t == "x" {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
cmd_raw, _ := reader.ReadString('\n')
|
|
|
|
cmd = strings.TrimSpace(cmd_raw)
|
|
|
|
if t == "s" {
|
|
|
|
fmt.Println(g.PlayerStateAct(i, cmd))
|
|
|
|
} else if t == "a" {
|
|
|
|
fmt.Println(g.PlayerAct(i, cmd))
|
|
|
|
} else {
|
|
|
|
fmt.Println("error parsing")
|
|
|
|
fmt.Println(err)
|
|
|
|
}
|
|
|
|
}
|
2021-07-15 19:26:57 -04:00
|
|
|
|
|
|
|
}
|