Opponent erzeugt

This commit is contained in:
Wafa Sadri
2014-04-11 10:48:24 +02:00
parent ab60843c61
commit 9c30e121f3
3 changed files with 35 additions and 4 deletions

View File

@@ -30,6 +30,8 @@ namespace WorldOfPeacecraft
private Regex LastLineRegex;
private Backend backend;
enum Decision {DRAGON, STAGHUNT, SKIRMISH};
public Parser ()
{
ParserThread = new Thread (new ThreadStart (this.RunParser));
@@ -206,19 +208,28 @@ namespace WorldOfPeacecraft
int round = procBlock.GetIntValue ("round");
bool running = procBlock.GetBoolValue ("running");
int delay = procBlock.GetIntValue ("delay");
//ProcessOpponent (procBlock.GetBlocks ());
LinkedList <Block> block = procBlock.GetBlocks ();
ProcessOpponent (block.First.Value);
//Result r = new Result(round, running, delay);
}
private void ProcessOpponent(Block oppBlock)
{
CheckBlocksSize (oppBlock, 1, 1);
int id = oppBlock.GetIntValue ("id");
int points = oppBlock.GetIntValue ("points");
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)
{