程序包 Hangman
类 Hangman
- java.lang.Object
-
- Hangman.Hangman
-
public class Hangman extends java.lang.ObjectThis class is the main class that implements the traditional and evil version of hangmangame- 作者:
- Kevin Long
-
-
字段概要
字段 修饰符和类型 字段 说明 (专用程序包) java.lang.StringguessedChars(专用程序包) java.util.Map<java.lang.Integer,java.lang.Integer>selectFrequency(专用程序包) java.util.Map<java.lang.Integer,java.lang.Boolean>selectOrNot(专用程序包) java.util.Map<java.lang.Integer,java.lang.Character>selectPrint(专用程序包) java.util.ArrayList<java.lang.String>testSet(专用程序包) intwordLength
-
构造器概要
构造器 构造器 说明 Hangman(java.util.ArrayList<java.lang.String> words, int wordLength)Create a constructor of Hangman Game
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 intgetMaxFrequency()This method gets the maximum frequency for the mapbooleanguessAll()Check if all positions in a word are guessedjava.lang.Stringprint()This method print the word based on the state of the word being guessed or notvoidreInitialize()This method initialize the word frequency mapvoidremindRepeatance(char a)This method record the character that are recorded and check if user has typed a character that has been typedvoidupdateMap(char a)This method uses the guessed char to divide groups of words in the word group by updating the word frequency mapjava.util.ArrayList<java.lang.Integer>updatePosition(char a)This method updates the Map pair based on maxfrequencyvoidupdatePrint(char a)This method update print method and select method
-
-
-
字段详细资料
-
testSet
java.util.ArrayList<java.lang.String> testSet
-
wordLength
int wordLength
-
guessedChars
java.lang.String guessedChars
-
selectOrNot
java.util.Map<java.lang.Integer,java.lang.Boolean> selectOrNot
-
selectPrint
java.util.Map<java.lang.Integer,java.lang.Character> selectPrint
-
selectFrequency
java.util.Map<java.lang.Integer,java.lang.Integer> selectFrequency
-
-
方法详细资料
-
updateMap
public void updateMap(char a)
This method uses the guessed char to divide groups of words in the word group by updating the word frequency map- 参数:
a-
-
getMaxFrequency
public int getMaxFrequency()
This method gets the maximum frequency for the map- 参数:
a-
-
updatePosition
public java.util.ArrayList<java.lang.Integer> updatePosition(char a)
This method updates the Map pair based on maxfrequency- 参数:
a-
-
updatePrint
public void updatePrint(char a)
This method update print method and select method- 参数:
a-
-
reInitialize
public void reInitialize()
This method initialize the word frequency map
-
remindRepeatance
public void remindRepeatance(char a)
This method record the character that are recorded and check if user has typed a character that has been typed- 参数:
a-
-
guessAll
public boolean guessAll()
Check if all positions in a word are guessed- 返回:
-
print
public java.lang.String print()
This method print the word based on the state of the word being guessed or not
-
-