Example #1
0
 public Form1()
 {
     InitializeComponent();
     AgentIgra = false;
     KB = new KnowledgeBase(4, 4, 1, 3, WW.Breeze, WW.Stench, WW.Glitter);
     this.WW.Focus();
     WW.Invalidate();
     GamesPlayed = 0;
     GamesWon = 0;
     Uspjesnost = 0;
     UkupnaUspjesnost = 0;
     WW.GotFocus += WW_GotFocus;
     WW.LostFocus += WW_LostFocus;
     WW.AgentMoved += WW_AgentMoved;
     WW.GoldFoundEH += WW_GoldFoundEH;
 }
Example #2
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            AgentIgra = false;
            Uspjesnost = 0;
            this.SuspendLayout();
            this.splitContainer1.Panel2.AutoScrollPosition = new Point(0, 0);
            this.btnCreate.Enabled = false;
            this.btnKorak.Enabled = false;
            this.btnOdigraj.Enabled = false;
            this.Message.Text = "Please wait...";
            this.lblUspjesnost.Text = "0";
            this.splitContainer1.Panel2.Controls.Remove(this.WW);
            this.ResumeLayout(true);
            this.PerformLayout();

            this.WW.Reset(
                (int)Sirina.Value,
                (int)Visina.Value,
                (int)WumpusCount.Value,
                (int)HoleCount.Value);
            KB = new KnowledgeBase(
                (int)Sirina.Value,
                (int)Visina.Value,
                (int)WumpusCount.Value,
                (int)HoleCount.Value,
                WW.Breeze,
                WW.Stench,
                WW.Glitter);

            this.SuspendLayout();
            this.splitContainer1.Panel2.Controls.Add(this.WW);
            this.WW.Focus();
            this.splitContainer1.Panel2.AutoScrollPosition =
                new Point(0, WW.SquareDimension * WW.Columns);
            this.Message.Text = "Use WSAD or arrow keys to move.";
            this.btnCreate.Enabled = true;
            this.btnKorak.Enabled = true;
            this.btnOdigraj.Enabled = true;
            this.ResumeLayout();
            this.PerformLayout();
        }