//---------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright (C)2007 DarkWynter Studios. All rights reserved.
//
//---------------------------------------------------------------------------------------------------------------------------------------------------
// {Contact : darkwynter.com for licensing information
//---------------------------------------------------------------------------------------------------------------------------------------------------
namespace DarkWynter.App.ChallengeSet
{
#region Using Statements
using System;
using System.Collections.Generic;
using System.Collections;
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;
public Dictionary arrowPositions = new Dictionary();
public Dictionary dictionary = new Dictionary();
// G2L Dialogue counter
public List challengeDialogue = new List();
// G2L Dialogue counter
public int dialogueCounter = 0;
public int dialogueMax = 0;
public int radius = 2;
// Scaffolding code for the problem 1 set
public string challengeSource =
@"
using System;
class Test
{
public static void MyFunction()
{
// Insert student code here
}
}";
// 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
///
/// 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(string studentOutput)
{
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
///
/// 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
}
}