PIbd-11_Permyakov_R.G._AccordionBus_Simple_Lab2 #2

Closed
Roman wants to merge 3 commits from Lab2 into Lab1
Showing only changes of commit 17ea81733b - Show all commits

View File

@ -15,8 +15,7 @@ namespace AccordionBus.MovementStrategy
{
return false;
}
return objParams.LeftBorder() == 0 || objParams.RightBorder() == FieldWidth ||
objParams.TopBorder() == 0 || objParams.DownBorder() == FieldHeight;
return objParams.RightBorder() == FieldWidth && objParams.DownBorder() == FieldHeight;
}
protected override void MoveToTarget()
@ -27,15 +26,8 @@ namespace AccordionBus.MovementStrategy
return;
}
int _raznLeft = 0 - objParams.RightBorder();
int _raznRight = objParams.LeftBorder() - FieldWidth;
int _raznUp = 0 - objParams.TopBorder();
int _raznDown = objParams.DownBorder() - FieldHeight;
if (_raznLeft > _raznRight && _raznLeft > _raznDown && _raznLeft > _raznUp) MoveLeft();
if (_raznRight > _raznLeft && _raznRight > _raznDown && _raznRight > _raznUp) MoveRight();
if (_raznUp > _raznRight && _raznUp > _raznLeft && _raznUp > _raznDown) MoveUp();
if (_raznDown > _raznLeft && _raznDown > _raznRight && _raznDown > _raznUp) MoveDown();
if (objParams.RightBorder() < FieldWidth) MoveRight();
if (objParams.DownBorder() < FieldHeight) MoveDown();
}
}
}