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 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:
  1. An Akiwrapper object is constructed using AkiwrapperBuilder
  2. A Query from getCurrentQuery() is displayed to the user.
  3. The program decides based on the type of the Query:
Queries can either be retrieved from return values of interaction methods (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
  • Method Details

    • getCurrentQuery

      @Nullable Query getCurrentQuery()
      Returns the current Query. This will contain the initial Query after the Akiwrapper instance is constructed, and will get updated as Queries are responded to - the Query returned by interaction methods (Question.answer(Answer), Question.undoAnswer(), etc.) will be the same as the Query returned by this method.
      After the game ends, either by reaching question 80 or by confirming a Guess, this will return null
      Returns:
      the current Query or null if the game has ended.
    • getLanguage

      @Nonnull Akiwrapper.Language getLanguage()
      Returns the Akiwrapper.Language used. Akinator returns localized Query objects.
      Returns:
      the language.
    • getTheme

      @Nonnull Akiwrapper.Theme getTheme()
      Returns the Akiwrapper.Theme used. Akinator returns different kinds of Questions and Guesses 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 in AkiwrapperBuilder.setFilterProfanity(boolean).
      Returns:
      whether the profanity filter is enabled.
    • isExhausted

      @Deprecated(since="2.0", forRemoval=true) default boolean isExhausted()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Check if getCurrentQuery() is null instead
      Returns if the game has ended, which occurs after answering 80 Questions or calling Guess.confirm().
      Sending or undoing answers can no longer be done after the game has ended.
      Returns:
      whether the game has ended.