35 lines
690 B
Go
35 lines
690 B
Go
package main
|
|
|
|
import "fmt"
|
|
|
|
const CommandEnd = -1
|
|
const CommandRaw = 0
|
|
const CommandContinue = 1
|
|
const CommandThrow = 2
|
|
const CommandCut = 3
|
|
const 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)
|
|
}
|