Cribbage server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
690 B

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)
}