Example #1
0
        private static void playGame(MemoryList list, string filename, bool dumpOnly)
        {
            try
            {
                list.Load(filename);
            }
            catch (Exception e)
            {
                Console.WriteLine("ERROR: " + e.Message);
                return;
            }

            if (dumpOnly)
            {
                list.Dump();
                return;
            }

            list.Begin();
            while (list.HasMoreValues)
            {
                Console.Write(list.GetNextChallenge() + ": ");
                string guess = Console.ReadLine().Trim();

                if (!list.TryResponse(guess))
                {
                    Console.WriteLine("!!!WRONG!!! - " + list.LastRightAnswer);
                }
            }

            Console.WriteLine("-------------------------------------");
            Console.WriteLine(list.Correct + "/" + list.Total + " (" + (100 * list.Correct / list.Total) + "%)");
            Console.WriteLine("-------------------------------------");
        }
Example #2
0
        //TODO: encapsulate this better
        private static void processPlayStyle(object menu, object choice)
        {
            Configuration config = (Configuration)choice;

            MemoryList list = new MemoryList();

            list.Order    = config.Order;
            list.Polarity = config.Polarity;
            playGame(list, ((PlayStyleMenu)menu).ListFile, config.DumpOnly);
        }