-
Notifications
You must be signed in to change notification settings - Fork 0
/
Matrix.cs
38 lines (33 loc) · 876 Bytes
/
Matrix.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace _013Task1Basic
{
static class Matrix
{
public const int Width = 80;
public const int Height = 40;
public const int Lines = 50;
public const int StartDelay = 10;
public static async Task Start()
{
var tasks = new List<Task>();
for (var i = 0; i < Lines; i++)
{
var task = Task.Run(LoopLine);
tasks.Add(task);
await Task.Delay(StartDelay);
}
}
private static async Task LoopLine()
{
while (true)
{
var column = RandomHelper.Rand(0, Width);
await MatrixLine.StartNew(column);
}
}
}
}