Esempio n. 1
0
        public ActionResult DecodeModifiedRepetition(SantaComm comm)
        {
            StringBuilder msg = new StringBuilder();

            for (int i = 0; i < comm.RepetitionCode.First().Length; i++)
            {
                List <LetterCount> count = comm.RepetitionCode.Select(x => x[i]).GroupBy(c => c).Select(x => new LetterCount
                {
                    Letter = x.Key,
                    Count  = x.Count()
                }).ToList();
                LetterCount leastfrequent = count.OrderBy(x => x.Count).Take(1).First();
                msg.Append(leastfrequent.Letter);
            }
            CorrectedMessage correctcomm = new CorrectedMessage();

            correctcomm.Message = msg.ToString();
            return(PartialView("Message", correctcomm));
        }
Esempio n. 2
0
        // GET: Day6
        public ActionResult Index()
        {
            SantaComm comm = new SantaComm();

            return(View(comm));
        }