Merge branch 'master' of manuel-voegele.de:inf3
Conflicts: src/Parser.cs
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||||
<ProductVersion>10.0.0</ProductVersion>
|
<ProductVersion>8.0.30703</ProductVersion>
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
<ProjectGuid>{FB0656B5-8E83-4880-9EAE-55E474B8B732}</ProjectGuid>
|
<ProjectGuid>{FB0656B5-8E83-4880-9EAE-55E474B8B732}</ProjectGuid>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
@@ -118,6 +118,7 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="src\BinarySearch.cs" />
|
<Compile Include="src\BinarySearch.cs" />
|
||||||
<Compile Include="src\Sorttest.cs" />
|
<Compile Include="src\Sorttest.cs" />
|
||||||
|
<Compile Include="src\AI.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
|
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
|
||||||
|
|||||||
24
src/AI.cs
Normal file
24
src/AI.cs
Normal file
@@ -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)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -26,10 +26,17 @@ namespace WorldOfPeacecraft
|
|||||||
public const string ValueY = "y";
|
public const string ValueY = "y";
|
||||||
public const string ValueCol = "col";
|
public const string ValueCol = "col";
|
||||||
public const string ValueRow = "row";
|
public const string ValueRow = "row";
|
||||||
public const string EValueDragon = "DRAGON";
|
public const string EValueFight = "FIGHT";
|
||||||
public const string EValueStagunt = "STAGHUNT";
|
public const string EValueRest = "REST";
|
||||||
public const string EValueSkirmish = "SKIRMISH";
|
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 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 EValueWall = "WALL";
|
||||||
public const string EValueForest = "FOREST";
|
public const string EValueForest = "FOREST";
|
||||||
public const string EValueWater = "WATER";
|
public const string EValueWater = "WATER";
|
||||||
@@ -239,7 +246,7 @@ namespace WorldOfPeacecraft
|
|||||||
Result r = new Result(round, running, delay);
|
Result r = new Result(round, running, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProcessOpponent(Block oppBlock)
|
private void ProcessOpponent (Block oppBlock)
|
||||||
{
|
{
|
||||||
int id = oppBlock.GetIntValue (ValueId);
|
int id = oppBlock.GetIntValue (ValueId);
|
||||||
int points = oppBlock.GetIntValue (ValuePoints);
|
int points = oppBlock.GetIntValue (ValuePoints);
|
||||||
@@ -247,14 +254,31 @@ namespace WorldOfPeacecraft
|
|||||||
LinkedList <string> unnamedValue = oppBlock.GetUnnamedValues ();
|
LinkedList <string> unnamedValue = oppBlock.GetUnnamedValues ();
|
||||||
string stringValue = unnamedValue.First.Value;
|
string stringValue = unnamedValue.First.Value;
|
||||||
Decision d;
|
Decision d;
|
||||||
if (stringValue == EValueDragon)
|
switch (stringValue) {
|
||||||
d = Decision.DRAGON;
|
case EValueAlchemy:
|
||||||
else if (stringValue == EValueStagunt)
|
d = Decision.ALCHEMY;
|
||||||
d = Decision.STAGHUNT;
|
break;
|
||||||
else if (stringValue == EValueSkirmish)
|
case EValueBunny:
|
||||||
d = Decision.SKIRMISH;
|
d = Decision.BUNNY;
|
||||||
else
|
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
|
throw new ParsingException("Wrong param"); // TODO Better message
|
||||||
|
}
|
||||||
Opponent o = new Opponent (id, points, total, d);
|
Opponent o = new Opponent (id, points, total, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,7 +299,7 @@ namespace WorldOfPeacecraft
|
|||||||
case EValueDragon:
|
case EValueDragon:
|
||||||
type = GameType.DRAGON;
|
type = GameType.DRAGON;
|
||||||
break;
|
break;
|
||||||
case EValueStagunt:
|
case EValueStaghunt:
|
||||||
type = GameType.STAGHUNT;
|
type = GameType.STAGHUNT;
|
||||||
break;
|
break;
|
||||||
case EValueSkirmish:
|
case EValueSkirmish:
|
||||||
|
|||||||
Reference in New Issue
Block a user