diff --git a/WarmlyShip/WarmlyShip/FormShip.cs b/WarmlyShip/WarmlyShip/FormShip.cs
index 125d023..5223221 100644
--- a/WarmlyShip/WarmlyShip/FormShip.cs
+++ b/WarmlyShip/WarmlyShip/FormShip.cs
@@ -54,7 +54,24 @@ namespace WarmlyShip
///
private void ButtonMove_Click(object sender, EventArgs e)
{
-
+ string name = ((Button)sender)?.Name ?? string.Empty;
+ switch (name)
+ {
+ case "buttonUp":
+ _ship?.MoveTransport(Direction.Up);
+ break;
+ case "buttonDown":
+ _ship?.MoveTransport(Direction.Down);
+ break;
+ case "buttonLeft":
+ _ship?.MoveTransport(Direction.Left);
+ break;
+ case "buttonRight":
+ _ship?.MoveTransport(Direction.Right);
+ break;
+ }
+ Draw();
+
}
///
/// Θημενενθε πΰημεπξβ τξπμϋ
diff --git a/WarmlyShip/WarmlyShip/MapWithSetWarmlyShipGeneric.cs b/WarmlyShip/WarmlyShip/MapWithSetWarmlyShipGeneric.cs
index 56b40bc..9533481 100644
--- a/WarmlyShip/WarmlyShip/MapWithSetWarmlyShipGeneric.cs
+++ b/WarmlyShip/WarmlyShip/MapWithSetWarmlyShipGeneric.cs
@@ -153,7 +153,7 @@ namespace WarmlyShip
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
{
for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; ++j)
- {//Π»ΠΈΠ½ΠΈΡ ΡΠ°ΠΌΠ·Π΅ΡΠΊΠΈ ΠΌΠ΅ΡΡΠ°
+ {
g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight, i *
_placeSizeWidth + _placeSizeWidth / 2 , j * _placeSizeHeight);
}
@@ -167,7 +167,6 @@ namespace WarmlyShip
///
private void DrawWarmlyShip(Graphics g)
{
- // TODO ΡΡΡΠ°Π½ΠΎΠ²ΠΊΠ° ΠΏΠΎΠ·ΠΈΡΠΈΠΈ
int i = 0;
int j = 0;
for (int k = 0; k < _setWarmlyShip.Count; k++)
diff --git a/WarmlyShip/WarmlyShip/SetWarmlyShipGeneric.cs b/WarmlyShip/WarmlyShip/SetWarmlyShipGeneric.cs
index a7edbcd..7f883a3 100644
--- a/WarmlyShip/WarmlyShip/SetWarmlyShipGeneric.cs
+++ b/WarmlyShip/WarmlyShip/SetWarmlyShipGeneric.cs
@@ -36,7 +36,6 @@ namespace WarmlyShip
///
public int Insert(T ship)
{
- // TODO Π²ΡΡΠ°Π²ΠΊΠ° Π² Π½Π°ΡΠ°Π»ΠΎ Π½Π°Π±ΠΎΡΠ°
if (ship == null)
{
return -1;
@@ -56,16 +55,11 @@ namespace WarmlyShip
///
public int Insert(T ship, int position)
{
- // TODO ΠΏΡΠΎΠ²Π΅ΡΠΊΠ° ΠΏΠΎΠ·ΠΈΡΠΈΠΈ
- // TODO ΠΏΡΠΎΠ²Π΅ΡΠΊΠ°, ΡΡΠΎ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΌΠ°ΡΡΠΈΠ²Π° ΠΏΠΎ ΡΡΠΎΠΉ ΠΏΠΎΠ·ΠΈΡΠΈΠΈ ΠΏΡΡΡΠΎΠΉ, Π΅ΡΠ»ΠΈ Π½Π΅Ρ, ΡΠΎ
- // ΠΏΡΠΎΠ²Π΅ΡΠΊΠ°, ΡΡΠΎ ΠΏΠΎΡΠ»Π΅ Π²ΡΡΠ°Π²Π»ΡΠ΅ΠΌΠΎΠ³ΠΎ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ° Π² ΠΌΠ°ΡΡΠΈΠ²Π΅ Π΅ΡΡΡ ΠΏΡΡΡΠΎΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ
- // ΡΠ΄Π²ΠΈΠ³ Π²ΡΠ΅Ρ
ΠΎΠ±ΡΠ΅ΠΊΡΠΎΠ², Π½Π°Ρ
ΠΎΠ΄ΡΡΠΈΡ
ΡΡ ΡΠΏΡΠ°Π²Π° ΠΎΡ ΠΏΠΎΠ·ΠΈΡΠΈΠΈ Π΄ΠΎ ΠΏΠ΅ΡΠ²ΠΎΠ³ΠΎ ΠΏΡΡΡΠΎΠ³ΠΎ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ°
- // TODO Π²ΡΡΠ°Π²ΠΊΠ° ΠΏΠΎ ΠΏΠΎΠ·ΠΈΡΠΈΠΈ
if (position < 0 || position > Count)
{
return -1;
}
- int firstNullElementIndex = position; //ΠΈΠ½Π΄Π΅ΠΊΡ ΠΏΠ΅ΡΠ²ΠΎΠ³ΠΎ Π½ΡΠ»Π΅Π²ΠΎΠ³ΠΎ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ°
+ int firstNullElementIndex = position;
while (_places[firstNullElementIndex] != null)
{
if (firstNullElementIndex >= Count)
@@ -89,8 +83,6 @@ namespace WarmlyShip
///
public T Remove(int position)
{
- // TODO ΠΏΡΠΎΠ²Π΅ΡΠΊΠ° ΠΏΠΎΠ·ΠΈΡΠΈΠΈ
- // TODO ΡΠ΄Π°Π»Π΅Π½ΠΈΠ΅ ΠΎΠ±ΡΠ΅ΠΊΡΠ° ΠΈΠ· ΠΌΠ°ΡΡΠΈΠ²Π°, ΠΏΡΠΈΡΠΎΠ²ΠΈΠ² ΡΠ»Π΅ΠΌΠ΅Π½ΡΡ ΠΌΠ°ΡΡΠΈΠ²Π° Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ null
if (_places[position] == null)
{
return null;