void SingleFrameTime()
        {
            var snake = new Snake {
                Ang = 0
            };
            var now   = DateTimeOffset.Now.ToUnixTimeMilliseconds();
            var frame = new SlitherFrame {
                SnakeLength = 2, Time = now + 2000, Snake = snake
            };
            var processedFrame = _frameProcessor.ProcessSingleFrame(frame);

            Assert.Equal(now + 2000, processedFrame.Time);
        }
        public GameDecision PlayGame(string id, SlitherFrame slitherFrame, int millisecondsToAction)
        {
            var normalizedFrame = SlitherFrameNormalizer.NormalizeFrame(slitherFrame);
            var processedFrame  = FrameProcessor.ProcessSingleFrame(normalizedFrame);

            var decision = new GameDecision {
                MatchConfidence = 0
            };
            var killDecision = new GameDecision {
                MatchConfidence = 0
            };

            foreach (var game in GameDatabase.Games)
            {
                Parallel.ForEach(game.Frames, (frame, pls, frameIndex) =>
                {
                    if (frame.Outcome.ShortTerm.Alive)
                    {
                        ActionResult actionResult = null;
                        var confidence            = ProcessedFrameMatchAnalyzer.GetMatchConfidence(processedFrame, frame);
                        if (confidence > decision.MatchConfidence)
                        {
                            actionResult = GetActionResult(millisecondsToAction, game, (int)frameIndex);

                            decision.MatchConfidence  = confidence;
                            decision.PredictedOutcome = frame.Outcome;
                            decision.TargetAngle      = actionResult.Angle;
                            decision.Sprint           = actionResult.Sprinting;
                        }
                        if (confidence > killDecision.MatchConfidence && frame.Outcome.ShortTerm.Kills > 0)
                        {
                            if (actionResult == null)
                            {
                                actionResult = GetActionResult(millisecondsToAction, game, (int)frameIndex);
                            }

                            killDecision.MatchConfidence  = confidence;
                            killDecision.PredictedOutcome = frame.Outcome;
                            killDecision.TargetAngle      = actionResult.Angle;
                            killDecision.Sprint           = actionResult.Sprinting;
                        }
                    }
                });
            }

            return(decision);
        }