Parser fix 1/2
This commit is contained in:
@@ -57,6 +57,7 @@
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="src\EnumGameType.cs" />
|
||||
<Compile Include="src\GameStrategy.cs" />
|
||||
<Compile Include="src\IGame.cs" />
|
||||
<Compile Include="src\Receiver.cs" />
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace WorldOfPeacecraft
|
||||
return cooperate;
|
||||
}
|
||||
|
||||
public Decision nextMove(Decision opLM)
|
||||
public Decision getNextMove(Decision opLM)
|
||||
{
|
||||
if (opLM == cooperate && counter == 0)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -18,6 +18,11 @@ namespace WorldOfPeacecraft
|
||||
return getNextMove();
|
||||
}
|
||||
|
||||
public Decision getNextMove(Decision opLM)
|
||||
{
|
||||
return getNextMove();
|
||||
}
|
||||
|
||||
public Decision getNextMove()
|
||||
{
|
||||
int randomNumber = random.Next(0, 2);
|
||||
|
||||
Reference in New Issue
Block a user