blackjack

package
v0.0.0-...-b30913e Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2017 License: MIT Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CurrentGames []Game
View Source
var EndedGames []Game

Functions

func AllPlayersCicle

func AllPlayersCicle(game *Game)

func CORSMiddleware

func CORSMiddleware() gin.HandlerFunc

CORSMiddleware middleware headers for any RESTful requests {{{

func CheckCardsLen

func CheckCardsLen(game *Game) bool

func CheckFullWinners

func CheckFullWinners(game *Game) bool

func DeactivateGame

func DeactivateGame(token string)

func FindPlayer

func FindPlayer(token string) (int, error)

func GenerateToken

func GenerateToken(strlen int) string

func GetAllEndedGames

func GetAllEndedGames(c *gin.Context)

func GetAllGames

func GetAllGames(c *gin.Context)

func GetGame

func GetGame(c *gin.Context)

func MakeDecision

func MakeDecision(value int) bool

func Start

func Start(args []string)

func StartGame

func StartGame(c *gin.Context)

func StopTakeGame

func StopTakeGame(c *gin.Context)

func TakeCardGame

func TakeCardGame(c *gin.Context)

Types

type Card

type Card struct {
	Name  string
	Type  string
	Suit  string
	Value int
}

func GenerateDeck

func GenerateDeck() []Card

func TakeCard

func TakeCard(game *Game, player *Player) Card

type Game

type Game struct {
	Ended        bool
	FinalMessage string
	Winner       []Player
	Cards        []Card
	Players      []Player
	Token        string
}

type Player

type Player struct {
	Name  string
	User  bool
	Stay  bool
	Cards []Card
	Sum   int
}

func GeneratePlayer

func GeneratePlayer(num int) []Player

type StartReq

type StartReq struct {
	Players int `form:"players" binding:"required"`
	Decks   int `form:"decks"`
}

type TokenReq

type TokenReq struct {
	Token string `form:"token" binding:"required"`
}

Jump to

Keyboard shortcuts

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