Skip to content

Commit

Permalink
создали класс HorizontalLine
Browse files Browse the repository at this point in the history
  • Loading branch information
kartavec committed Sep 13, 2015
1 parent f0d72dc commit 71ec7ba
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 19 deletions.
32 changes: 32 additions & 0 deletions Snake/Snake/HorizontalLine.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Snake
{
class HorizontalLine
{
List<Point> pList;

public HorizontalLine(int xLeft, int xRight, int y, char sym)
{
pList = new List<Point>();
for(int x = xLeft; x <= xRight; x++)
{
Point p = new Point( x, y, sym );
pList.Add( p );
}

}

public void Drow()
{
foreach(Point p in pList)
{
p.Draw();
}
}
}
}
21 changes: 2 additions & 19 deletions Snake/Snake/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,8 @@ static void Main( string[] args )
Point p2 = new Point(4, 5, '#');
p2.Draw();

List<int> numList = new List<int>();
numList.Add( 0 );
numList.Add( 1 );
numList.Add( 2 );

int x = numList[ 0 ];
int y = numList[ 1 ];
int z = numList[ 2 ];

foreach(int i in numList)
{
Console.WriteLine( i );
}

numList.RemoveAt( 0 );

List<Point> pList = new List<Point>();
pList.Add( p1 );
pList.Add( p2 );
HorizontalLine line = new HorizontalLine(5, 10, 8, '+');
line.Drow();

Console.ReadLine();
}
Expand Down
1 change: 1 addition & 0 deletions Snake/Snake/Snake.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="HorizontalLine.cs" />
<Compile Include="Point.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down

0 comments on commit 71ec7ba

Please sign in to comment.