public void GetPlayerMatrix_ShouldBeAbleToMakeAMatrix_WhenCalledUpon() { map = new ListMap(11); map.TakeHex(PlayerType.Red, 1, 1); map.TakeHex(PlayerType.Red, 1, 2); map.TakeHex(PlayerType.Red, 1, 3); map.TakeHex(PlayerType.Red, 1, 4); map.TakeHex(PlayerType.Red, 1, 5); map.TakeHex(PlayerType.Blue, 1, 7); map.TakeHex(PlayerType.Blue, 1, 8); map.TakeHex(PlayerType.Blue, 1, 9); map.TakeHex(PlayerType.Blue, 1, 10); var blueMap = new ListMap(map.Size); blueMap.InjectFrom <CloneInjection>(map); var matrixForPlayer1 = blueMap.GetPlayerMatrix(PlayerType.Blue); TestContext.WriteLine("Player 1 matrix"); TestContext.WriteLine(matrixForPlayer1.ToString()); var matrixForPlayer2 = blueMap.GetPlayerMatrix(PlayerType.Red); TestContext.WriteLine("Player 2 matrix"); TestContext.WriteLine(matrixForPlayer2.ToString()); Assert.AreEqual(matrixForPlayer1, blueMap.HexAt(1, 7).Attached); }
public void Inquisitor_ShouldWork() { var map = new ListMap(6); var player = new ListPlayer(1, map.Size, new Config()); map.TakeHex(PlayerType.Red, 3, 3); var inquisitor = new Inquisitor(); var testMap = new ListMap(map.Size); testMap.InjectFrom(map); inquisitor.StartInquisition(testMap, player); // Assert.AreEqual(1, 2); }
public void GetPathForPlayerTest() { var map = new ListMap(11); var player = new ListPlayer(1, 11, new Config()); var redPlayer = new ListPlayer(2, 11, new Config()); var pathfinder = new Pathfinder(map, player.Me); //map.TakeHex(PlayerType.Red, 5, 1); pathfinder = new Pathfinder(map, player.Me); var path = pathfinder.GetPathForPlayer(); //Assert.AreEqual(11, path.Count); map.TakeHex(PlayerType.Red, 3, 2); map.TakeHex(PlayerType.Red, 2, 2); map.TakeHex(PlayerType.Red, 2, 0); map.TakeHex(PlayerType.Red, 2, 1); map.TakeHex(PlayerType.Red, 2, 3); map.TakeHex(PlayerType.Red, 2, 4); map.TakeHex(PlayerType.Red, 2, 5); var blueMap = new ListMap(map.Size); blueMap.InjectFrom <CloneInjection>(map); pathfinder = new Pathfinder(map, redPlayer.Me); path = pathfinder.GetPathForPlayer(); TestContext.WriteLine(pathfinder.GetLog()); path.ForEach(x => map.TakeHex(PlayerType.Red, x.Row, x.Column)); TestContext.WriteLine(map.GetMapMatrix().ToString().Replace('0', '_')); //pathfinder = new Pathfinder(blueMap, player, true); //path = pathfinder.GetPathForPlayer(); //path.ForEach(x => blueMap.TakeHex(PlayerType.Blue, x.Row, x.Column)); //TestContext.WriteLine(pathfinder.GetLog()); //TestContext.WriteLine(blueMap.GetMapMatrix().ToString().Replace('0', '_')); //Assert.AreEqual(11, path.Count); }
public void ValueInjecter_ShouldProperlyClone_AFullMap() { map = new ListMap(11); map.TakeHex(PlayerType.Red, 1, 1); map.TakeHex(PlayerType.Red, 1, 2); map.TakeHex(PlayerType.Red, 1, 3); map.TakeHex(PlayerType.Red, 1, 4); map.TakeHex(PlayerType.Red, 1, 5); map.TakeHex(PlayerType.Blue, 1, 7); map.TakeHex(PlayerType.Blue, 1, 8); map.TakeHex(PlayerType.Blue, 1, 9); map.TakeHex(PlayerType.Blue, 1, 10); var newMap = new ListMap(map.Size); newMap.InjectFrom <CloneInjection>(map); Assert.AreEqual(5, newMap.Board.Count(x => x.Owner == PlayerType.Red)); Assert.AreEqual(4, newMap.Board.Count(x => x.Owner == PlayerType.Blue)); Assert.AreEqual(map.HexAt(1, 1).ToTuple(), newMap.HexAt(1, 1).ToTuple()); Assert.AreEqual(map.HexAt(1, 1).Attached, map.HexAt(1, 1).Attached); newMap.TakeHex(PlayerType.Blue, 1, 6); Assert.AreNotEqual(map.Board.Count(x => x.Owner == PlayerType.Blue), newMap.Board.Count(x => x.Owner == PlayerType.Blue)); }