keno

package
v0.0.0-...-4cc0970 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const COLS int = 10
View Source
const ROWS int = 8
View Source
const TOTAL_NUMS int = 40

Variables

This section is empty.

Functions

func ValidatePicks

func ValidatePicks(picks []int) bool

Test all values in provided picks to ensure they don't put invalid nums

Types

type Card

type Card struct {
	CardId    int   `json:"card_id"`
	NumPicks  int   `json:"picks_per_game"`
	Picks     []int `json:"picks"`
	GamePrice int   `json:"price_per_game"`
	NumGames  int   `json:"number_games"`
	StartId   int   `json:"start_game_num"`
}

A Card is an individuals card It has their "picks" (choice of nums) As well as the price per game, # of picks per game The starting game ID, and the number of games they've paid for

func (*Card) CalcWin

func (c *Card) CalcWin(g *Game) int

Take a game and figure out how much we won on it

type Game

type Game struct {
	Id int `json:"id"`
	// While the Keno board is 2D when viewing,
	// We store it as a flat array for easier use
	Board    []int `json:"board"`
	Finished bool  `json:"completed"`
}

func NewGame

func NewGame(id int) *Game

func (*Game) PickNumbers

func (g *Game) PickNumbers() []int

Generate a random permutation of the Keno board, taking the last 20 numbers This gives us a random set of valid numbers without repetetion

func (*Game) RenderGame

func (g *Game) RenderGame()

Jump to

Keyboard shortcuts

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