Example #1
0
        private Rack ReadRack(IList <char> list, Player current)
        {
            string newRack = null;

            while (!Rack.Check(newRack))
            {
                using (DisposableColor.Prompt)
                    Console.Write("rack? ");
                if (list.Count > 0)
                {
                    Console.Write("[");
                    using (PlayerScore.GetCurrentColor(current))
                        Console.Write(new string(list.ToArray()));
                    Console.Write("] ");
                }
                using (PlayerScore.GetCurrentColor(current))
                    newRack = GetNewRack(graph, list, ReadLine());
            }
            using (new DisposableColor(ConsoleColor.White))
                Console.Write("rack:");
            using (PlayerScore.GetCurrentColor(current))
                Console.WriteLine(" " + newRack);
            Console.WriteLine();
            return(new Rack(newRack));
        }
Example #2
0
        public void TestAppend(string current, string append, bool ok)
        {
            var graph = WordGraph.French;
            var list  = new List <char>();

            list.AddRange(current);
            string rack = Shell.GetNewRack(graph, list, append);

            Assert.AreEqual(ok, Rack.Check(rack));
        }
Example #3
0
        public void TestGetNewRackRandom(string current)
        {
            var graph = WordGraph.French;
            var list  = new List <char>();

            list.AddRange(current);
            string rack = Shell.GetNewRack(graph, list, "*");

            Assert.IsTrue(Rack.Check(rack));
        }
Example #4
0
 public void TestCheck(string value)
 {
     Assert.IsFalse(Rack.Check(value));
 }