Package org.eu.zajc.akiwrapper
Interface Akiwrapper
- All Known Implementing Classes:
AkiwrapperImpl
public interface Akiwrapper
The "core" of interaction with the Akinator's API.
Akinator is a 20 questions-type game, which means that the computer algorithmically tries to figure out (using
The library is typically used in the following loop:
An example of this library in action can be viewed in the
Akinator is a 20 questions-type game, which means that the computer algorithmically tries to figure out (using
Guesses) what character,
object, or movie the player is thinking about by asking Questions and
getting Akiwrapper.Answers. This library interfaces with Akinator's online API and
does not run the ranking algorithm locally.The library is typically used in the following loop:
- An
Akiwrapperobject is constructed usingAkiwrapperBuilder - A
QueryfromgetCurrentQuery()is displayed to the user. - The program decides based on the type of the
Query: -
- If it's a
Guess, it's shown to the user and responded to with eitherGuess.confirm()orGuess.reject(). Confirming a guess is the lose condition and ends the game. - If it's a
Question, it's shown to the user and responded to with eitherQuestion.answer(Answer)orQuestion.undoAnswer(). - If it's
null, Akinator has no more queries. This is the win condition.
- If it's a
Question.answer(Answer), Question.undoAnswer(), etc.) or from
getCurrentQuery(). Keep in mind that you can't respond to the same query
more than once.An example of this library in action can be viewed in the
examples/
directory of the repository.- Author:
- Marko Zajc
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumAn enum used to represent an answer to Akinator's question.static enumstatic enumRepresents the theme (sometimes called subject) of the game. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether or not Akinator has been instructed to filter out explicit content.
This can be configured inAkiwrapperBuilder.setFilterProfanity(boolean).Returns the currentQuery.Returns theAkiwrapper.Languageused.getTheme()Returns theAkiwrapper.Themeused.default booleanDeprecated, for removal: This API element is subject to removal in a future version.
-
Method Details
-
getCurrentQuery
Returns the currentQuery. This will contain the initialQueryafter theAkiwrapperinstance is constructed, and will get updated as Queries are responded to - theQueryreturned by interaction methods (Question.answer(Answer),Question.undoAnswer(), etc.) will be the same as theQueryreturned by this method.
After the game ends, either by reaching question 80 or by confirming aGuess, this will returnnull- Returns:
- the current
Queryornullif the game has ended.
-
getLanguage
Returns theAkiwrapper.Languageused. Akinator returns localizedQueryobjects.- Returns:
- the language.
-
getTheme
Returns theAkiwrapper.Themeused. Akinator returns different kinds ofQuestions andGuesses depending by this.- Returns:
- server's guess type.
-
doesFilterProfanity
boolean doesFilterProfanity()Returns whether or not Akinator has been instructed to filter out explicit content.
This can be configured inAkiwrapperBuilder.setFilterProfanity(boolean).- Returns:
- whether the profanity filter is enabled.
-
isExhausted
Deprecated, for removal: This API element is subject to removal in a future version.Check ifgetCurrentQuery()isnullinsteadReturns if the game has ended, which occurs after answering 80Questions or callingGuess.confirm().
Sending or undoing answers can no longer be done after the game has ended.- Returns:
- whether the game has ended.
-
getCurrentQuery()isnullinstead