Interface Guess
- All Superinterfaces:
Query
- All Known Implementing Classes:
GuessImpl
A representation of Akinator's guess. Guesses are either confirmed with
Note: A single
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 TypeMethodDescriptionvoidconfirm()Returns the description of this subject.getId()Returns this guess' ID.default longReturns this guess' ID as along.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).getName()Returns the name of the guessed subject.Returns the pseudonym or alternative name of the guessed subject.reject()Methods inherited from interface org.eu.zajc.akiwrapper.core.entities.Query
getAkiwrapper, getProgression, getStep
-
Method Details
-
confirm
void confirm()This is an interaction method forGuess.
Confirms theGuess. 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 singleGuessobject can only be interacted with once. Callingconfirm()orreject()mutates the session state, so you can only call one of them once.- Throws:
IllegalStateException- if thisQuestionis not the same asAkiwrapper.getCurrentQuery(), which happens if you attempt to interact with it twice.- See Also:
-
reject
This is an interaction method forGuess.
Rejects theGuessand provides the nextQuery. If the next query is a question, it will have the same step as the previous one, but different text.
Note: Rejecting aGuessdoes not mean the API won't propose it again. That happens quite often, in fact.
Note: A singleGuessobject can only be interacted with once. Callingconfirm()orreject()mutates the session state, so you can only call one of them once.- Returns:
- the next
Queryornullif there are none left. - Throws:
IllegalStateException- if thisQuestionis not the same asAkiwrapper.getCurrentQuery(), which happens if you attempt to interact with it twice.ServerStatusException- if the API server returns an erroneousObjectInputFilter.Status.AkinatorException- if something else goes wrong during the API call.
-
getName
Returns the name of the guessed subject. This is localized to theAkiwrapper.Languageand in line with theAkiwrapper.Themeset in theAkiwrapperBuilder.- Returns:
- the guessed subject's name.
-
getPseudonym
Returns the pseudonym or alternative name of the guessed subject. As a pseudonym is optional, this may benull. Please note that the pseudonym is sometimes set to a placeholder value such as "X" or "-" rather thannull. This is localized to theAkiwrapper.Languageand in line with theAkiwrapper.Themeset in theAkiwrapperBuilder.- Returns:
- the guessed subject's pseudonym.
-
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 theAkiwrapper.Languageand in line with theAkiwrapper.Themeset in theAkiwrapperBuilder.- Returns:
- the guessed subject's description.
-
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
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 along. 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:
-