Opponent erzeugt
This commit is contained in:
19
Opponent.cs
Normal file
19
Opponent.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace inf3
|
||||||
|
{
|
||||||
|
public class Opponent
|
||||||
|
{
|
||||||
|
int points_;
|
||||||
|
int total_;
|
||||||
|
enum Decision {DRAGON, STAGHUNT, SKIRMISH};
|
||||||
|
Decision d_;
|
||||||
|
|
||||||
|
public Opponent (int points, int total, Decision d)
|
||||||
|
{
|
||||||
|
points_ = points;
|
||||||
|
total_ = total;
|
||||||
|
d_ = d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -57,6 +57,7 @@
|
|||||||
<Compile Include="src\StringUtils.cs" />
|
<Compile Include="src\StringUtils.cs" />
|
||||||
<Compile Include="src\ParsingException.cs" />
|
<Compile Include="src\ParsingException.cs" />
|
||||||
<Compile Include="src\Message.cs" />
|
<Compile Include="src\Message.cs" />
|
||||||
|
<Compile Include="Opponent.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="src\DefaultGui\" />
|
<Folder Include="src\DefaultGui\" />
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ namespace WorldOfPeacecraft
|
|||||||
private Regex LastLineRegex;
|
private Regex LastLineRegex;
|
||||||
private Backend backend;
|
private Backend backend;
|
||||||
|
|
||||||
|
enum Decision {DRAGON, STAGHUNT, SKIRMISH};
|
||||||
|
|
||||||
public Parser ()
|
public Parser ()
|
||||||
{
|
{
|
||||||
ParserThread = new Thread (new ThreadStart (this.RunParser));
|
ParserThread = new Thread (new ThreadStart (this.RunParser));
|
||||||
@@ -206,19 +208,28 @@ namespace WorldOfPeacecraft
|
|||||||
int round = procBlock.GetIntValue ("round");
|
int round = procBlock.GetIntValue ("round");
|
||||||
bool running = procBlock.GetBoolValue ("running");
|
bool running = procBlock.GetBoolValue ("running");
|
||||||
int delay = procBlock.GetIntValue ("delay");
|
int delay = procBlock.GetIntValue ("delay");
|
||||||
//ProcessOpponent (procBlock.GetBlocks ());
|
LinkedList <Block> block = procBlock.GetBlocks ();
|
||||||
|
ProcessOpponent (block.First.Value);
|
||||||
//Result r = new Result(round, running, delay);
|
//Result r = new Result(round, running, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProcessOpponent(Block oppBlock)
|
private void ProcessOpponent(Block oppBlock)
|
||||||
{
|
{
|
||||||
CheckBlocksSize (oppBlock, 1, 1);
|
|
||||||
int id = oppBlock.GetIntValue ("id");
|
int id = oppBlock.GetIntValue ("id");
|
||||||
int points = oppBlock.GetIntValue ("points");
|
int points = oppBlock.GetIntValue ("points");
|
||||||
int total = oppBlock.GetIntValue ("total");
|
int total = oppBlock.GetIntValue ("total");
|
||||||
//TYPE decision = ProcessDecision(oppBlock.getBlocks());
|
LinkedList <string> unnamedValue = oppBlock.GetUnnamedValues ();
|
||||||
|
string stringValue = unnamedValue.First.Value;
|
||||||
|
Decision d;
|
||||||
|
if (stringValue == "DRAGON")
|
||||||
|
d = Decision.DRAGON;
|
||||||
|
if (stringValue == "STAGHUNT")
|
||||||
|
d = Decision.STAGHUNT;
|
||||||
|
if (stringValue == "SKIRMISH")
|
||||||
|
d = Decision.SKIRMISH;
|
||||||
|
|
||||||
}
|
}
|
||||||
//"id:"INT,"decision:",DECISION,"points:",INT,"total:",INT,"
|
//DRAGON|STAGHUNT|SKIRMISH
|
||||||
|
|
||||||
private void ProcessDecision(Block block)
|
private void ProcessDecision(Block block)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user