程序包 Hangman

类 Hangman


  • public class Hangman
    extends java.lang.Object
    This class is the main class that implements the traditional and evil version of hangmangame
    作者:
    Kevin Long
    • 字段概要

      字段 
      修饰符和类型 字段 说明
      (专用程序包) java.lang.String guessedChars  
      (专用程序包) 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  
      (专用程序包) int wordLength  
    • 构造器概要

      构造器 
      构造器 说明
      Hangman​(java.util.ArrayList<java.lang.String> words, int wordLength)
      Create a constructor of Hangman Game
    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      int getMaxFrequency()
      This method gets the maximum frequency for the map
      boolean guessAll()
      Check if all positions in a word are guessed
      java.lang.String print()
      This method print the word based on the state of the word being guessed or not
      void reInitialize()
      This method initialize the word frequency map
      void remindRepeatance​(char a)
      This method record the character that are recorded and check if user has typed a character that has been typed
      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
      java.util.ArrayList<java.lang.Integer> updatePosition​(char a)
      This method updates the Map pair based on maxfrequency
      void updatePrint​(char a)
      This method update print method and select method
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 字段详细资料

      • 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
    • 构造器详细资料

      • Hangman

        public Hangman​(java.util.ArrayList<java.lang.String> words,
                       int wordLength)
        Create a constructor of Hangman Game
        参数:
        words -
        wordLength -
    • 方法详细资料

      • 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