Предпоследнее

This commit is contained in:
Макс Бондаренко 2022-10-23 18:47:37 +04:00
parent 572df7efe3
commit 3c945af49e

View File

@ -72,16 +72,16 @@ namespace WarmlyShip
private void Shaking() private void Shaking()
{ {
int j = _setShips.Count - 1; int j = _setShips.Count - 1;
for (int i = 0; i < _setShips.Count; i++) for (int i = 0; i < _setShips.Count; ++i)
{ {
if (_setShips.Get(i) == null) if (_setShips.Get(i) == null)
{ {
for (; j > i; j--) for (; j > i; --j)
{ {
var ship = _setShips.Get(j); var car = _setShips.Get(j);
if (ship != null) if (car != null)
{ {
_setShips.Insert(ship, i); _setShips.Insert(car, i);
_setShips.Remove(j); _setShips.Remove(j);
break; break;
} }