Commit 70518da7 authored by Clément's avatar Clément
Browse files

Update

parent 432959f2
No preview for this file type
No preview for this file type
......@@ -23,7 +23,10 @@ namespace EntitiesLayer
Challenger2 = challenger2;
double prob;
Random rnd = new Random();
prob = ((double)challenger2.NbUnits)/((double)challenger2.NbUnits + (double)challenger1.NbUnits);
if (territory.Owner.Name.Trim()==Challenger1.Name.Trim())
{
prob = prob * 0.8;
......@@ -32,6 +35,8 @@ namespace EntitiesLayer
{
prob = prob * 1.2;
}
double al = 0.3 + rnd.NextDouble() % (0.4);
if (al <= prob)
{
......
......@@ -33,7 +33,7 @@ namespace Tests
[TestMethod]
public void TestTerritory()
{
Territory territory = new Territory(TerritoryType.LAND, new House(1, "", 200));
Territory territory = new Territory(TerritoryType.LAND, new House(1, "", 200), "Territory name");
int id = dal.addTerritory(territory);
Assert.AreNotEqual(id, -1);
dal.deleteTerritory(id);
......@@ -43,10 +43,11 @@ namespace Tests
[TestMethod]
public void TestFight()
{
House house = new House("", 250);
House house2 = new House("", 100);
War war = new War("");
Fight fight = new Fight("", house, house2, house, war);
House house = new House(0, "Lannister", 250);
House house2 = new House(1, "Stark", 150);
War war = new War(4, "War");
Territory territory = new Territory(11, TerritoryType.LAND, new House(1, "", 200), "Territory name");
Fight fight = new Fight("", house, house2, war, territory);
int id = dal.addFight(fight);
Assert.AreNotEqual(id, -1);
dal.deleteFight(id);
......
......@@ -80,11 +80,28 @@ namespace ThronesTournamentConsole
static void Main(string[] args)
{
Program game = new Program();
House house = new House("", 250);
House house2 = new House("", 100);
War war = new War("");
Fight fight = new Fight("", house, house2, house, war);
House house = new House(0, "", 250);
House house2 = new House(1, "", 100);
War war = new War(4, "");
Fight fight = new Fight("", house, house2, war, new Territory(11, TerritoryType.DESERT, house, ""));
businessLayer.addFight(fight);
game.DisplayHouses();
Console.WriteLine();
game.DisplayHouses(200);
Console.WriteLine();
game.DisplayCharacteristics();
Console.WriteLine();
game.DisplayCharacters();
Console.WriteLine();
game.DisplayCharacters(20, 40);
Console.WriteLine();
game.DisplayTerritories();
Console.WriteLine();
game.DisplayTerritories();
Console.WriteLine();
game.DisplayFights();
Console.ReadKey();
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment