コード例 #1
0
ファイル: Program.cs プロジェクト: gmcdonald73/holdem-bots
        static void Main(string [] args)
        {
            bool bGraphicsDisplay = false;

            try
            {
                string sConfigFile;

                if (args.Length > 0)
                {
                    sConfigFile = args[0];
                }
                else
                {
                    sConfigFile = "HoldemConfig.xml";
                }

                var sOutputBase = Path.GetFileNameWithoutExtension(sConfigFile);

                int numGames = 1;

                if (args.Length > 1)
                {
                    if (!Int32.TryParse(args[1], out numGames))
                    {
                        numGames = 1;
                    }
                }

                int gameNum = 0;

                while (gameNum < numGames)
                {
                    var prog = new Program();

                    prog.PlayGame(sConfigFile, sOutputBase + "." + gameNum);
                    bGraphicsDisplay = prog.GraphicsDisplay();

                    Logger.Close();
                    TimingLogger.Close();
                    gameNum++;
                }
            }
            catch (Exception e)
            {
                var sExceptionMessage = "EXCEPTION : " + e + "\nPlease send gamelog.txt to [email protected]";
                Console.WriteLine(sExceptionMessage);
            }
            finally
            {
                Logger.Close();
                TimingLogger.Close();

                if (bGraphicsDisplay)
                {
                    Console.SetCursorPosition(0, 0);
                }

                Console.WriteLine("-- press any key to exit --");
                Console.ReadKey();
            }
        }