Exemple #1
0
        /// <summary>
        /// start a new boggle server ready to accept clients
        /// </summary>
        /// <param name="args">0:timer time 1: dictionary file 3: specific dice</param>
        public static void Main(string[] args)
        {
            if (args.Length >= 2)
            {
                if (args.Length == 3 && Regex.IsMatch(args[2], @"[a-zA-Z]{16}"))
                {
                    specificDice = args[2];
                }

                int tempTime;
                if (int.TryParse(args[0], out tempTime))
                {
                    timePerRound = tempTime;
                }

                WordDictionary = ParseDictionary(args[1]);

                BoggleServer myServer = new BoggleServer(2000);
                Console.ReadLine();
            }

            else
            {
                throw new Exception("Error: Invalid args input");
            }
        }
Exemple #2
0
        /// <summary>
        /// overload for user specified board with preset dice results.
        /// </summary>
        /// <param name="_p1Sock"> player one's socket (ss)</param>
        /// <param name="_p2Sock">player two's socket (ss)</param>
        /// <param name="_time">the game time</param>
        /// <param name="boardLetters">the optional string params for the console running emacs stuff</param>
        public game(BoggleServer _parent, Tuple <StringSocket, string> _p1Sock, Tuple <StringSocket, string> _p2Sock, int _time, string boardLetters)
        {
            parent  = _parent;
            player1 = new player(_p1Sock.Item1, _p1Sock.Item2);
            player2 = new player(_p2Sock.Item1, _p2Sock.Item2);

            time = _time;

            board         = new BoggleBoard(boardLetters);
            secondsTimer  = new Timer(1000);
            common        = new HashSet <string>();
            processingKey = new object();
            StartGame();
        }
Exemple #3
0
        /// <summary>
        /// overload for user specified board with preset dice results.
        /// </summary>
        /// <param name="_p1Sock"> player one's socket (ss)</param>
        /// <param name="_p2Sock">player two's socket (ss)</param>
        /// <param name="_time">the game time</param>
        /// <param name="boardLetters">the optional string params for the console running emacs stuff</param>
        public game(BoggleServer _parent,Tuple<StringSocket, string> _p1Sock, Tuple<StringSocket, string> _p2Sock, int _time, string boardLetters)
        {
            parent = _parent;
            player1 = new player(_p1Sock.Item1, _p1Sock.Item2);
            player2 = new player(_p2Sock.Item1, _p2Sock.Item2);

            time = _time;

            board = new BoggleBoard(boardLetters);
            secondsTimer = new Timer(1000);
            common = new HashSet<string>();
            processingKey = new object();
            StartGame();
        }
Exemple #4
0
        /// <summary>
        /// start a new boggle server ready to accept clients
        /// </summary>
        /// <param name="args">0:timer time 1: dictionary file 3: specific dice</param>
        public static void Main(string[] args)
        {
            if (args.Length >= 2)
            {
                if (args.Length == 3 && Regex.IsMatch(args[2], @"[a-zA-Z]{16}"))
                    specificDice = args[2];

                int tempTime;
                if (int.TryParse(args[0], out tempTime))
                    timePerRound = tempTime;

                WordDictionary = ParseDictionary(args[1]);

                BoggleServer myServer = new BoggleServer(2000);
                Console.ReadLine();
            }

            else
                throw new Exception("Error: Invalid args input");
        }