示例#1
0
        private async Task <Board> ParseBoard()
        {
            if (_brain == null)
            {
                _brain = new CompositeBrain(_input);
            }

            _brain.Parse();
            var board = _brain.Board;

            return(board);
        }
示例#2
0
文件: Program.cs 项目: ilking/Dominos
        public static void Main(string[] args)
        {
            var I = args.Length;

            if (I < 6)
            {
                Usage();
            }
            else
            {
                FindInputArgs(args);
                FindOutputArgs(args);
                if (_inFile == null || _brainType == null)
                {
                    return;
                }

                var rd      = new TxtReader(_inFile);
                var numbers = rd.Nums;

                IBrain brain = null;
                switch (_brainType)
                {
                case "GreedyHorizontalBrain":
                    brain = Factory.CreateInstance <GreedyHorizontalBrain>();
                    break;
                }

                if (brain == null)
                {
                    return;
                }
                brain.Parse(numbers);
                var ot = brain.board;
                var wr = new TxtWriter(_outFile);
                wr.Write(ot);
            }
        }