Revert "Removing byte order...
Dev Ghai authored 11 years ago
|
1) //#define DEVELOPING
2)
3) using System;
4) using System.Collections.Generic;
5) using System.IO;
6) using System.Diagnostics;
7)
8) namespace Boggle
9) {
10) public class Boggle
11) {
12) static void PrintWords(HashSet<WordOnBoard> words)
13) {
14) int score = 0;
15) foreach (WordOnBoard word in words)
16) {
17) Console.Write("{0} [{1}], ", word.Word, word.Score);
18) score += word.Score;
19) }
20) Console.WriteLine("\n\nTotal score for this board: {0}", score);
21) }
22) static void Main(string[] args)
23) {
24) Stopwatch st = new Stopwatch();
25) BoggleList bl = new BoggleList();
26) Console.WriteLine("Current directory: {0}", Directory.GetCurrentDirectory());
27) #if !DEVELOPING
28) string input;
29) bool isError = false;
30) #endif
31) int boardSideLength = 3;
32) int minWordLength = 4;
33)
34) char wordListInput = 'Z';
35) BoggleLists listToUseForLookup;
36)
37) #if !DEVELOPING
38) do
39) {
40) isError = false;
41) Console.WriteLine("Please enter the word list that you wish to use [Z for Zingarelli, T for TWS or standard scrabble list]: ");
42) input = Console.ReadLine();
43) if (!char.TryParse(input, out wordListInput))
44) {
45) Console.WriteLine("Invalid Input. Couldn't parse character");
46) isError = true;
47) }
48) wordListInput = char.ToUpper(wordListInput);
49) if (wordListInput != 'T' && wordListInput != 'Z')
50) {
51) Console.WriteLine("Please enter only T or Z.");
52) isError = true;
53) }
54) } while (isError);
55) #endif
56) switch (wordListInput)
57) {
58) case 'T':
59) listToUseForLookup = BoggleLists.TWS;
60) break;
61)
62) case 'Z':
63) listToUseForLookup = BoggleLists.ZINGARELLI;
64) break;
65) default:
66) throw new Exception("Unexpected!!");
67) }
68)
69) #if !DEVELOPING
70) do
71) {
72) isError = false;
73) Console.WriteLine("Please enter number of tiles that make up one side of the board: ");
74) input = Console.ReadLine();
|