1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* IC 312 Fall 2015
 * Project 2 starter code
 */
 
import java.util.Queue;
 
public class OnePlayer{
  /** Runs a one-player game (computer only), for speed.
   * If there are no command-line arguments, a fresh board is generated.
   * Otherwise, the first command-line argument is a seed value for the
   * random number generator.
   */
  public static void main(String[] args) {
    Board game;
    long start = System.nanoTime();
 
    if (args.length > 0) game = new Board(Long.parseLong(args[0]));
    else game = new Board();
    System.out.println(game);
 
    Queue<String> words = game.allWords();
    for (String word : words) System.out.println(word);
    System.out.println(Board.countPoints(words) + " points");
 
    long elapsed = System.nanoTime() - start;
    System.out.println((elapsed/1.0e9) + " seconds");
  }
}