类 BoggleBoard


  • public class BoggleBoard
    extends Object
    • 构造器概要

      构造器 
      构造器 说明
      BoggleBoard()
      Initializes a random 4-by-4 board, by rolling the Hasbro dice.
      BoggleBoard​(char[][] a)
      Initializes a board from the given 2d character array, with 'Q' representing the two-letter sequence "Qu".
      BoggleBoard​(int m, int n)
      Initializes a random m-by-n board, according to the frequency of letters in the English language.
      BoggleBoard​(String filename)
      Initializes a board from the given filename.
    • 构造器详细资料

      • BoggleBoard

        public BoggleBoard()
        Initializes a random 4-by-4 board, by rolling the Hasbro dice.
      • BoggleBoard

        public BoggleBoard​(String filename)
        Initializes a board from the given filename.
        参数:
        filename - the name of the file containing the Boggle board
      • BoggleBoard

        public BoggleBoard​(int m,
                           int n)
        Initializes a random m-by-n board, according to the frequency of letters in the English language.
        参数:
        m - the number of rows
        n - the number of columns
      • BoggleBoard

        public BoggleBoard​(char[][] a)
        Initializes a board from the given 2d character array, with 'Q' representing the two-letter sequence "Qu".
        参数:
        a - the 2d character array
    • 方法详细资料

      • rows

        public int rows()
        Returns the number of rows.
        返回:
        number of rows
      • cols

        public int cols()
        Returns the number of columns.
        返回:
        number of columns
      • getLetter

        public char getLetter​(int i,
                              int j)
        Returns the letter in row i and column j, with 'Q' representing the two-letter sequence "Qu".
        参数:
        i - the row
        j - the column
        返回:
        the letter in row i and column j with 'Q' representing the two-letter sequence "Qu".
      • toString

        public String toString()
        Returns a string representation of the board, replacing 'Q' with "Qu".
        覆盖:
        toString 在类中 Object
        返回:
        a string representation of the board, replacing 'Q' with "Qu"
      • main

        public static void main​(String[] args)
        Unit tests the BoggleBoard data type.