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.
38 lines
706 B
38 lines
706 B
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) |
|
}
|
|
|