server

package
v0.0.0-...-8d8ea2a Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_QUEUED_PLAYERS = 128
View Source
const PORT = 5174

Variables

View Source
var MyGameState = types.GameState{
	Status: types.Pending,
	Settings: types.GameSettings{
		Language: "javascript",
		Problem:  "FizzBuzz",
	},
}

Functions

func HandleStart

func HandleStart(w http.ResponseWriter, r *http.Request)

func IsGameComplete

func IsGameComplete() bool

func ProcessGame

func ProcessGame(id int64)

func Serve

func Serve()

Types

type Examiner

type Examiner struct {
	DockerProcess *exec.Cmd
	Abort         func()
}

func NewExaminer

func NewExaminer() Examiner

func (Examiner) RunExam

func (e Examiner) RunExam(program string, language types.Language, challenge string) string

type PlayerStateStore

type PlayerStateStore struct {
	sync.RWMutex
	// contains filtered or unexported fields
}
var Players PlayerStateStore

func (*PlayerStateStore) Add

func (sb *PlayerStateStore) Add(ps *types.PlayerState) int64

func (*PlayerStateStore) Broadcast

func (sb *PlayerStateStore) Broadcast(mt int, action types.Action, data interface{})

func (*PlayerStateStore) BroadcastWithSkip

func (sb *PlayerStateStore) BroadcastWithSkip(mt int, action types.Action, data interface{}, skip int64)

func (*PlayerStateStore) CountReady

func (sb *PlayerStateStore) CountReady() int

func (*PlayerStateStore) Get

func (sb *PlayerStateStore) Get(id int64) *types.PlayerState

func (*PlayerStateStore) Remove

func (sb *PlayerStateStore) Remove(id int64)

func (*PlayerStateStore) UpdateStatus

func (sb *PlayerStateStore) UpdateStatus(s types.ReadyState)

func (*PlayerStateStore) UpdateStatusFor

func (sb *PlayerStateStore) UpdateStatusFor(id int64, s types.ReadyState)

Jump to

Keyboard shortcuts

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