コード例 #1
0
        public static void Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;
            var Model      = new GameModel();
            var GUI        = new GameGUI();
            var Controller = new GameController(Model, GUI);

            Model.AddController(Controller);
            GUI.AddController(Controller);

            Model.SetTheGameUp();

            while (true)
            {
                Console.Clear();
                GUI.PrintBoard();
                var move = GUI.GetUserMove();
                if (!Model.IsCandidateMove(in move))
                {
                    Console.WriteLine("This move is not allowed. Press any key to try again.");
                    Console.ReadKey();
                    continue;
                }
                Model.MakeMove(in move);
                Model.CreateListOfCandidateMoves();
            }
        }