Example #1
0
        static void Main(string[] args)
        {
            var brettLeif = new BoardModel();

            while (true)
            {
                BoardView.Show(brettLeif);
                Console.WriteLine("Skriv inn hvor du vil plassere X, f.eks: a1, b2, c3");
                var posisition = Console.ReadLine();
                brettLeif.settX(posisition);
                BoardView.Show(brettLeif);

                Thread.Sleep(2000);
                brettLeif.settO();
            }
        }
Example #2
0
        public static void Show(BoardModel boardModel)
        {
            Console.Clear();
            var winningChar = boardModel.isWinning();
            var content     = boardModel.Contentz;

            Console.WriteLine("  a b c ");
            Console.WriteLine(" ┌─────┐");
            ShowLinez(0, content);
            ShowLinez(3, content);
            ShowLinez(6, content);
            Console.WriteLine(" └─────┘");

            if (winningChar != CellContent.None)
            {
                var symbol = winningChar == CellContent.SettO ? "Datamaskinen" : "Du";
                Console.WriteLine("\n" + symbol + " har vunnet!");
                Environment.Exit(0);
            }
        }