numberguessing

package
v0.0.0-...-34e20a7 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

A number guessing game.

Index

Constants

View Source
const CorrectEvent cg.EventName = "correct"

You guessed the correct number.

View Source
const GuessCmd cg.CommandName = "guess"

Send the `guess` command to make a guess.

View Source
const TooHighEvent cg.EventName = "too_high"

You guessed too high.

View Source
const TooLowEvent cg.EventName = "too_low"

You guessed too low.

Variables

This section is empty.

Functions

This section is empty.

Types

type CorrectEventData

type CorrectEventData struct {
	// The correct number.
	Number int `json:"number"`
	// The number of tries.
	Tries int `json:"tries"`
}

type Game

type Game struct {
	// contains filtered or unexported fields
}

func NewGame

func NewGame(cgGame *cg.Game, config GameConfig) *Game

func (*Game) Run

func (g *Game) Run()

type GameConfig

type GameConfig struct {
	// The minimum number (inclusive) default=0
	Min int `json:"min"`
	// The maximum number (inclusive) default=100
	Max int `json:"max"`
}

type GuessCmdData

type GuessCmdData struct {
	// The number you guess.
	Number int `json:"number"`
}

type TooHighEventData

type TooHighEventData struct {
	// The guessed number.
	Number int `json:"number"`
}

type TooLowEventData

type TooLowEventData struct {
	// The guessed number.
	Number int `json:"number"`
}

Jump to

Keyboard shortcuts

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