puzzles

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2024 License: AGPL-3.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePuzzlesFromGame

func CreatePuzzlesFromGame(ctx context.Context, eqLossLimit uint32, req *macondopb.PuzzleGenerationRequest, reqId int, gs gameplay.GameStore, ps PuzzleStore,
	g *entity.Game, authorId string, gt ipc.GameType, multiple bool) ([]*macondopb.PuzzleCreationResponse, error)

func GetJobInfo

func GetJobInfo(ctx context.Context, ps PuzzleStore, genId int) (time.Time, time.Time, time.Duration, *bool, *string, int, int, [][]int, error)

func GetJobInfoString

func GetJobInfoString(ctx context.Context, ps *puzzlesstore.DBStore, genId int) (string, error)

func GetNextClosestRatingPuzzleId

func GetNextClosestRatingPuzzleId(ctx context.Context, ps PuzzleStore, userId string, lexicon string) (string, pb.PuzzleQueryResult, error)

func GetNextPuzzleId

func GetNextPuzzleId(ctx context.Context, ps PuzzleStore, userId string, lexicon string) (string, pb.PuzzleQueryResult, error)

func GetPreviousPuzzleId

func GetPreviousPuzzleId(ctx context.Context, ps PuzzleStore, userId string, puzzleUUID string) (string, error)

func GetPuzzleAnswer

func GetPuzzleAnswer(ctx context.Context, ps PuzzleStore, userId string, puzzleUUID string) (*macondopb.GameEvent, error)

func GetPuzzleJobLogs

func GetPuzzleJobLogs(ctx context.Context, ps PuzzleStore, limit, offset int) ([]*pb.PuzzleJobLog, error)

func GetStartPuzzleId

func GetStartPuzzleId(ctx context.Context, ps PuzzleStore, userId string, lexicon string) (string, pb.PuzzleQueryResult, error)

func SetPuzzleVote

func SetPuzzleVote(ctx context.Context, ps PuzzleStore, userId string, puzzleUUID string, vote int) error

func SubmitAnswer

func SubmitAnswer(ctx context.Context, ps PuzzleStore, userId string, puzzleUUID string,
	userAnswer *ipc.ClientGameplayEvent, showSolution bool) (bool, *bool, *macondopb.GameEvent, string, int32, string, int32, time.Time, time.Time, *entity.SingleRating, *entity.SingleRating, error)

Types

type PuzzleService

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

func NewPuzzleService

func NewPuzzleService(ps PuzzleStore, us user.Store, k, c, td string) *PuzzleService

func (*PuzzleService) GetNextPuzzleId

func (*PuzzleService) GetPuzzle

func (*PuzzleService) GetPuzzleAnswer

func (*PuzzleService) SetPuzzleVote

func (*PuzzleService) SubmitAnswer

type PuzzleStore

type PuzzleStore interface {
	CreateGenerationLog(ctx context.Context, req *pb.PuzzleGenerationJobRequest) (int, error)
	UpdateGenerationLogStatus(ctx context.Context, genId int, fulfilled bool, err error) error
	CreatePuzzle(ctx context.Context, gameID string, turnNumber int32, answer *macondopb.GameEvent, authorID string,
		lexicon string, beforeText string, afterText string, tags []macondopb.PuzzleTag, reqId int, bucketIndex int32) error
	GetStartPuzzleId(ctx context.Context, userId string, lexicon string, ratingKey entity.VariantKey) (string, pb.PuzzleQueryResult, error)
	GetNextPuzzleId(ctx context.Context, userId string, lexicon string) (string, pb.PuzzleQueryResult, error)
	GetNextClosestRatingPuzzleId(ctx context.Context, userId string, lexicon string, ratingKey entity.VariantKey) (string, pb.PuzzleQueryResult, error)
	GetPuzzle(ctx context.Context, userId string, puzzleUUID string) (*macondopb.GameHistory, string, int32, *bool, time.Time, time.Time, *entity.SingleRating, *entity.SingleRating, error)
	GetPreviousPuzzleId(ctx context.Context, userId string, puzzleUUID string) (string, error)
	GetAnswer(ctx context.Context, puzzleUUID string) (*macondopb.GameEvent, string, int32, string, *ipc.GameRequest, *entity.SingleRating, error)
	SubmitAnswer(ctx context.Context, userId string, ratingKey entity.VariantKey, newUserRating *entity.SingleRating,
		puzzleUUID string, newPuzzleRating *entity.SingleRating, userIsCorrect bool, userGaveUp bool) error
	GetAttempts(ctx context.Context, userId string, puzzleUUID string) (bool, bool, int32, *bool, time.Time, time.Time, *entity.SingleRating, *entity.SingleRating, error)
	GetUserRating(ctx context.Context, userId string, ratingKey entity.VariantKey) (*entity.SingleRating, error)
	SetPuzzleVote(ctx context.Context, userId string, puzzleUUID string, vote int) error
	GetJobInfo(ctx context.Context, genId int) (time.Time, time.Time, time.Duration, *bool, *string, int, int, [][]int, error)
	GetPotentialPuzzleGames(ctx context.Context, time1, time2 time.Time, limit int, lexicon string, avoidBots bool) ([]pgtype.Text, error)
	GetJobLogs(ctx context.Context, limit, offset int) ([]*pb.PuzzleJobLog, error)
}

Jump to

Keyboard shortcuts

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