Exemplo n.º 1
0
 private bool isAHexagon(MatchContext context)
 {
     var points = context.Coordinates.ToList();
     return points[0].Position == points[2].Position
            && points[4].Position == (points[2].Position +  (points[4].Level - points[2].Level))
            && points[3].Position == points[5].Position;
 }
Exemplo n.º 2
0
        private bool isATriangle(MatchContext context)
        {
            var points = context.Coordinates.ToList();

            return (points[0].Position == points[1].Position && points[1].Level == points[2].Level)
                   || (points[1].Position == points[2].Position && points[0].Level == points[1].Level);
        }
 protected override bool MatchesShape(MatchContext context)
 {
     return hasPointCount(context, 4) && hasParallelSidesOfTheSameSize(context);
 }
 private bool hasParallelSidesOfTheSameSize(MatchContext context)
 {
     var points = context.Coordinates.ToList();
     return points[1].Position - points[0].Position == points[3].Position - points[2].Position
            || points[2].Level - points[0].Level == points[3].Level - points[1].Level;
 }
Exemplo n.º 5
0
 protected override bool MatchesShape(MatchContext context)
 {
     return hasPointCount(context, 6) && isAHexagon(context);
 }
Exemplo n.º 6
0
 protected abstract bool MatchesShape(MatchContext context);
Exemplo n.º 7
0
 protected bool hasPointCount(MatchContext context, int count)
 {
     return context.Coordinates.Count() == count;
 }
Exemplo n.º 8
0
 protected override bool MatchesShape(MatchContext context)
 {
     return hasPointCount(context, 3) && isATriangle(context);
 }