Skip to content
/ backer Public

Backer service which is allowed players to back each other and get a part the prize in case of a win.

License

Notifications You must be signed in to change notification settings

takama/backer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Backer

Build Status Contributions Welcome Go Report Card codecov

Backer service which is allowed players to back each other and get a part the prize in case of a win.

Logic description

Each player holds certain amount of bonus points. Website funds its players with bonus points based on all kind of activity. Bonus points can traded to goods and represent value like real money. One of the social products class is a social tournament. This is a competition between players in a multi-player game like poker, bingo, etc) Entering a tournament requires a player to deposit certain amount of entry fee in bonus points. If a player has not enough point he can ask other players to back him and get a part the prize in case of a win. In case of multiple backers, they submit equal part of the deposit and share the winning money in the same ration.

Implementation in Go

Points

// Points can traded to goods and represent value like real money
type Points float32

Players

// Player declares players methods
type Player interface {
    ID() string
    Fund(amount Points) error
    Take(amount Points) error
    Balance() (Points, error)
}

Tournament

// Tournament declares tournament methods
type Tournament interface {
    Announce(deposit Points) error
    Join(players Player...) error
    Result(winners map[Player]Points) error
}

Service

// Service defines methods for service control
type Service interface {
    Reset() error
}

About

Backer service which is allowed players to back each other and get a part the prize in case of a win.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published