protected void go() {//when btnGo is button is clicked RtfOutput.Clear(); RtfOutputLineNumbers.Clear(); if (btnGo.Text == "Go!") { errorChecker = new Logic.ErrorChecker(rtfInput.Text, bot, this); if (!errorChecker.HasError) { _showLineNo = true; btnGo.Text = "Reset"; displayAsLog(); interpreter = new Logic.Interpreter(rtfInput.Text, bot, this); bot.CheckForExit(); _attemptNo++; if (_attemptNo > 2) { lblHint.Visible = true; } } else { _showLineNo = false; displayAsError(); } } else { btnGo.Text = "Go!"; CallOnLoad(); } }
//methods below virtual protected void CallOnLoad() {// called when the form is loaded or reset button is pressed //bot.SetPosition is set in the child form RtfOutput.Clear(); RtfOutputLineNumbers.Clear(); DisplayBotLocation(); Walls.Clear(); displayAsLog(); _showLineNo = false; }