Class EpisodeInfo

java.lang.Object
edu.wisc.game.sql.Episode
edu.wisc.game.sql.EpisodeInfo

@Entity public class EpisodeInfo extends Episode
An EpisodeInfo instance extends an Episode, containing additional information related to it being played as part of an experiment. That includes support for creating an Episode based on a parameter set, and for managing earned reward amount.
  • Field Details

    • globalAllEpisodes

      public static HashMap<String,EpisodeInfo> globalAllEpisodes
      Table with all episodes recently played on this server. It is kept to enable quick lookup of episode by id. FIXME: should purge the table occasionally, to save memory
  • Constructor Details

    • EpisodeInfo

      public EpisodeInfo()
      Dummy episode, used for sending error mesages only
    • EpisodeInfo

      public EpisodeInfo(Game game, ParaSet _para)
  • Method Details

    • getPlayer

      public PlayerInfo getPlayer()
    • setPlayer

      public void setPlayer(PlayerInfo _player)
    • locateEpisode

      public static EpisodeInfo locateEpisode(String eid)
    • cache

      public void cache()
    • isBonus

      public boolean isBonus()
    • setBonus

      public void setBonus(boolean _bonus)
    • getRewardMain

      public int getRewardMain()
    • setRewardMain

      public void setRewardMain(int x)
    • getRewardMain1

      public int getRewardMain1()
    • setRewardMain1

      public void setRewardMain1(int x)
    • setRewardMain

      public void setRewardMain(int j, int x)
    • getSeriesNo

      public int getSeriesNo()
    • setSeriesNo

      public void setSeriesNo(int _seriesNo)
    • getGuessSaved

      public boolean getGuessSaved()
      Has the guess from the player (in 1PG) or from player 0 (in 2PG) been saved?
    • setGuessSaved

      public void setGuessSaved(boolean _guessSaved)
    • getGuess1Saved

      public boolean getGuess1Saved()
      Has the guess from player 1 (in 2PG) been saved?
    • setGuess1Saved

      public void setGuess1Saved(boolean _guess1Saved)
    • getGuessSavedBy

      public boolean getGuessSavedBy(int mover)
      Returns:
      the "guessSaved" fields for a particular player
    • getGuess

      public String getGuess()
    • setGuess

      public void setGuess(String _guess)
      Sets the guess value, truncating it if necessary
    • getGuess1

      public String getGuess1()
    • setGuess1

      public void setGuess1(String _guess1)
      Sets the guess value, truncating it if necessary
    • getGuessConfidence

      public int getGuessConfidence()
    • setGuessConfidence

      public void setGuessConfidence(int _guessConfidence)
    • getGuess1Confidence

      public int getGuess1Confidence()
    • setGuess1Confidence

      public void setGuess1Confidence(int _guess1Confidence)
    • getLastStretch

      public int getLastStretch()
    • setLastStretch

      public void setLastStretch(int x)
    • getLastStretch1

      public int getLastStretch1()
      For Player 1, in adversarial games only
    • setLastStretch1

      public void setLastStretch1(int x)
    • getLastR

      public double getLastR()
    • setLastR

      public void setLastR(double x)
    • getLastR1

      public double getLastR1()
      For Player 1, in adversarial games only
    • setLastR1

      public void setLastR1(double x)
    • getXFactor

      public int getXFactor()
    • setXFactor

      public void setXFactor(int x)
    • getXFactor1

      public int getXFactor1()
    • setXFactor1

      public void setXFactor1(int x)
    • getFirstMover

      public int getFirstMover()
    • setFirstMover

      public void setFirstMover(int _firstMover)
    • xgetPara

      public ParaSet xgetPara()
    • weShowAllMovables

      public boolean weShowAllMovables()
      Our GUI tells the player where all movable pieces are, unless the para set mandates "free" mode.
      Overrides:
      weShowAllMovables in class Episode
    • doMove

      public EpisodeInfo.ExtendedDisplay doMove(String moverPlayerId, int y, int x, int by, int bx, int _attemptCnt) throws IOException
      The main method invoked on a /doMove web API call. Calls Episode.doMove, and then does various adjustments related to this episode's role in the experiment plan. If the player has failed to complete a bonus episode on time, this is the place that sets the "lost" flag.
      Parameters:
      _attemptCnt - According to the client, this is how many /move or /pick calls it has made before this call; so this is how long the transcript of this episode should be.
      playerId - null in single-player games; playerId in 2PG
      Throws:
      IOException
    • doPick

      public EpisodeInfo.ExtendedDisplay doPick(String moverPlayerId, int y, int x, int _attemptCnt) throws IOException
      Like /doMove, but without a destination (because the game piece was not movable, or because the player just dropped in on the board)
      Throws:
      IOException
    • reportKey

      public String reportKey()
      The key that can be printed next to reports to help understand them
    • report

      public String report()
      Concise report, handy for debugging
      Overrides:
      report in class Episode
    • getCurrentBoard

      public Board getCurrentBoard()
      Shows tHe current board (including dropped pieces, which are labeled as such)
      Overrides:
      getCurrentBoard in class Episode
    • mkDisplay

      public EpisodeInfo.ExtendedDisplay mkDisplay(String playerId)
      Builds a display to be sent out over the web UI
      Parameters:
      playerId - This can be null in 1PG, but in 2PG it must identify the player to whom we are to show the display
    • dummyDisplay

      public EpisodeInfo.ExtendedDisplay dummyDisplay(int _code, String _errmsg)
    • saveGuessToFile

      public void saveGuessToFile(File f, String moverPlayerId, String guessText, int confidence)
      Records the player-provided "guess" to a CSV file
      Parameters:
      moverPlayerId - The playerId of the actual player who made the guess. In a 2PG, this is not necessarily the same player who owns the EpisodeInfo instance, because each partner's guess goes into his own file.
    • saveChatToFile

      public void saveChatToFile(File f, int mover, String text)
              #mover,seriesNo,episodeNo,timestamp,text
              
    • whoMadeLastMove

      public int whoMadeLastMove()
      Which player made the last recorded move of this episode? (Needed for 2PG only)
      Returns:
      normally, 0 or 1; if there were no moves, -1
    • lastMove

      public Episode.Pick lastMove()
      Returns:
      The last move of the episode, or null if the episode was empty (no moves, because the para set allowed the player to give up without playing)
    • setAllGuessData

      public void setAllGuessData(int mover, String text, int confidence)
      Sets all guess-related fields of this episode for one of the partners