Exemple #1
0
        public void Test_002()
        {
            // Model
            // View
            // Controller

            var moves = new List <string>()
            {
                // White, Black
                "G1F3", "G8F6",
                "C2C4", "G7G6",
                "B1C3", "F8G7",
                "D1D4", "E8G8", // castle
                "C1C4", "D7D5",
                "D1B3", "D5C4", // capture
                "B3C4",         // capture, ...
            };

            var game    = new Chess();
            var board   = new Board();
            var printer = new BoardPrinter();

            //board.Move += (move) => Debug.WriteLine("");

            //game.Result += (result) => Debug.WriteLine("");
            //game.Capture += (piece, position) => Debug.WriteLine("");

            foreach (var move in moves)
            {
                game.Apply(move, board);

                printer.Show(board);
            }
        }
Exemple #2
0
        public void Test_002()
        {
            //Model
            //View
            //Controller

            var moves = new List <string>()
            {
                //white, Black - COLLECTION OF STRINGS TO REPRESENT MOVES
                "G1F3", "G8F6",
                "C2C4", "G7G6",
                "B1C3", "F8G7",
                "D1D4", "E8G8",        //CASTLE
                "C1C4", "D7D5",
                "D1B3", "D5C4",        //CAPTURE
                "B3C4",                //CAPTURE
            };

            var game = new Chess();            // refer to class library- view

            var board   = new Board();         // refer to class library -model
            var printer = new BoardPrinter();  //printing to the console

            //board.Move += (moves) => Debug.WriteLine("");//we want an event and I have to declare that myself.

            //game.Result += (result) => Debug.WriteLine("");
            //game.Capture += (piece, position) => Debug.WriteLine("");

            foreach (var move in moves)
            {
                game.Apply(move, board);                //representing the chess board; apply method to the board as a parameter; the method can be somewhere else.

                printer.Show(board);
            }
        }