|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectLectureGame.GameMode.EliminationMode
public class EliminationMode
Created by IntelliJ IDEA. User: olekrst Date: 22.feb.2007 Time: 16:25:20 The elimination mode is a game mode where the partisipants all compete against eachother. As soon as a player answers a question wrong, shes out ouf the round. The round continiues until a) one player is left b) all players are dead c) all questions are depleted Clients logged in after the round has started (i.e. the first question has been posed) cannot partisipate until the round is over (this is by design). It is therefor not recommended to have this gamemode in the very first round. For method descriptions, see the GameMode interface
GameMode
Field Summary | |
---|---|
private Question |
currentQuestion
|
private DataBaseConnection |
db
|
private NetworkManager |
manager
|
private int |
maxScorePerQuestion
|
private NetworkConnectionKeeper |
netKeeper
|
private int |
partisipantsLeft
|
private int |
questionIndex
|
private Question[] |
questionList
|
private int |
questionState
|
private int |
roundID
|
private java.util.ArrayList<StudentClient> |
roundPartisipants
|
private java.util.ArrayList<StudentClient> |
survivors
|
Constructor Summary | |
---|---|
EliminationMode(NetworkConnectionKeeper netKeeper)
|
Method Summary | |
---|---|
int |
checkAns(java.lang.String answer,
StudentClient c)
Checks the answer from the studentclients and returns an int depending on what is expected from the gamemode. |
java.lang.String |
createClientQuestion()
Uses the current question in the round and formats it for sending to the student clients |
java.lang.String |
createMasterQuestion()
Formats a question for sending to the master client. |
int |
getMaxScore()
Returns the maximum possible score per question |
int |
getQuestionState()
Returns an integer referencing the question state in the LG constants class |
java.lang.String |
handleClientQuestionReply(int score,
int roundScore,
int totalPossibleScore)
Formats the results of the question answers from the studentclients |
java.lang.String |
handleEndOfRound()
Formats an end of round string for sending to the masterclient |
java.lang.String |
handleQuestionReply()
Method for creating the reply string which is sendt to the masterclient. |
void |
initiateRound()
Extracts all the questions from the current round from the database |
Question |
nextQuestion()
Iterates to the the next question in the round. |
void |
setQuestionState(int s)
Sets the state of the current question to the state given as an argument. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private NetworkManager manager
private Question currentQuestion
private Question[] questionList
private DataBaseConnection db
private int questionIndex
private int roundID
private int questionState
private int maxScorePerQuestion
private NetworkConnectionKeeper netKeeper
private java.util.ArrayList<StudentClient> survivors
private java.util.ArrayList<StudentClient> roundPartisipants
private int partisipantsLeft
Constructor Detail |
---|
public EliminationMode(NetworkConnectionKeeper netKeeper)
Method Detail |
---|
public Question nextQuestion()
GameMode
nextQuestion
in interface GameMode
Question
public java.lang.String createMasterQuestion()
GameMode
createMasterQuestion
in interface GameMode
public java.lang.String createClientQuestion()
GameMode
createClientQuestion
in interface GameMode
StudentClient
,
Question
public void initiateRound()
GameMode
initiateRound
in interface GameMode
DataBaseConnection
public int getMaxScore()
GameMode
getMaxScore
in interface GameMode
Question
public java.lang.String handleClientQuestionReply(int score, int roundScore, int totalPossibleScore)
GameMode
handleClientQuestionReply
in interface GameMode
score
- the score received from answering the last questionroundScore
- total score in the current roundtotalPossibleScore
- overall score
public int checkAns(java.lang.String answer, StudentClient c)
GameMode
checkAns
in interface GameMode
answer
- the answer index represented by a stringc
- the client which replied
public int getQuestionState()
GameMode
getQuestionState
in interface GameMode
LG
public void setQuestionState(int s)
GameMode
setQuestionState
in interface GameMode
s
- question state (see LG constants class)LG
public java.lang.String handleQuestionReply()
GameMode
handleQuestionReply
in interface GameMode
public java.lang.String handleEndOfRound()
GameMode
handleEndOfRound
in interface GameMode
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |