Пример #1
0
        public static async Task Start(int port)     // Client-like stuff, shouldn't remain here
        {
            await Task.Delay(1000);

            var line1 = Console.ReadLine()?.Trim();
            var line2 = Console.ReadLine()?.Trim();

            var targetjson = string.IsNullOrEmpty(line1)? "{\"id\":0, \"target\": \"abcd\"}": line1;
            var tryjson    = string.IsNullOrEmpty(line2)? "{\"id\": 0, \"parallel\": true, \"monkeys\": 20, \"length\": 4, \"crossover\": 90, \"mutation\": 20 }": line2;

            var target = JsonSerializer.Deserialize <TargetRequest> (targetjson);
            var trie   = JsonSerializer.Deserialize <TryRequest> (tryjson);

            target.id = port;
            trie.id   = port;

            //Console.WriteLine ($"..... target: {target}");
            //Console.WriteLine ($"..... try: {trie}");

            var self = new HomeModule();

            await self.ReceiveClientTarget(target);    // Fitness stuff, shouldn't remain here

            await self.ReceiveClientTry(trie);
        }
Пример #2
0
        public static async Task Main(string[] args)    // Program stuff, shouldn't remain here
        {
            await Task.Delay(0);

            WriteLine($"..... Main");

            var port = 0;

            if (args.Length > 0 && int.TryParse(args[0], out port))
            {
                ;
            }
            else
            {
                port = 8101;
            }

            await HomeModule.Start(port);
        }