public void PopulateWaterBlocks(params int[][] points) { GameContext.Map = new Map(10, 10); GameContext.Rules = new GameRules(); var exploration = new MapExplorationManager(); var turnResults = new TurnState(); turnResults.Water.AddRange(points.Select(x => new TurnState.Point(x[0], x[1]))); exploration.Process(turnResults); var water = (from row in Enumerable.Range(0, GameContext.Map.Rows) from col in Enumerable.Range(0, GameContext.Map.Columns) let tile = GameContext.Map.At(row, col) where tile.State == TileState.Water select tile ).ToArray(); Assert.AreEqual(points.Length, water.Length); var rawTiles = (from pt in points select GameContext.Map.At(pt[0], pt[1]) ).ToArray(); foreach (MapTile pt in water.Except(rawTiles)) Assert.Fail("Point [{1},{0}] was not found in the result", pt.Column, pt.Row); foreach (MapTile source in water.Except(rawTiles)) Assert.Fail("Point [{1},{0}] was not an expected result", source.Column, source.Row); }
public void EnsureLandBeingMarked() { GameContext.Map = new Map(100, 100); GameContext.Rules = new GameRules { ViewRadiusSquared = 55 }; var exploration = new MapExplorationManager(); var turnResults = new TurnState(); turnResults.Ants.Add(new TurnState.Point(5, 5)); exploration.Process(turnResults); var land = (from row in Enumerable.Range(0, GameContext.Map.Rows) from col in Enumerable.Range(0, GameContext.Map.Columns) let tile = GameContext.Map.At(row, col) where tile.State == TileState.Land select tile ).ToArray(); Assert.IsTrue(land.Length > 0); }