Esempio n. 1
0
 public Player(PlayerModel player)
 {
     Score      = player.Score;
     Position   = new Point(player.Position);
     Lines      = new HashSet <Point>(player.Lines.Select(l => new Point(l)));
     Direction  = player.Direction;
     HasCapture = false;
     Bonus      = player.Bonuses.Length > 0 ? new PlayerBonus(player.Bonuses[0]) : null;
 }
Esempio n. 2
0
        public static double GetAverageSpeed(PlayerBonus bonus, int depth)
        {
            if (bonus == null)
            {
                return(5);
            }

            if (bonus.Type == Bonus.Nitro)
            {
                int speedSum = 0;
                for (int t = 1; t <= depth; t++)
                {
                    if (t <= bonus.Ticks)
                    {
                        speedSum += 6;
                    }
                    else
                    {
                        speedSum += 5;
                    }
                }

                return((double)speedSum / depth);
            }

            if (bonus.Type == Bonus.Slow)
            {
                int speedSum = 0;
                for (int t = 1; t <= depth; t++)
                {
                    if (t <= bonus.Ticks)
                    {
                        speedSum += 3;
                    }
                    else
                    {
                        speedSum += 5;
                    }
                }

                return((double)speedSum / depth);
            }

            return(5);
        }