Interface Guess

All Superinterfaces:
Query
All Known Implementing Classes:
GuessImpl

public interface Guess extends Query
A representation of Akinator's guess. Guesses are either confirmed with confirm() or rejected with reject(). Rejecting a guess returns the next question (which will have the same step), while confirming it ends the game.
Note: A single Guess object can only be interacted with once. Calling confirm() or reject() mutates the session state, so you can only call one of them once.
Author:
Marko Zajc
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    This is an interaction method for Guess.
    Confirms the Guess.
    Returns the description of this subject.
    Returns this guess' ID.
    default long
    Returns this guess' ID as a long.
    Returns the URL to an image of this subject, which can be a placeholder image (https://photos.clarinea.fr/BL_1_fr/none.jpg).
    Returns the name of the guessed subject.
    Returns the pseudonym or alternative name of the guessed subject.
    This is an interaction method for Guess.
    Rejects the Guess and provides the next Query.

    Methods inherited from interface org.eu.zajc.akiwrapper.core.entities.Query

    getAkiwrapper, getProgression, getStep
  • Method Details

    • confirm

      void confirm()
      This is an interaction method for Guess.
      Confirms the Guess. This ends the session and likely affects Akinator's algorithm to associate the taken answer route with the confirmed guess, improving the guessing algorithm.
      Note: A single Guess object can only be interacted with once. Calling confirm() or reject() mutates the session state, so you can only call one of them once.
      Throws:
      IllegalStateException - if this Question is not the same as Akiwrapper.getCurrentQuery(), which happens if you attempt to interact with it twice.
      See Also:
    • reject

      @Nullable Query reject()
      This is an interaction method for Guess.
      Rejects the Guess and provides the next Query. If the next query is a question, it will have the same step as the previous one, but different text.
      Note: Rejecting a Guess does not mean the API won't propose it again. That happens quite often, in fact.
      Note: A single Guess object can only be interacted with once. Calling confirm() or reject() mutates the session state, so you can only call one of them once.
      Returns:
      the next Query or null if there are none left.
      Throws:
      IllegalStateException - if this Question is not the same as Akiwrapper.getCurrentQuery(), which happens if you attempt to interact with it twice.
      ServerStatusException - if the API server returns an erroneous ObjectInputFilter.Status.
      AkinatorException - if something else goes wrong during the API call.
    • getName

      @Nonnull String getName()
      Returns the name of the guessed subject. This is localized to the Akiwrapper.Language and in line with the Akiwrapper.Theme set in the AkiwrapperBuilder.
      Returns:
      the guessed subject's name.
    • getPseudonym

      @Nullable String getPseudonym()
      Returns the pseudonym or alternative name of the guessed subject. As a pseudonym is optional, this may be null. Please note that the pseudonym is sometimes set to a placeholder value such as "X" or "-" rather than null. This is localized to the Akiwrapper.Language and in line with the Akiwrapper.Theme set in the AkiwrapperBuilder.
      Returns:
      the guessed subject's pseudonym.
    • getDescription

      @Nonnull String getDescription()
      Returns the description of this subject. Please note that the description is sometimes set to a placeholder value such as "X" or "-". This is localized to the Akiwrapper.Language and in line with the Akiwrapper.Theme set in the AkiwrapperBuilder.
      Returns:
      the guessed subject's description.
    • getImage

      @Nullable URL getImage()
      Returns the URL to an image of this subject, which can be a placeholder image (https://photos.clarinea.fr/BL_1_fr/none.jpg).
      Returns:
      the guess picture URL.
    • getId

      @Nonnull String getId()
      Returns this guess' ID. ID's are unique to each guess and can be used to track rejected guesses, because Akinator won't do that for you.
      Returns:
      this guess' ID.
      See Also:
    • getIdLong

      default long getIdLong()
      Returns this guess' ID as a long. ID's are unique to each guess and can be used to track rejected guesses, because Akinator won't do that for you.
      Returns:
      this guess' ID as a long.
      See Also: