ziki

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

README

Ziki: The Search for Merge

This is a silly spoofish game about mediawiki code review. It is not intended to be taken seriously. The name is a combination of "Zork" and "Wiki".

You play as a new developer trying to get your first change to mediawiki merged. Your odds of achieving this are ... well ... you'll see.

Notes

Color schemes are quite rudimentary. If the colored text output doesn't look good on your terminal, type "color none" (in the game) and colored output will be disabled. Preferences are not saved anywhere, so you'll have to do this every time.

This game was inspired by a comment made by Cindy Cicalese during a meeting. Initial implementation was by Bill Pirkle

Implementation ideas were taken from Paul Fortin's blog. Some of the code is still directly cut-and-paste from there.

Consensus during code review can go up even when the player and the reviewer are being disagreeable to each other, because they are effectively beating each other into submission. This is, of course, not how we want real-life code reviews to go. But this is a spoof.

Disclaimer

This is my first-ever Go project. I wrote it to practice with the language. The quality of the code (or lack thereof) probably reflects my level of (un)familiarity with Go in ways that I'm not even yet aware of.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Out *os.File
	In  *os.File
)
View Source
var Actions = map[int]*Action{
	1: {Name: "Good suggestion", /* contains filtered or unexported fields */},
	2: {Name: "Great suggestion", /* contains filtered or unexported fields */},
	3: {Name: "Bad suggestion", /* contains filtered or unexported fields */},
	4: {Name: "Terrible suggestion", /* contains filtered or unexported fields */},
	5: {Name: "Thoughtful comment", /* contains filtered or unexported fields */},
	6: {Name: "Snarky comment", /* contains filtered or unexported fields */},
}
View Source
var ColorTypes = map[string]string{
	"normal":    "white",
	"error":     "red",
	"prompt":    "green",
	"alert":     "blue",
	"separator": "yellow",
}
View Source
var Events = map[string]*Event{
	"codeReview":   {Type: "CodeReview", Chance: 25, Description: "You receive a Code Review comment", Morale: 0, Evt: ""},
	"criticism":    {Type: "Story", Chance: 25, Description: "Someone criticises you unfairly", Morale: -40, Evt: ""},
	"wikilove":     {Type: "Story", Chance: 25, Description: "A colleague sends you wikilove", Morale: +40, Evt: ""},
	"unbreakNow":   {Type: "Story", Chance: 25, Description: "You broke the wikis", Morale: -30, Evt: ""},
	"extraHoliday": {Type: "Story", Chance: 20, Description: "You are granted an extra holiday", Morale: +30, Evt: "recharging"},
	"recharging":   {Type: "Story", Chance: 100, Description: "You do non-computer things you enjoy", Morale: +20, Evt: ""},
	"spam":         {Type: "Story", Chance: 75, Description: "You receive annoying spam", Morale: -5, Evt: ""},
}
View Source
var LocationMap = map[string]*Location{
	"CommandLine": {Description: "You just pushed your first change.", Transitions: []string{"Phab", "Gerrit", "Gitlab", "Email", "Chat", "Meeting", "AFK"}, Events: []string{}},
	"Phab":        {Description: "You are looking at your Phabricator task.", Transitions: []string{"Gerrit", "Gitlab", "Chat", "Email", "Meeting", "AFK"}, Events: []string{"codeReview", "criticism", "wikilove", "unbreakNow"}},
	"Gerrit":      {Description: "You are looking at  your change in Gerrit.", Transitions: []string{"Phab", "Gitlab", "Chat", "Email", "Meeting", "AFK"}, Events: []string{"codeReview", "criticism", "wikilove", "unbreakNow"}},
	"Gitlab":      {Description: "You are in Gitlab. There aren't many people here.", Transitions: []string{"Phab", "Gerrit", "Chat", "Email", "Meeting", "AFK"}, Events: []string{"codeReview", "criticism", "wikilove", "unbreakNow"}},
	"Email":       {Description: "You are in your email, looking at your massive inbox.", Transitions: []string{"Phab", "Gerrit", "Gitlab", "Meeting", "AFK"}, Events: []string{"codeReview", "criticism", "wikilove", "unbreakNow", "extraHoliday", "spam"}},
	"Chat":        {Description: "You are in Slack/Element/IRC/whatever-you-prefer.", Transitions: []string{"Phab", "Gerrit", "Gitlab", "Email", "Meeting", "AFK"}, Events: []string{"codeReview", "criticism", "wikilove", "unbreakNow"}},
	"Meeting":     {Description: "You are in Google Meet", Transitions: []string{"Phab", "Gerrit", "Gitlab", "Chat", "Email"}, Events: []string{"codeReview", "criticism", "unbreakNow", "wikilove", "extraHoliday"}},
	"AFK":         {Description: "You are away from your computer, living your real life", Transitions: []string{"Phab", "Gerrit", "Gitlab", "Chat", "Email", "Meeting"}, Events: []string{"recharging"}},
}
View Source
var Messages = map[string]string{
	"welcome": "Welcome to Ziki: The Search for Merge!\nYou are a new developer trying to get your first change merged\nThe game ends when you either get your patch merged, or run out of Morale and abandon it.\nType 'help' for help, or 'quit' to exit.\n",
}
View Source
var Reviewers = map[int]*Actor{
	0: {Name: "Helpful Novice", Morale: 50, Actions: []int{1, 3, 4, 5}, Npc: true},
	1: {Name: "Helpful Peer", Morale: 55, Actions: []int{1, 2, 3, 5}, Npc: true},
	2: {Name: "Helpful Mentor", Morale: 55, Actions: []int{1, 2, 5}, Npc: true},
	3: {Name: "Hurtful Novice", Morale: 50, Actions: []int{1, 3, 4, 6}, Npc: true},
	4: {Name: "Hurtful Peer", Morale: 55, Actions: []int{1, 3, 4, 6}, Npc: true},
	5: {Name: "Hurtful Mentor", Morale: 55, Actions: []int{1, 3, 4, 6}, Npc: true},
}

Functions

func FindLocationName

func FindLocationName(inputName string) (string, error)

func NewZikiCmd

func NewZikiCmd() *cobra.Command

func ProcessCommands

func ProcessCommands(g *Game, input string)

func UserInput

func UserInput(i *int)

func UserInputContinue

func UserInputContinue() string

func UserInputln

func UserInputln() string

Types

type Action

type Action struct {
	Name string
	// contains filtered or unexported fields
}

func (*Action) Use

func (a *Action) Use() int

type Actor

type Actor struct {
	Name    string
	Morale  int
	Actions []int
	Npc     bool

	CurrentLocation string
}

Actor Used for both the player and all npcs By convention, if a variable name is "player", it refers to the main player character and not an npc.

func (*Actor) Act

func (a *Actor) Act(actionOption int) (int, string)

func (*Actor) Output

func (a *Actor) Output(g *Game, c string)

type Actors

type Actors []Actor

func (Actors) Len

func (slice Actors) Len() int

type Event

type Event struct {
	Type        string
	Chance      int
	Description string
	Morale      int
	Evt         string
}

func (*Event) ProcessEvent

func (e *Event) ProcessEvent(g *Game) int

type Game

type Game struct {
	Player      Actor
	ColorScheme string
}

Game top-level structure for the game

func (*Game) Output

func (g *Game) Output(c string, args ...interface{})

func (*Game) Outputf

func (g *Game) Outputf(c string, format string, args ...interface{})

func (*Game) Play

func (g *Game) Play()

func (*Game) ProcessEvents

func (g *Game) ProcessEvents(events []string)

type Location

type Location struct {
	Description string
	Transitions []string
	Events      []string
}

func (*Location) CanGoTo

func (loc *Location) CanGoTo(locName string) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL