private static void ValidateInputSize(Field field, int value) { if (value >= DBLMath.Pow(2, getWidthOf(field)) || value < 0) { throw new ArgumentException("Value " + value + " does not fit " + "into field of width " + getWidthOf(field)); } }
public static World DefaultInstance() { World w = new World(); w.Id = DBLMath.GenerateRandomInt64(); w.Name = "Default World"; w.WorldVersion = Version.fresh(); w.GameVersion = Version.fresh(); w.AuthorId = 0; w.EditorCameraStart = Coordinates.of("4096.4096.0"); w.DefaultCells = new Dictionary <int, Cell>(); w.Map = new Dictionary <Coordinates, Cell>(); for (int x = 4096 - 20; x < 4096 + 20; x++) { for (int y = 4096 - 20; y < 4096 + 20; y++) { w.Map.Add(Coordinates.of(x, y, 0), Cell.of("0.1.0.0.0.0.0")); //TODO replace with Floor.toCell() or something } } return(w); }
public void testPow() { Assert.AreEqual(256, DBLMath.Pow(2, 8)); }