Ejemplo n.º 1
0
        // move to social comparison state if can and should. Return true if can and should and move, else return false
        public bool moveToSocialComparisonStateInStructureIfShould(clsGroundAtom refGroundAtom)
        {
            double socialComparisonProbability = Util.random.NextDouble();

            // draw probabilistically whether to compare or not
            if (socialComparisonProbability <= refGroundAtom.getSocialComparisonProbability())
            {
                // do social comparison
                clsGroundAtom mostSimilar = SocialComparison.findMostSimilarInStructure(refGroundAtom, Structure);

                // check if there is someone similar to me
                if (mostSimilar != null)
                {
                    refGroundAtom.ChangeState(new SOCIAL_COMPARISON_IN_STRUCTURE_STATE(Structure, mostSimilar));
                    return(true);
                }

                // if couldn't find someone similar in vicinity do not compare
            }

            return(false);
        }
Ejemplo n.º 2
0
        // move to social comparison state if can and should. Return true if can and should and move, else return false
        public bool moveToSocialComparisonStateIfShould(clsGroundAtom refGroundAtom)
        {
            double socialComparisonProbability = Util.random.NextDouble();

            // draw probabilistically whether to compare or not
            if (socialComparisonProbability <= refGroundAtom.getSocialComparisonProbability())
            {
                // do social comparison
                clsGroundAtom mostSimilar = SocialComparison.findMostSimilarByDistanceAndAzimuth(refGroundAtom);

                // check if there is someone similar to me
                if (mostSimilar != null)
                {
                    clsActivityMovement moveToMostSimilar = RouteUtils.createActivityAndStart(refGroundAtom, (int)refGroundAtom.currentSpeed, null);
                    refGroundAtom.resetMovementData();
                    refGroundAtom.ChangeState(new SOCIAL_COMPARISON_STATE(moveToMostSimilar, mostSimilar));
                    return(true);
                }

                // if couldn't find someone similar in vicinity do not compare
            }

            return(false);
        }