server

package
v0.0.0-...-613822d Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunServer

func RunServer()

func ServerHandler

func ServerHandler() *httprouter.Router

Types

type Action

type Action int8
const (
	SafeCoin Action = iota
	TwoCoin

	CashIn

	ThreeCoin
	BlockDouble

	Assasinate

	BlockAssasinate

	Steal
	BlockSteal
)

type Card

type Card int8
const (
	Dead Card = iota
	Duke
	Assasin
	Contessa
	Captain
	Ambassador
)

func (Card) MarshalJSON

func (card Card) MarshalJSON() ([]byte, error)

Mashalls

func (Card) String

func (card Card) String() string

Stringers

type Id

type Id string

type Page

type Page struct {
	Title string
	Body  []byte
}

type Player

type Player struct {
	Room *Room           `json:"-"`
	Conn *websocket.Conn `json:"-"`
	Send chan []byte     `json:"-"`
	Rdy  bool            `json:"-"`

	Cards [2]Card
	Name  string
	Coins int
}

type Room

type Room struct {
	Members []*Player
	State   string // lobby, ingame, get-action, get-bluff-call
	Turn    int
	Id      string `json:"id"`

	Deck map[Card]int `json:"-"`
	Join chan *Player `json:"-"`

	Receive     chan []byte `json:"-"`
	Members_mut sync.Mutex  `json:"-"`
}

Jump to

Keyboard shortcuts

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