Parser fix 1/2

This commit is contained in:
Daniel Herrmann
2014-06-05 11:56:34 +02:00
parent 5229f218da
commit d78bec4579
5 changed files with 13 additions and 7 deletions

View File

@@ -5,9 +5,9 @@ namespace WorldOfPeacecraft
public class Challenge
{
int id_;
string type_;
GameType type_;
bool accepted_;
public Challenge (int id, string type, bool accepted)
public Challenge (int id, GameType type, bool accepted)
{
id_ = id;
type_ = type;

View File

@@ -24,7 +24,7 @@ namespace WorldOfPeacecraft
return cooperate;
}
public Decision nextMove(Decision opLM)
public Decision getNextMove(Decision opLM)
{
if (opLM == cooperate && counter == 0)
{

View File

@@ -267,19 +267,19 @@ namespace WorldOfPeacecraft
private void ProcessChallenge (Block challengeBlock)
{
int id = challengeBlock.GetIntValue(ValueId);
String type;
GameType type;
LinkedList<string> value = challengeBlock.GetUnnamedValues();
// TODO check value size, better name
switch (value.First.Value)
{
case EValueDragon:
type = "Dragon";
type = GameType.DRAGON;
break;
case EValueStagunt:
type = "Staghunt";
type = GameType.STAGHUNT;
break;
case EValueSkirmish:
type = "Skirmisch";
type = GameType.SKIRMISH;
break;
default:
throw new ParsingException("Invalid type"); // TODO Better message

View File

@@ -18,6 +18,11 @@ namespace WorldOfPeacecraft
return getNextMove();
}
public Decision getNextMove(Decision opLM)
{
return getNextMove();
}
public Decision getNextMove()
{
int randomNumber = random.Next(0, 2);