//--------------------------------------------------------------------------------------------------------------------------------------------------- // ChallengeAbstract class // Parent class for all Challenges in the game, allows us to have a Challenge List in the CompilerControl class, as well // as providing base functionality that can be overriden in the Challenge classes //--------------------------------------------------------------------------------------------------------------------------------------------------- // Engineered by: Amanda Chaffin //--------------------------------------------------------------------------------------------------------------------------------------------------- namespace DarkWynter.App.ChallengeSet { #region Using Statements using System; using System.Collections.Generic; using System.Text; using System.ComponentModel; using System.Data; using System.Drawing; using System.Windows.Forms; using System.Xml; using DarkWynter.Engine.Globals; using DarkWynter.Engine.Utilities; using Microsoft.Xna.Framework; using System.Diagnostics; #endregion /// /// Abstract class for the Challenge sets /// public class ChallengeAbstract { public int id; // G2L Dialogue counter public List challengeDialogue = new List(); // G2L Dialogue counter public int dialogueCounter = 0; public int dialogueMax = 0; #region Scaffolding code for the challenge public string challengeSource = @" using System; class Test { public static void MyFunction() { // Insert student code here } }"; #endregion // Output variable to catch the Console redirect public string outputSource = ""; // Shared timer for the terrain mod based off of student code public int terrainTimer = 1000; /// /// Finds the number needed for the dialogue counter /// /// Count public ChallengeAbstract(XmlNode problemNode) { dialogueMax = problemNode.ChildNodes.Count; } #region Virtual Functions /// /// Gets the scaffolding code /// /// challengeSource public virtual string GetScaffolding() { return challengeSource; } /// /// Parser for the student code - checks to insure code input matches required outputs /// /// Inputted Code /// Compiler output /// bool public virtual bool ValidateStudentCode(string studentCode, string studentOutput) { return true; } /// /// Runs the vis and resets the dialogue counter /// /// bool public virtual bool RunVizualization() { dialogueCounter = 0; return true; } #endregion #region Utility Functions /// /// Calls the terrainmod function in majikwand /// /// Request public void NonControllerBasedTerrainMod(TerrainModRequest request) { DarkWynter.Engine.Controllers.GameController.NonControllerBasedTerrainMod(request); } /// /// Sets the exp points for each challenge /// Allows for experience to be added for the players to guage their progress /// /// bool public virtual bool setExpPoints() { // Update G2L experience points if (Statics_Engine.GameSettings.triesNumber < Statics_Engine.GameSettings.sMRows) { Statics_Engine.GameSettings.experiencePoints += Statics_Engine.GameSettings.scoringMetric[ Statics_Engine.GameSettings.triesNumber, Statics_Engine.GameSettings.currentChallengeNumber ]; Statics_Engine.GameSettings.triesNumber = 0; } else { Statics_Engine.GameSettings.experiencePoints += 0; } return true; } #endregion } }