Example #1
0
        private static decimal getZoom(List <Shot> shotsList, Session.TargetType type)
        {
            bool zoomed  = true;
            bool zoomed2 = true;

            foreach (Shot s in shotsList)
            {
                if (s.score < 6)
                {
                    zoomed = false;
                }
                if (s.score < 1)
                {
                    zoomed2 = false;
                }
            }

            if (type == Session.TargetType.Pistol)
            {
                if (zoomed)
                {
                    return(0.5m);
                }
                else
                {
                    return(1);
                }
            }
            else     //rifle
            {
                if (zoomed)
                {
                    return(0.12m);
                }
                else
                {
                    if (zoomed2)
                    {
                        return(0.29m);
                    }
                    else
                    {
                        return(1m);
                    }
                }
            }
        }
Example #2
0
        public void computeScore(Session.TargetType type)
        {
            //using liner interpolation with the "official" values found here: http://targettalk.org/viewtopic.php?p=100591#p100591


            double coef = 0d;

            if (type == Session.TargetType.Pistol)
            {
                coef = 9.9d / (((float)ISSF.outterRingPistol / 2d) + ((float)ISSF.pelletCaliber / 2d));
            }
            else if (type == Session.TargetType.Rifle)
            {
                coef = 9.9d / (((float)ISSF.outterRingRifle / 2d) + ((float)ISSF.pelletCaliber / 2d));
            }

            double score = 10.9999d - (coef * (float)this.radius); //10.9999 is needed to get the incline just right. center should be almost 11

            this.decimalScore  = (decimal)(Math.Truncate(score * 10)) / 10m;
            this.decimalScore += 0.0m; //add a decimal if the result is an integer


            if (this.decimalScore < 1)   //shot outside the target
            {
                this.decimalScore = 0;
            }

            this.score = (int)Math.Floor(this.decimalScore);

            if (type == Session.TargetType.Pistol)
            {
                //double score = linearInterpolation(ISSF.pistol1X, ISSF.pistol1Y, ISSF.pistol2X, ISSF.pistol2Y, (float)this.radius);

                //determine if inner ten (X)
                if (this.radius <= ISSF.innerTenRadiusPistol)
                {
                    this.innerTen = true;
                }
                else
                {
                    this.innerTen = false;
                }
            }
            else if (type == Session.TargetType.Rifle)
            {
                //double score = linearInterpolation(ISSF.rifle1X, ISSF.rifle1Y, ISSF.rifle2X, ISSF.rifle2Y, (float)this.radius);

                //determine if inner ten (X)
                if (this.radius <= ISSF.innerTenRadiusRifle)
                {
                    this.innerTen = true;
                }
                else
                {
                    this.innerTen = false;
                }
            }
            else
            {
                Console.WriteLine("Unknown current target " + type);
            }
        }
Example #3
0
        public void computeScore(Session.TargetType type)
        {
            //using liner interpolation with the "official" values found here: http://targettalk.org/viewtopic.php?p=100591#p100591


            if (type == Session.TargetType.Pistol)
            {
                double score = linearInterpolation(ISSF.pistol1X, ISSF.pistol1Y, ISSF.pistol2X, ISSF.pistol2Y, (float)this.radius);

                this.decimalScore  = (decimal)(Math.Truncate(score * 10)) / 10m;
                this.decimalScore += 0.0m; //add a decimal is the result is an integer

                if (this.decimalScore < 1) //shot outside the target
                {
                    this.decimalScore = 0;
                }

                this.score = (int)Math.Floor(this.decimalScore);

                //determine if inner ten (X)
                if (this.radius <= ISSF.innerTenRadiusPistol)
                {
                    this.innerTen = true;
                }
                else
                {
                    this.innerTen = false;
                }
            }
            else if (type == Session.TargetType.Rifle)
            {
                double score = linearInterpolation(ISSF.rifle1X, ISSF.rifle1Y, ISSF.rifle2X, ISSF.rifle2Y, (float)this.radius);

                this.decimalScore  = (decimal)(Math.Truncate(score * 10)) / 10m;
                this.decimalScore += 0.0m;    //add a decimal is the result is an integer

                if (this.decimalScore >= 11m) //the linear interpolation returns 11.000003814 for 0 (dead centre)
                {
                    this.decimalScore = 10.9m;
                }

                if (this.decimalScore < 1)  //shot outside the target
                {
                    this.decimalScore = 0;
                }

                this.score = (int)Math.Floor(this.decimalScore);

                //determine if inner ten (X)
                if (this.radius <= ISSF.innerTenRadiusRifle)
                {
                    this.innerTen = true;
                }
                else
                {
                    this.innerTen = false;
                }
            }
            else
            {
                Console.WriteLine("Unknown current target " + type);
            }
        }