loto

package
v0.0.0-...-45672a7 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PriceN5AndLucky = 2000000.0
	PriceN5         = 159957.0
	PriceN4AndLucky = 2054.80
	PriceN4         = 430.60
	PriceN3AndLucky = 73.60
	PriceN3         = 21.70
	PriceN2AndLucky = 14.70
	PriceN2         = 4.70
	PriceN1AndLucky = 2.2
	PriceN1         = 0.0
	PriceN0AndLucky = 2.2
	PriceN0         = 0.0
	CostTicket      = 2.2
)

Prices values

View Source
var (
	JokerValue int64 = 100
	BallValue  int64 = 10
)

score point to match ball or joker

Functions

func Parse

func Parse(file string, newData func() interface{}, addData func(data interface{})) error

Parse the csv file to loto result history newData provide a great type to decode the csv file parameter and addData function save the decoded data

Types

type Draw

type Draw struct {
	ID        string            `csv:"annee_numero_de_tirage"`
	Date      string            `csv:"date_de_tirage"`
	Day       string            `csv:"jour_de_tirage"`
	B1        int32             `csv:"boule_1"`
	B2        int32             `csv:"boule_2"`
	B3        int32             `csv:"boule_3"`
	B4        int32             `csv:"boule_4"`
	B5        int32             `csv:"boule_5"`
	Joker     int32             `csv:"numero_chance"`
	OtherData map[string]string `csv:"-"`
}

Draw description data

type History

type History struct {
	OldDraws    []OldDraw
	RecentDraws []Draw
}

History data type

func NewHistory

func NewHistory() (History, error)

NewHistory read the files parameter to extract the draw history in date order

func (History) DrawByIndex

func (h History) DrawByIndex(index int) (Draw, error)

DrawByIndex getter not available on old history

func (History) Len

func (h History) Len() int

Len getter not available on old history

func (*History) OrderOld

func (h *History) OrderOld()

OrderOld the old list

func (*History) OrderRecent

func (h *History) OrderRecent()

OrderRecent the recent list

type Loto

type Loto interface {
	Prediction(opt Option) (rest int64, err error)

	History() History
	String() string
	// contains filtered or unexported methods
}

Loto data interface

func New

func New() (Loto, error)

New loto instance with the loading of loto hitory and return the default instance

func NewVariant1

func NewVariant1() (Loto, error)

NewVariant1 analyse ball by ball separetly with a strict pick order

type OldDraw

type OldDraw struct {
	ID        string            `csv:"annee_numero_de_tirage"`
	Date      string            `csv:"date_de_tirage"`
	Day       string            `csv:"jour_de_tirage"`
	B1        int32             `csv:"boule_1"`
	B2        int32             `csv:"boule_2"`
	B3        int32             `csv:"boule_3"`
	B4        int32             `csv:"boule_4"`
	B5        int32             `csv:"boule_5"`
	B6        int32             `csv:"boule_6"`
	Joker     int32             `csv:"boule_complementaire"`
	Tirage    int32             `csv:"1er_ou_2eme_tirage"`
	OtherData map[string]string `csv:"-"`
}

OldDraw description data

type Option

type Option struct {
	Index        int
	NDraws       int64
	Old          bool
	Old6thBall   bool
	OldLuckyBall bool
}

Option to adjust the data prediction Index to start in the history NDraw to the number draw usage in the prediction Old to get the old loto history

type Reward

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

Reward statistique

func (*Reward) AddScore

func (r *Reward) AddScore(score int64)

AddScore on the reward database

func (Reward) Price

func (r Reward) Price() (cost float64, win float64)

Price return the cost and win value to participation

func (Reward) String

func (r Reward) String() string

type Score

type Score struct {
	Value int64
	Draw  Draw
	Balls []int32
	Joker int32
}

Score is a status resolve to the prediction Draw is the future draw which try to find with the current balls and joker

func NewScore

func NewScore(d Draw, balls []int32, joker int32) Score

NewScore instanciate and evaluate score

Jump to

Keyboard shortcuts

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