-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRule.cs
46 lines (38 loc) · 887 Bytes
/
Rule.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
39
40
41
42
43
44
45
46
using Celluros.Conditions;
using System.Collections.Generic;
namespace Celluros
{
public class Rule
{
private int CurrentIteration = 0;
private int MaxIteration;
public Rule(int iterations)
{
MaxIteration = iterations;
}
public bool IsCompleted
{
get;
private set;
} = false;
public List<Condition> Conditions
{
get;
private set;
} = new List<Condition>();
public void Execute(Field field)
{
if(CurrentIteration >= MaxIteration)
{
IsCompleted = true;
return;
}
CurrentIteration ++;
foreach (var condition in Conditions)
{
condition.Calculate(field);
}
}
}
}