From 3e84127331e5f8ce5cba6d2b8920c80b4cbf0848 Mon Sep 17 00:00:00 2001 From: the Date: Mon, 21 Nov 2022 16:48:41 +0400 Subject: [PATCH 1/2] Fix --- Ship/Ship/WaterMap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ship/Ship/WaterMap.cs b/Ship/Ship/WaterMap.cs index 59f21f6..c95a608 100644 --- a/Ship/Ship/WaterMap.cs +++ b/Ship/Ship/WaterMap.cs @@ -34,7 +34,7 @@ namespace Ship while (counter < 10) { int x = _random.Next(2, 49); - int y = _random.Next(3, 50); + int y = _random.Next(3, 49); var points = new int[] { _map[x, y], _map[x, y + 1], _map[x - 1, y + 1], _map[x + 1, y + 1] }; var forComparison = new int[] { _freeRoad, _freeRoad, _freeRoad, _freeRoad }; if (points.SequenceEqual(forComparison)) From fd9a9ed114958f740ba1a5962cbfcce55a788e56 Mon Sep 17 00:00:00 2001 From: the Date: Mon, 21 Nov 2022 16:50:22 +0400 Subject: [PATCH 2/2] Fix2 --- Ship/Ship/AbstractMap.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Ship/Ship/AbstractMap.cs b/Ship/Ship/AbstractMap.cs index 5de5a27..233853a 100644 --- a/Ship/Ship/AbstractMap.cs +++ b/Ship/Ship/AbstractMap.cs @@ -56,17 +56,13 @@ namespace Ship private bool ObjectIntersects() { var location = _drawingObject.GetCurrentPosition(); - Debug.WriteLine(location.Left + " " + location.Right + " " + location.Top + " " + location.Bottom); for (int i = 0; i < _map.GetLength(0); i++) { for (int j = 0; j < _map.GetLength(1); j++) { if (_map[i, j] == _barrier) { - Debug.WriteLine("Barrier found " + i * _size_x + " " + (i + 1) * _size_x + " " + j * _size_y + " " + (j+1)*_size_y + " " + (i * _size_x >= location.Left) + " " + ((i + 1) * _size_x <= location.Right) + " " + (j * _size_y >= location.Top) + " " + ((j + 1) * _size_y <= location.Bottom)); - if (i * _size_x >= location.Left && (i + 1) * _size_x <= location.Right && j * _size_y >= location.Top && (j + 1) * _size_y <= location.Bottom) { - Debug.WriteLine("True"); return true; } }