hedwig_trivia v0.1.0 HedwigTrivia.Logic View Source
A home for the business logic of fetching/answering questions.
Link to this section Summary
Functions
Build up the full response from the category, value, and question
Given a guess, return a string representing a response from the bot[]
Determine if the user-supplied guess matches the answer.
Given a guess, return a string representing a response from the bot[]
Fetch a new question if need be, but return a state with the correct game information.
Mark the question as answered and return the game state so the answer can be revelead
Link to this section Types
Link to this section Functions
compose_full_question(map)
View Sourcecompose_full_question(HedwigTrivia.GameState.t()) :: String.t()
Build up the full response from the category, value, and question
Given a guess, return a string representing a response from the bot[]
guess(state, guess)
View Sourceguess(HedwigTrivia.GameState.t(), String.t()) :: {:ok | :error | :already_answered, HedwigTrivia.GameState.t()}
Determine if the user-supplied guess matches the answer.
Given a guess, return a string representing a response from the bot[]
question(state, bool)
View Sourcequestion(HedwigTrivia.GameState.t(), force_new()) :: {:ok | :error | :not_answered, HedwigTrivia.GameState.t()}
Fetch a new question if need be, but return a state with the correct game information.
solution(state)
View Sourcesolution(HedwigTrivia.GameState.t()) :: {:ok | :error, HedwigTrivia.GameState.t()}
Mark the question as answered and return the game state so the answer can be revelead