Package edu.wisc.game.sql
Class EpisodeInfo
java.lang.Object
edu.wisc.game.sql.Episode
edu.wisc.game.sql.EpisodeInfo
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
Provides some extra information related to the episode's context within the experiment.Nested classes/interfaces inherited from class edu.wisc.game.sql.Episode
Episode.CODE, Episode.Display, Episode.FINISH_CODE, Episode.Move, Episode.OutputMode, Episode.Pick
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic HashMap<String,
EpisodeInfo> Table with all episodes recently played on this server. -
Constructor Summary
ConstructorsConstructorDescriptionDummy episode, used for sending error mesages onlyEpisodeInfo
(Game game, ParaSet _para) -
Method Summary
Modifier and TypeMethodDescriptionvoid
cache()
The main method invoked on a /doMove web API call.Like /doMove, but without a destination (because the game piece was not movable, or because the player just dropped in on the board)dummyDisplay
(int _code, String _errmsg) Shows tHe current board (including dropped pieces, which are labeled as such)int
getGuess()
int
boolean
Has the guess from player 1 (in 2PG) been saved?int
boolean
Has the guess from the player (in 1PG) or from player 0 (in 2PG) been saved?boolean
getGuessSavedBy
(int mover) double
getLastR()
double
For Player 1, in adversarial games onlyint
int
For Player 1, in adversarial games onlyint
int
int
int
int
boolean
isBonus()
lastMove()
static EpisodeInfo
locateEpisode
(String eid) Builds a display to be sent out over the web UIreport()
Concise report, handy for debuggingThe key that can be printed next to reports to help understand themvoid
saveChatToFile
(File f, int mover, String text) #mover,seriesNo,episodeNo,timestamp,textvoid
saveGuessToFile
(File f, String moverPlayerId, String guessText, int confidence) Records the player-provided "guess" to a CSV filevoid
setAllGuessData
(int mover, String text, int confidence) Sets all guess-related fields of this episode for one of the partnersvoid
setBonus
(boolean _bonus) void
setFirstMover
(int _firstMover) void
Sets the guess value, truncating it if necessaryvoid
Sets the guess value, truncating it if necessaryvoid
setGuess1Confidence
(int _guess1Confidence) void
setGuess1Saved
(boolean _guess1Saved) void
setGuessConfidence
(int _guessConfidence) void
setGuessSaved
(boolean _guessSaved) void
setLastR
(double x) void
setLastR1
(double x) void
setLastStretch
(int x) void
setLastStretch1
(int x) void
setPlayer
(PlayerInfo _player) void
setRewardMain
(int x) void
setRewardMain
(int j, int x) void
setRewardMain1
(int x) void
setSeriesNo
(int _seriesNo) void
setXFactor
(int x) void
setXFactor1
(int x) boolean
Our GUI tells the player where all movable pieces are, unless the para set mandates "free" mode.int
Which player made the last recorded move of this episode? (Needed for 2PG only)xgetPara()
Methods inherited from class edu.wisc.game.sql.Episode
accept, doMove, doPick, getEpisodeId, getLastMovePos, getNPiecesStart, getPieces, getStartTime, getVersion, graphicDisplay, graphicDisplay, graphicDisplayAscii, mkDisplay0, onBoard, playGame, positionsOfMoveablePieces, randomWord, setEpisodeId, setNPiecesStart, setStartTime
-
Field Details
-
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
-
-
Method Details
-
getPlayer
-
setPlayer
-
locateEpisode
-
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
-
setGuess
Sets the guess value, truncating it if necessary -
getGuess1
-
setGuess1
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
-
weShowAllMovables
public boolean weShowAllMovables()Our GUI tells the player where all movable pieces are, unless the para set mandates "free" mode.- Overrides:
weShowAllMovables
in classEpisode
-
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
The key that can be printed next to reports to help understand them -
report
Concise report, handy for debugging -
getCurrentBoard
Shows tHe current board (including dropped pieces, which are labeled as such)- Overrides:
getCurrentBoard
in classEpisode
-
mkDisplay
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
-
saveGuessToFile
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
#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
- 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
Sets all guess-related fields of this episode for one of the partners
-