38 lines
706 B
Go
38 lines
706 B
Go
package main
|
|
|
|
import "fmt"
|
|
|
|
// Game commands
|
|
const (
|
|
CommandEnd = -1
|
|
CommandRaw = 0
|
|
CommandContinue = 1
|
|
CommandThrow = 2
|
|
CommandCut = 3
|
|
CommandMessage = 4
|
|
)
|
|
|
|
type gameCommand struct {
|
|
Player int
|
|
Command int
|
|
Value string
|
|
}
|
|
|
|
func (gc gameCommand) ToStr() string {
|
|
var commandprinted string
|
|
switch gc.Command {
|
|
case CommandEnd:
|
|
commandprinted = "End"
|
|
case CommandRaw:
|
|
commandprinted = "Raw"
|
|
case CommandContinue:
|
|
commandprinted = "Continue"
|
|
case CommandCut:
|
|
commandprinted = "Cut"
|
|
case CommandThrow:
|
|
commandprinted = "Throw"
|
|
case CommandMessage:
|
|
commandprinted = "Message"
|
|
}
|
|
return fmt.Sprintf("Player %d - %s - %s", gc.Player, commandprinted, gc.Value)
|
|
}
|