From addfbcaa1a578f3ae62c06ccb0c63d7fd9c94611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Thu, 5 Jun 2014 11:47:51 +0200 Subject: [PATCH 1/2] Parser gefixed --- src/Parser.cs | 48 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/src/Parser.cs b/src/Parser.cs index cda8da3..cc63d68 100644 --- a/src/Parser.cs +++ b/src/Parser.cs @@ -26,10 +26,17 @@ namespace WorldOfPeacecraft public const string ValueY = "y"; public const string ValueCol = "col"; public const string ValueRow = "row"; - public const string EValueDragon = "DRAGON"; - public const string EValueStagunt = "STAGHUNT"; - public const string EValueSkirmish = "SKIRMISH"; + public const string EValueFight = "FIGHT"; + public const string EValueRest = "REST"; + public const string EValueStag = "STAG"; + public const string EValueBunny = "BUNNY"; + public const string EValueSword = "SWORD"; + public const string EValueMagic = "MAGIC"; + public const string EValueAlchemy = "ALCHEMY"; public const string EValueWalkable = "WALKABLE"; + public const string EValueSkirmish = "SKIRMISH"; + public const string EValueStaghunt = "STAGHUNT"; + public const string EValueDragon = "DRAGON"; public const string EValueWall = "WALL"; public const string EValueForest = "FOREST"; public const string EValueWater = "WATER"; @@ -239,7 +246,7 @@ namespace WorldOfPeacecraft Result r = new Result(round, running, delay); } - private void ProcessOpponent(Block oppBlock) + private void ProcessOpponent (Block oppBlock) { int id = oppBlock.GetIntValue (ValueId); int points = oppBlock.GetIntValue (ValuePoints); @@ -247,14 +254,31 @@ namespace WorldOfPeacecraft LinkedList unnamedValue = oppBlock.GetUnnamedValues (); string stringValue = unnamedValue.First.Value; Decision d; - if (stringValue == EValueDragon) - d = Decision.DRAGON; - else if (stringValue == EValueStagunt) - d = Decision.STAGHUNT; - else if (stringValue == EValueSkirmish) - d = Decision.SKIRMISH; - else + switch (stringValue) { + case EValueAlchemy: + d = Decision.ALCHEMY; + break; + case EValueBunny: + d = Decision.BUNNY; + break; + case EValueFight: + d = Decision.FIGHT; + break; + case EValueMagic: + d = Decision.MAGIC; + break; + case EValueRest: + d = Decision.REST; + break; + case EValueStag: + d = Decision.STAG; + break; + case EValueSword: + d = Decision.SWORD; + break; + default: throw new ParsingException("Wrong param"); // TODO Better message + } Opponent o = new Opponent (id, points, total, d); } @@ -275,7 +299,7 @@ namespace WorldOfPeacecraft case EValueDragon: type = "Dragon"; break; - case EValueStagunt: + case EValueStaghunt: type = "Staghunt"; break; case EValueSkirmish: From f10b06b048756e1aa087be8c113d49b3eb16853d Mon Sep 17 00:00:00 2001 From: Wafa Sadri Date: Thu, 5 Jun 2014 11:49:46 +0200 Subject: [PATCH 2/2] AI erstellt --- inf3.csproj | 3 ++- src/AI.cs | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/AI.cs diff --git a/inf3.csproj b/inf3.csproj index ecd81fb..197dcf2 100644 --- a/inf3.csproj +++ b/inf3.csproj @@ -3,7 +3,7 @@ Debug x86 - 10.0.0 + 8.0.30703 2.0 {FB0656B5-8E83-4880-9EAE-55E474B8B732} Exe @@ -114,6 +114,7 @@ + diff --git a/src/AI.cs b/src/AI.cs new file mode 100644 index 0000000..6a6e7d6 --- /dev/null +++ b/src/AI.cs @@ -0,0 +1,24 @@ +using System; +using System.Timers; + +namespace WorldOfPeacecraft +{ + public class AI + { + Timer timer; + bool challengeSomeone = false; + + public AI () + { + timer = new Timer (5000.0); + timer.Elapsed += new ElapsedEventHandler (OnTimedEvent); + timer.Start (); + } + + private static void OnTimedEvent(object source, ElapsedEventArgs e) + { + + } + } +} +