Пример #1
0
 public Rule2(Csla.Core.IPropertyInfo primaryProperty)
     : base(primaryProperty)
 {
     IsAsync         = true;
     _innerRule      = new Rule1(primaryProperty);
     InputProperties = _innerRule.InputProperties;
 }
Пример #2
0
        public Piece Run(PieceGrid currentGen, Point point, Piece piece)
        {
            Piece p1 = Rule1.Run(currentGen, point);
            Piece p2 = Rule2.Run(currentGen, point);

            return(p1.StateValue >= p2.StateValue ? p1 : p2);
        }
Пример #3
0
 public Rule3(Csla.Core.IPropertyInfo primaryProperty)
     : base(primaryProperty)
 {
     IsAsync                = true;
     _innerRule             = new Rule1(primaryProperty);
     InputProperties        = _innerRule.InputProperties;
     ProvideTargetWhenAsync = true;
 }
Пример #4
0
        static void Main(string[] args)
        {
            Rule1 r1 = new Rule1();

            r1.Check();
            Rule2 r2 = new Rule2();

            r2.Check();
        }
Пример #5
0
        /* CREATE */
        public static void Add_Rule_1(int Id, int Major_Max, int Special_Major_Max)
        {
            var client = ConnectNeo4J.Connection();
            var rule   = new Rule1 {
                id = Id, major_max = Major_Max, special_major_max = Special_Major_Max, isDelete = false
            };

            client.Cypher.Create("(:Rule_1 {rule})").WithParam("rule", rule).ExecuteWithoutResultsAsync().Wait();
        }
Пример #6
0
        public void When_conditions_is_false_then_action_should_not_be_executed()
        {
            Rule1.Setup(rule => rule.Evaluate(Facts)).Returns(false);
            Rules.Register(Rule1.Object);

            RulesEngine.Fire(Rules, Facts);

            Rule1.Verify(rule => rule.Execute(Facts), Times.Never);
        }
Пример #7
0
        public override int GetHashCode()
        {
            var result = 0;

            result ^= Kind.GetHashCode();
            result ^= Rule1.GetHashCode();
            result ^= Rule2.GetHashCode();
            result ^= Symbol.GetHashCode();
            return(result);
        }
Пример #8
0
        /* UPDATE */
        public static void Update_Rule_1(int Id, int Major_Max, int Special_Major_Max)
        {
            var client = ConnectNeo4J.Connection();
            var term   = new Rule1 {
                id = Id, major_max = Major_Max, special_major_max = Special_Major_Max
            };

            client.Cypher.Match("(a:Rule_1)")
            .Where((Rule1 item) => item.id == Id)
            .Set("a = {tmp}")
            .WithParam("tmp", term)
            .ExecuteWithoutResultsAsync();
        }
Пример #9
0
    private void StandardBoidMovement(BoidBehaviour boid)
    {
        Vector3 defaultMovement, component1, component2, component3, component4;

        component1 = Rule1.FindPointTowardsGlobalMassCentre(boidList, boid);
        component2 = TargetPoint.TowardsPoint(boid, targetPoint);
        component3 = Rule2.MoveAwayFromNearbyObjects(boidList, boid);
        component4 = Rule3.MatchVelocityOfPercivedBoids(boidList, boid, perciveDistance);

        /*
         * component1 = Rule1.FindPointTowardsLocalMassCentre(boidList, boid, perciveDistance);
         * component2 = Rule2.MoveAwayFromNearbyObjects(boidList, boid);
         * component3 = Rule3.MatchVelocityOfPercivedBoids(boidList, boid, perciveDistance);
         * componentHunted = RuleHunted.MoveAwayFromPredators(predatorList, boid);
         */

        boid.CurrentVelocity    = boid.CurrentVelocity + component1 + component2 + component3 + component4;
        boid.transform.position = boid.transform.position + boid.CurrentVelocity;
        //Debug.Log(boid.transform.position);
    }
Пример #10
0
        public void CallAllRules()
        {
            Rule1         rule1    = new Rule1();
            Rule2         rule2    = new Rule2();
            Rule3         rule3    = new Rule3();
            Rule4         rule4    = new Rule4();
            Rule5         rule5    = new Rule5();
            Rule6         rule6    = new Rule6();
            Rule7         rule7    = new Rule7();
            Rule8         rule8    = new Rule8();
            Rule9         rule9    = new Rule9();
            Rule10        rule10   = new Rule10();
            Rule11        rule11   = new Rule11();
            Rule12        rule12   = new Rule12();
            Rule13        rule13   = new Rule13();
            ReadExcelData readData = new ReadExcelData();

            readData.ReadFromExcelFile("");
            //calls all rules
            int total;

            foreach (var row in Records.records)
            {
                total  = 0;
                total += rule1.Evaluate(row).Score;
                total += rule2.Evaluate(row).Score;
                total += rule3.Evaluate(row).Score;
                total += rule4.Evaluate(row).Score;
                total += rule5.Evaluate(row).Score;
                total += rule6.Evaluate(row).Score;
                total += rule7.Evaluate(row).Score;
                total += rule8.Evaluate(row).Score;
                total += rule9.Evaluate(row).Score;
                total += rule10.Evaluate(row).Score;
                total += rule11.Evaluate(row).Score;
                total += rule12.Evaluate(row).Score;
                total += rule13.Evaluate(row).Score;
                /* call all rules here */
                Console.WriteLine("Total score: " + total);
            }
        }
Пример #11
0
        public bool PlayerWins(int posY, int posX, int palyerSide)
        {
            var playerWins = Rule1.Referee(posY, posX, palyerSide);

            return(playerWins);
        }
Пример #12
0
        public bool ComputerWins(Tuple <int, int> nextMove, int aiSide)
        {
            var computerWins = Rule1.Referee(nextMove.Item1, nextMove.Item2, aiSide);

            return(computerWins);
        }
Пример #13
0
 public bool MatchesAnyRule(int value)
 {
     return(Rule1.IsInRange(value) || Rule2.IsInRange(value));
 }
Пример #14
0
 public DefaultRulesEngineTests()
 {
     Rule1.Setup(rule => rule.Name).Returns("r");
 }