Exemplo n.º 1
0
        public List <IOpCode> ResolveOpCodes(string input)
        {
            var tests = RunTests(input);

            var opCodeWithoutId = OpCodes.Count(o => !o.OpCode.HasValue);

            while (opCodeWithoutId != 0)
            {
                var testWithOneMatchOnly = tests.First(t => t.MatchingOpCodes.Count == 1);
                var match = testWithOneMatchOnly.MatchingOpCodes.First();
                match.OpCode = testWithOneMatchOnly.OpCode;

                foreach (var opCodeTest in tests)
                {
                    opCodeTest.MatchingOpCodes.Remove(match);
                }

                opCodeWithoutId = OpCodes.Count(o => !o.OpCode.HasValue);
            }

            return(OpCodes);
        }