Exemplo n.º 1
0
        private void OpenKIFFile(string kifFilePath)
        {
            KIFFilePath = kifFilePath;
            mruManager.AddRecentFile(KIFFilePath);
            GeneralGameManager = new GeneralGameManager(KIFFilePath, 10, 10, Properties.Settings.Default.WcfSvcHostExecutable, Properties.Settings.Default.TempFilePath)
            {
                StartNextMoveEvent = startNextTurnEvent, PrevMoveEvent = prevTurnEvent
            };
            GeneralGame.UseOldWayOfGeneratingAndApplyingMoves =
                useOriginalMoveGenerationAndApplicationToolStripMenuItem.Checked;

            playerToolStripMenuItem.DropDownItems.Clear();
            int playerOutputWindowX    = 0;
            int playerOutputWindowY    = htmlOutputForm.Location.Y + htmlOutputForm.Height;
            int playerOutputFormWidth  = (this.ClientRectangle.Width - 5) / (GeneralGameManager.TheGeneralGame.FindRoles().Count() == 0 ? 1 : GeneralGameManager.TheGeneralGame.FindRoles().Count());
            int playerOutputFormHeight = this.ClientRectangle.Height - 25 - this.statusStrip1.Height - managerOutputForm.Height - htmlOutputForm.Height - (2 * SystemInformation.HorizontalScrollBarHeight);
            int playerFormCount        = 0;

            foreach (string role in GeneralGameManager.TheGeneralGame.FindRoles())
            {
                var playerOutputForm = new Form()
                {
                    MdiParent     = this,
                    Text          = role,
                    StartPosition = FormStartPosition.Manual,
                    Location      = new Point(playerOutputWindowX, playerOutputWindowY),
                    Width         = playerOutputFormWidth,
                    Height        = playerOutputFormHeight,
                    Tag           = PlayerWindowConfigStringPrefix + playerFormCount
                };
                var playerOutputTextBox = new TextBox()
                {
                    Dock = DockStyle.Fill, Multiline = true, ScrollBars = ScrollBars.Both
                };
                playerOutputForm.Controls.Add(playerOutputTextBox);
                DebugAndTraceHelper.AddListener(new TextboxTraceListener(playerOutputTextBox), role);
                playerOutputWindowX += playerOutputForm.Bounds.Width;
                WindowGeometryPersistence.SetFormsGeometry(Properties.Settings.Default.WindowGeometry, playerOutputForm);
                playerOutputForm.Show();
                outputForms.Add(playerOutputForm);

                var mi = new ToolStripMenuItem(role);
                playerToolStripMenuItem.DropDownItems.Add(mi);

                var submi = new ToolStripMenuItem("Query Player Prolog Engine");
                mi.DropDownItems.Add(submi);
                submi.Click += (o, k) =>
                {
                    var dialog = new PrologQuery(GeneralGameManager.Players.Where(n => n.Role == role).First().GetPrologEngine());
                    dialog.Show(this);
                };

                playerFormCount++;
            }

            startGameToolStripMenuItem.Enabled = true;

            saveCollapsedParseTreesToolStripMenuItem.Enabled = true;
            saveParseTreesToolStripMenuItem.Enabled          = true;
            saveHornClausesToolStripMenuItem.Enabled         = true;

            queryGamePrologEngineToolStripMenuItem.Enabled       = true;
            dumpPrologEngineUserClausesToolStripMenuItem.Enabled = true;
        }
Exemplo n.º 2
0
        private void queryGamePrologEngineToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var dialog = new PrologQuery(GeneralGameManager.TheGeneralGame.PrologEngine);

            dialog.Show(this);
        }